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

8 次查看(过去 30 天)
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

回答(2 个)

Vignesh Rangaishenvi
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 2014-11-3
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...

类别

Help CenterFile Exchange 中查找有关 Data Acquisition Toolbox Supported Hardware 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by