Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQmx - trigger based on AB encoder ??

Ryan,

The VI attached is not the final app but this is what I use at the moment to make as much images as I can.
I eventually decided to change a bit the process to depend the less possible on the way the motor rotates (-/+ trigonometric rotation). A collegue made me a tiny electronic device that receives the quadrature pulse (180000 pulses / revolution) and sends back a simple counter (720 000 pulses / revolution) and digital line 0/5 Volts that gives +/- trigo rotation.
As you can see the divisor in made with a simple DAQmx task, not on the quadrature signal but on the signal I get from the electronic device.

I've been testing this with a linear Basler l101k camera and it works fine, but if you have any comments or suggestions about the code, please let me know Smiley Surprised

Thanks a lot for your interest Smiley Happy.

We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

0 Kudos
Message 11 of 16
(2,188 Views)
Voltage Viper [DE],
 
Thank you very much for your answer.
 
This task can indeed be done very easily by the use of an external circuit. I'm using a LS7083 from LSI configured in X4 mode. Its output is used to trig the AI (one sample for every channel) and the reading of the value of the position counter. But I'm looking for a solution without this external IC. As said before, the resolution wouldn't be high enough without the X4 mode. Reading your answer to Titou's question, I thought it would perhaps be possible to use the "virtual" output of the position counter of the DAQ card instead of the external signal.
 
Many thanks in advance for any advice
 
 
JB,

After scratching my head a bit, I can't think of a single way to do what you want. You may be limited to only sampling on one of the edges of one of your phases. Of course, this would give you only a quarter of the resolution of sampling on both rising and falling edges of both phases. Adding a single external IC to perform an XOR of your A and B signals could double this resolution. And I suppose you could add more circuitry to pulse on both the rising and falling edges of this XORed signal, giving you the resolution you desire. Would this be an option? If you get something working, please let us know!

Hope this helps,

Ryan V.
Applications Engineer
National Instruments
0 Kudos
Message 12 of 16
(2,180 Views)
JB,

Attached is an example which implements what I suggested earlier. It uses 3 tasks: analog input, counter input, and digital input. The analog and counter input should be obvious, but the digital may not be. The reason I use a digital input task is for the change detection ability of these lines. Basically, it samples the state of the lines every time a change is detected on any one of them. We don't really care about the state, but it is useful to use the change detection event (a hardware signal) as our sample clock. In my example, I use this event as the sample clock for both counter position and analog input. This allows me to build an XY graph of voltage vs. position. I used the device test panels in MAX to generate a slowly varying analog output (.1Hz), then manually rotated my encoder. I was able to see "gaps" where the voltage was changing, but the position was not (when I adjusted my hand to re-grip the shaft). Note that you may need to change some of the block diagram constants to reflect your device name. Please let me know if you have any questions!

Hope this helps,

Ryan Verret
Product Marketing Engineer
Signal Generators
National Instruments
Message 13 of 16
(2,172 Views)
JB,

One thing that I forgot to mention: you will need to physically wire your encoder signals to both P0.0 and P0.1 (pins 52 & 17) and the default M Series PFI lines for encoder measurements (CTR0 SRC & AUX, pins 37 & 45). Let us know if it works for you!

Regards,
Ryan Verret
Product Marketing Engineer
Signal Generators
National Instruments
0 Kudos
Message 14 of 16
(2,169 Views)
Hello Ryan,
    I have the same issues as TiTou and have been trying, without success, to make your example work with a PCI 6602.  Have you had a chance to verify this with real hardware?

Thanks

Mike Everly
0 Kudos
Message 15 of 16
(2,051 Views)

I'm not at a LV PC now to check the posted code or run anything, but I can tell you this:

The 6602 does NOT support the digital change detection feature.  Ryan's 5-star idea is really best suited for the M-series boards because they support all the necessary elements at once: digital change detection, quadrature position measurement, analog i/o.

-Kevin P.

ALERT! LabVIEW's subscription-only policy coming to an end (finally!). Permanent license pricing remains WIP. Tread carefully.
Message 16 of 16
(2,041 Views)