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

조회 수: 8 (최근 30일)
Patrick Green
Patrick Green 2014년 1월 10일
답변: Giandomenico 2014년 11월 3일
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
Vignesh Rangaishenvi 2014년 6월 20일
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에서 Simultaneous and Synchronized Operations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by