Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Analog trigger with 6071e in C

I'm using the NI6071e MIO board and what I need is to perform SCAN_Op continously on 4 AIs. When a trigger of 1.1V reached in AI2 - stop trigger, I need 300 samples pretriggered plus 200 samples of poasttrigger data (total of (300+200)*4 = 2000 samples. I'm writing code in C, using the Microsoft VisualStudio and the traditional NI-DAQ library. Does anyone can explain on how I should perform it? Does anyone have similar code?
I've been directed to a LAB View example that unfortunatly I can't read.

Thanks,
Nir.
0 Kudos
Message 1 of 13
(3,583 Views)
Hello NG,

This example is written using Visual C and traditional NI-DAQ to read a waveform from one analog input channel until an external digital STOP trigger (10 samples taken after STOP trigger), using internal timing. The example uses low-level NI-DAQ functions for E-series devices. You can use it as a reference to your application

Please let me know if this example was useful.

Thanks,

LA
0 Kudos
Message 2 of 13
(3,566 Views)
Thanks LH,

The example is not quiet what I try to do. I'm try to scan continuously multiple AI's until the voltage on the first AI of the list scan is exceeded. I need to read the pre 30 and the post 10 measurements for each channel in channel list. I tried to modified an example but it doesn't work. The trigger doesn't stop the scan.
Attached is the code I'm using. I'll be grateful for any useful comment about it.
0 Kudos
Message 3 of 13
(3,563 Views)
Hello,

Now that I understand better what you are trying to do, let me check on this during the weekend and I'll get back to you next week.

Thanks,

LA
0 Kudos
Message 4 of 13
(3,545 Views)
Still don't have a solution. Do someone have a hint?
0 Kudos
Message 5 of 13
(3,522 Views)
Hello,
I'll try to offer some tips. It looks like you are trying to set up two different triggers for an analog input. This can not be done. Some different options for you are to use pause triggering, reference triggering, or some sort of software triggering. Pause triggering will allow you to collect data when the voltage is above (or below) some trigger value. When the voltage drops below (or above) the trigger value it will no longer acquire data. Another option is using a reference trigger. You can set up a reference trigger to acquire a predetermined number of data points before and after a trigger. Another option might be to use your analog signal as a start trigger for a continuous acquisition. Then, in software, monitor the data being acquired from the trigger channel. When the trigger channel acquires some data that is below your trigger level, stop the acquisition in software (after you have acquired all of your post-trigger data points). I hope this information helps!
-Alan A.
Message 6 of 13
(3,484 Views)
Thanks Alan,

About what you writeing "It looks like you are trying to set up two different triggers for an analog input",
What do you mean? Do you see it from the code I attached or from the question itself?
If the code is wrong, can you pls specify what in the code should be changed?
In the traditional NI-DAQ help file, in the description of SCAN_Start() function, I found that in the "Using the function" part, the fourth paragraph describes operation that is similar to what I try to do. I probably didn't configured the board correctly and I instruction (code example) for it.
0 Kudos
Message 7 of 13
(3,474 Views)
Yes, I looked at your code to determine that you were setting up two triggers. You set up a stop trigger (DAQ_StopTrigger_Config), and a start trigger (Configure_HW_Analog_Trigger). Only one trigger can be used for an analog input. The documentation you read does talk about a stop trigger, acquiring pre and post trigger scans. That will work fine if you remove the start trigger code. If you want to have a start trigger and a stop trigger, one of them will have to be implemented in software. Here's how you could set up a stop trigger in software:
1) Set up a hardware start-triggered continuous acquisition
2) Continuously monitor the voltage on your trigger channel
3) When the voltage on that channel goes below your trigger level, acquire all of your post-trigger data and stop the acquisition.
If this is not feasible in your application, you might want to consider starting your acquisition in software and using a stop trigger.
-Alan A.
0 Kudos
Message 8 of 13
(3,461 Views)
I don't need the Start Trigger.
The line:
// Select_Signal (iDevice, ND_IN_START_TRIGGER, ND_PFI_0, ND_LOW_TO_HIGH);

is commented out. Do you see any other problem?
0 Kudos
Message 9 of 13
(3,461 Views)
Yes, actually you will probably want to have the select signal function. You need to remove the Configure_HW_Analog_Trigger function. Please look at the example posted previously on this thread (by LA). That example does what you are trying to do.
-Alan A.
0 Kudos
Message 10 of 13
(3,280 Views)