LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I acquire encoder data in NI-Motion as well as DAQmx analog data when triggering DAQmx from encoder phase?

I have a PCI-7340 motion control card and a PCI-6220 DAQ card with an RTSI bus between them.  I am trying to acquire encoder data from the motion control card and analog data from the 6220 simultaneously, so that the analog data is syncronous with the encoder data.  I have seen the example vi "RTSI with DAQmx (encoder-external scan clock).vi" in the examples directory, and I see how to use the Select Signal function to send the encoder phase to the RTSI0 line.  So I can acquire the analog data in a way that is triggered to the encoder phase, but how do I acquire the actual encoder position also at the same instant? 
 
The example vi says "By routing an encoder phase signal, A or B, over the RTSI bus, the motion controller provides an external scan clock to the DAQ device. The external scan clock is directly correlated to encoder position."  But since I don't get encoder position as an output of this vi, I don't see how this correlation works!  If I move 80,000 encoder counts I am not getting 80,000 DAQ points or even anything predictable.  I get some number of samples that changes each time and dramatically changes with move velocity.  None of the numbers seem to mean anything, and they are all thrown off by the untimed while loop in the vi that is polling for one sample at a time from the DAQ card.  It seems like this "correlation" is meaningless to me.  Am I wrong?
 
What I am trying to create is two equal-length arrays of data, one containing encoder counts and the other containing analog data, so that at any index the encoder data was acquired simultaneous to the analog input data.  But I don't see any way of triggering the "Read Encoder Position" function or getting any sort of time-correlated data from the motion control card.  But an NI apps engineer told me when I asked for a hardware recommendation for this application that synchronized data was an easy thing using an RTSI bus and that it was done all the time with these two boards.
 
Does anyone know the answer?
-Devin
I got 99 problems but 8.6 ain't one.
0 Kudos
Message 1 of 4
(2,756 Views)
Not a *real* answer but an idea for a last-resort workaround.  You'd have to parallel wire the encoder signals over to the M-series 6220 board.  You'd further parallel wire them to 2 different inputs of the 6220.  Here's the idea:
 
- encoder A and B channels go to digital port 0, where you configure a digital input task using the "Change Detection" instance of  DAQmx Timing.  Make it sensitive to, well, whatever you want.  Rising and/or Falling on A and/or B.
 
- encoder A and B channels also go to PFI pins where you configure a counter for encoder measurement.  This task and your AI task would use the "ChangeDetect pulse" as the sample clock.
 
All this stuff is more trouble than you should have to deal with, but if you can't make any headway with the motion controller card it's there as a last resort.
 
-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 2 of 4
(2,743 Views)
Nevermind, I think I answered my own question.  The answer is to use modulo breakpoint triggering.
-Devin
I got 99 problems but 8.6 ain't one.
0 Kudos
Message 3 of 4
(2,742 Views)
I will say this, the difference between modulo and relative should be much more publicised.  Now I am stuck with a motion control card that I can't use because I have to sit there in my labview code and continuously reenable the breakpoint.  Thats really stupid for a $1000 card.  How much can it possibly add to the cost to have an auto-re-enable funtion so the stupid breakpoint automatically reenables after a short time.  Apparently $700?
-Devin
I got 99 problems but 8.6 ain't one.
0 Kudos
Message 4 of 4
(2,698 Views)