Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

Analog input using external trigger

Solved!
Go to solution
Highlighted

Dear all

 

Hello, I have a problem to get analog input using external trigger.

I'm a newbie, so probably I missed very basic point.

Actually, I wanna do this job via python, but I came here cause there's no forum for python user. It shouldn't be very different from C++ I guess.

(Well, the question is not related to the measurement studio too..)

 

I have USB-6212 (windows10, python 3.7.6, NI MAX 18.5) and want to get analog signal, and am using sync signal(TTL) from a function generator as a trigger.

 

First, I created a task, then created AI voltage channel and set sample clock timing.

And then I connected BNC cable from function generator output to AI0, generated ~for example, sine wave(+-4V, 100Hz).

 

If I read the data without trigger, I can see the waveform generated by the function generator very well.

 

However, if I put

nidaq.DAQmxCfgDigEdgeStartTrig(AItaskHandle,b"Dev%d/PFI0" %num,DAQmx_Val_Rising)
(num is just a device # obtained using DAQmxSelfTestDevice, DAQmx_Val_Rising is 10280)
before the DAQmxStartTask,
I cannot see anything, even if I didn't changed anything of the analog input part.
I connected the TTL signal to PFI0. (I can see the TTL signal via analog input channel, I'm sure that the function generator works well. However, I couldn't see the signal via PFI0 channel. I tried to see it via PFI0 creating Digital input channel and read it, but it just gives me 0 all the time. I'm not sure this is a right way to check if PFI0 channel is alive or not.)
 
Do you have any idea what is the problem here?
Should I do something else or more to do the trigger?
or is there any possibility that PFI0 channel is broken?
 
Please let me know if you need any further information.
 
Thank you so much in advance.
 
0 Kudos
Message 1 of 3
(196 Views)
Highlighted

I forgot to write one thing.

I can translate C++ to python, so please let me know if somebody know how to do it in C++.

 

And to make the question clear,

what I wanna do is start data acquisition(AI) at the falling edge of TTL signal(from an external source) and stop the data acquisition at the rising edge of TTL signal.

 

Thank you in advance!

 

0 Kudos
Message 2 of 3
(148 Views)
Solution
Accepted by topic author Serenade

I found the reason.

I should declare the trigger source like '/Dev1/PFI0'. Not 'Dev1/PFI0'.

 

I could create VI channel without slash in front of Dev#, but not for trigger...that's strange.

Is there anybody know why should I add slash?

 

Anyway, the problem solved.

0 Kudos
Message 3 of 3
(141 Views)