How do I set an analog trigger on NI USB-6251 with session-based approach?

8 views (last 30 days)
Hello, I am trying to alter my MatLab code to use the new 64-bit R2013 session-based approach. I'm unable to set up an analog trigger through the ai0 connection on my NI USB-6251 DAQ board. Here is a bit of the code and error I receive:
PAG_autorec3_64bit(0.1,0.1,10)
Error using PAG_autorec3_64bit (line 67)
Terminal 'ai0' is not known on 'Dev1'
Ultimately, my bigger question is how to re-create the code below in the session-based approach:
set(AI, 'TriggerType', 'Software');
set(AI, 'TriggerCondition', 'Rising');
set(AI, 'SamplesPerTrigger', samplenum);
set(AI, 'TriggerChannel', chand);;
set(AI, 'TriggerConditionValue', strikeThreshold)
set(AI, 'TriggerDelay', ratioForTriggerDelay * duration);
set(AI, 'Timeout', nidaqtimeout)
Thanks in advance for the help!
Patrick Green

Answers (2)

Vignesh Rangaishenvi
Vignesh Rangaishenvi on 20 Jun 2014
Use the MATLAB function addTriggerConnection to add a trigger connection. For example, the following MATLAB command would add a trigger connection from an external device to terminal PFI1 on Dev1 :
addTriggerConnection(s,'external','Dev1/PFI1','StartTrigger')
From the error snippet you specified above, I believe the ai0 input channel is not added from Dev1 to the session. To add the analog input channel from Dev1 , use the following MATLAB command:
addAnalogInputChannel(s,'Dev1','ai0', 'Voltage');
You can re-create the code you specified above on MATLAB. For instance, you can set TriggerCondition to 'Rising' using the following MATLAB command:
s.Connections(1).TriggerCondition = 'Rising';
where 's' is the session object. For more information on setting up trigger connections, refer to trigger connections.

Giandomenico
Giandomenico on 3 Nov 2014
I have the same problem, I want set up an analog trigger through the ai0 connection on my NI PCI 6070E board with the session-based approach, enabling the trigger when ai0 rises a "value". But I don't find how to do that...

Categories

Find more on Data Acquisition Toolbox Supported Hardware in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!