Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

pci-6624 task synchronisation

hello all,
I'm currently trying to realize a 3-channel (=3 counters) position measurment using my new pci-6624 card.
I looked at the provided daq-mx example (AngularPosition-Buff-Cont.c) and derived my cvi-code from that.
I realized I had to create a separate task for each counter, which works so far, but I noticed I always have a phase shift between the 3 measured channels, even if I feed the _same_ signal to all 3 counters.
so I tried to start all 3 tasks via an external trigger signal (which is what will be used most often, anyways), but this gives me an error (see attached screenshot) - so I wonder if it is not possible to use an external trigger signal for starting position measurment tasks ??
any help/hint would be greatly appreciated.
I also add the relevant c-code, if that is of interest.


--
Once the game is over, the king and the pawn go back into the same box.
Download All
0 Kudos
Message 1 of 15
(5,588 Views)
Unfortunately it is not possible to use a digital trigger for a position measurement task.

What you could do is, add all three channels to a single task. You dont´have to create a task for every channel. If you have all three channels in one tassk, you start only one task, and so you can reduce your phase-shift (the reason for the phase-shift is, that you start the tasks one after another programatically, not all at the same time.)

Hope this helps.
0 Kudos
Message 2 of 15
(5,574 Views)
andre, thanks for reply -
this is very sad - I wonder how one can design a data acq. function without such a basic functionality (NI: anyone on this ?)
as for the 2nd proposal: I already tried to add all channels to a single task, but then I got an error message meaning that  more than one counter in one task is not possible.
should that be another limitation ?
if so, I suspect this pci6624-buy was just a complete failure.
or could there be a chance to realize what I want with traditional ni-daq ?

--
Once the game is over, the king and the pawn go back into the same box.
0 Kudos
Message 3 of 15
(5,568 Views)
Does your encoder provide a z-index output? If so, you could use that one to synchronize the three tasks. If not, you could take a digital pulse and connect this to the z-index input of the counter to synchronize the three channels. maybe this helps.
Message 4 of 15
(5,565 Views)
thanks again,
yes, all my encoders provide z-index output - I already use this for resetting the count values.
I'll try to figure out how I could use the z-index from one encoder to sync all 3 channels and report back.
btw. I noticed the 6634 is not listed in MAX under traditional daq devices, so I suspect it is not supported by trad. ni-daq at all ?

--
Once the game is over, the king and the pawn go back into the same box.
0 Kudos
Message 5 of 15
(5,563 Views)
ok, it's me again 🙂
unfortunately, I couldn't find any function in my cvi-library-daqmx menu to sync tasks with z-index ??

although I noticed that committing the tasks before actually starting them:

    for (ch = 0; ch < Nch; ch++)    DAQmxErrChk (DAQmxTaskControl (taskHandle[ch], DAQmx_Val_Task_Commit));
    for (ch = 0; ch < Nch; ch++)    DAQmxErrChk (DAQmxStartTask(taskHandle[ch]));

reduces phase shift significantly, but it is still there.
so, the only 'real' solution would be sync-ing via hardware (z-index ?), I guess.

--
Once the game is over, the king and the pawn go back into the same box.
0 Kudos
Message 6 of 15
(5,561 Views)
Yes, the PCI-6624 is not compatible with traditional daq. But you wouldn´t get any additional functionality with traditional daq anyway. With DAQmx you can use the full functionality of the hardware.
0 Kudos
Message 7 of 15
(5,558 Views)
I didn´t try adding multiple counter channels to a task. I knew that this works for analog inputs, so I thought it would work for counters as well. Sorry for that.

What I ment with using z-indexing as a kind of synchronisation method is, that if you could give a pulse to all counters at the same time, they would all be reseted at this moment, and they would be synchronized from that moment on. maybe you could that by connecting a digital trigger line to all z-index inputs of every counter you want to synchronize. You don´t have to change anything in your program for that, it is a hardware-solution.
Message 8 of 15
(5,559 Views)
>I didn´t try adding multiple counter channels to a task. I >knew that this works for analog inputs, so I thought it >would work for counters as well. Sorry for that.

ok, no problem with this 'false hint' 🙂

>What I ment with using z-indexing as a kind of >synchronisation method is, that if you could give a pulse >to all counters at the same time, they would all be >reseted at this moment, and they would be synchronized >from that moment on.
>maybe you could that by connecting a digital trigger line >to all z-index inputs of every counter you want to >synchronize. You don´t have to change anything in your >program for that, it is a hardware-solution.


well, that is in fact what I did during my tests, I just feed the signal from the same encoder to all of my counters, incl. the z-index.
acquired data is not in phase, however.
to be precise: my external signal to control acquisition is 45 KHz, and I see ~ 10 periods (~= 0.2 msec) phase shift from counter to counter.
thanks again for your assistance.
--
Once the game is over, the king and the pawn go back into the same box.
0 Kudos
Message 9 of 15
(5,554 Views)
I haven't used the 6624, but other newer counter/timers can perform triggered position measurements.  The catch is that you don't configure it as a Digital Start trigger.  For counter inputs, you would need to configure an "Arm Start" trigger.

Sorry, I also don't know any syntax for CVI.  I hope the basic info applies to your board.  Then you could sync the measurements properly.  The idea to use one encoder's z-index to reset count values for 3 counter tasks may not work as desired because the z-indexing feature also depends on matching up the corresponding A & B channel states (Low-Low, Low-High, etc.)

-Kevin P.
ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
0 Kudos
Message 10 of 15
(5,547 Views)