11-18-2011 02:57 PM
Hi,
I'm programming DAQmx through the nicaiu.dll with Matlab. I'm trying to start two different tasks, each controlling ctr0 and ctr1, respectively. Both timer/counter tasks should start on a common trigger, in my case /Dev/PFI0. Having searched the forum, I do understand that both tasks can't be triggered off PFI0. Instead, I probably need to trigger one of my tasks on a signal that turns on whenever the first task starts. My question is; What signal can inform my ctr1 task that my ctr0 has started? I basically want these two tasks synchronized, but not pulse by pulse since the pulse trains are quite different.
Trying to trigger both off PFI0 results in a resource conflict. Triggering ctr1 on ctr0gate doesnt work either.
Also, I need ctr1 to trigger on when the ctr0 tasks starts, i.e. not when the first ctr0 pulse appaers!
Thanks,
Per
11-21-2011 01:13 PM
Hey Per,
If I'm correctly understanding what you're trying to do, I think the easiest way to synchronize your two counter outputs would be to use a dummy AI task as shown here: https://decibel.ni.com/content/docs/DOC-11755 . Hope this helps!
Ryan S.
Applications Engineer
National Instruments
11-21-2011 01:44 PM
Thanks Ryan.
I made some changes to my code now and it appears I CAN trigger both counters off PFIO (on an E-Series board). I only recently converted all my Traditional code into DAQmx, and got lost in my tracks. I was trying to generate finite pulse trains on both counters, and had used Finite timing on the counters to generate finite retriggerable pulse trains, without knowing that tied up the second counter. I solved this now using Pause Triggers instead. In the case where I generate single retriggerable pulses I still use a Start Trigger, and I can now Start BOTH counters using DAQmxCfgDigEdgeStartTrig and listening to PFIO with both counters (each counter running off a separate task).
Sorry, I got things confused, and your solution isnt required anymore. Similarly to your solution, though, I have always used a (real) analog output routed externally to the PFI0 pin on my E-Series board as the synchronizing trigger. However, if I could avoid the external wiring it would be nice, so I will explore your solution a bit more
I am not familiar with the concept of a 'dummy' task/channel. Can you point me to more documentation on this?
I already use the analog inputs on this board from another app. Will creating a dummy AI tie up all analog inputs, so I can't then access my physical analog inputs from other applications (on the same board)?
- Per
11-21-2011 02:50 PM
Per,
There really isn't any formal documentation on "dummy" tasks, but they're basically a simple task that isn't expected to do anything other than run. In this case, we use a "dummy" task because we don't care what the signal is, we're just using it as our start trigger. And the "dummy" signal still uses a hardwired input through one of your AI ports but it will not affect the ability of your other applications to talk with the other AI ports. Hope this helps!
Ryan S.