From Friday, January 17th 11 PM CDT (January 18th 5 AM UTC) through Saturday, January 18th 11:30 AM CDT (January 18th 5:30 PM UTC), ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQmx - trigger based on AB encoder ??

Hello all,

I need to generate a pulse to trig a camera every 2° rotation of a motor. I have Rotative AB encoder (16000 pulses for 360°).

Can someone tell me how to setup a trigger to generate continuous pulses based on every 89 encoder pulses. I am using the quadrature input instead of the simple pulse with edge counting to eliminate any issue of vibrations causing the encoder to move backwards a few ticks.

Thanks for help

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

Epictetus

Antoine Chalons

0 Kudos
Message 1 of 16
(5,906 Views)
TiTou,

Sorry for the delay in posting... I've been meaning to test this out with hardware before I suggested it. The only way the DAQmx driver exposes the functionality to do what you want is to use an angular encoder task (or a linear encoder, i guess) with Z index enabled. If you preload the value of the initial angle and set the Z index value intelligently, you can put the count register within a certain number of binary values of the terminal count. Use the CI.Count DAQmx Channel property node to verify the value of the count register - the Counter Read will return scaled data. Then, you'll need to set the internal output of the counter to pulse on the terminal count. You can then feed this signal back (either internally or externally) to the Z index input of the counter. This way, the counter will begin counting (with quadrature inputs) until it reaches the terminal count. Upon the terminal count pulse, you will reset the value of the count register and begin the process again. It is the counter output signal that you will use as your trigger. Of course, if your counter starts counting down instead of up, it will be a long time before you get that pulse. This will also depend on the details of your encoder (as to how to set your Z index phase). You also wont be able to get valid values from your counter read - you'll have to use another counter if you want to do that. Anyway, please let us know your results! Also, let me know if you have any questions about the process.

Regards,

Message Edited by Voltage Viper [DE] on 03-21-2006 05:03 PM

Ryan Verret
Product Marketing Engineer
Signal Generators
National Instruments
Message 2 of 16
(5,854 Views)

Hello Voltage Viper [DE],

I have a related question. I'm using a counter of a PCI-6229 configured as an angular encoder with X4 mode. I would like to trig an AI measurement on every change of this position counter. Is there a way to route this "virtual output signal" of the counter to a PFI line or to use it internally ?

Many thanks in advance

0 Kudos
Message 3 of 16
(5,839 Views)
Hello Ryan,

I also apologize for the delay in replying.

I've been trying to "put your solution into code" with no success. The point is that I don't really understand the idea of your solution and also I am not familiar to the DAQmx vocabulary... this results in a total mess in my mind.

I pointed the parts that are not clear for me...

Voltage Viper [DE] a écrit:

If you preload the value of the initial angle and set the Z index value intelligently, you can put the count register within a certain number of binary values of the terminal count. Use the CI.Count DAQmx Channel property node to verify the value of the count register - the Counter Read will return scaled data. Then, you'll need to set the internal output of the counter to pulse on the terminal count. You can then feed this signal back (either internally or externally) to the Z index input of the counter. This way, the counter will begin counting (with quadrature inputs) until it reaches the terminal count. Upon the terminal count pulse, you will reset the value of the count register and begin the process again.


I now understand that your idea is to enable the Z index and feed it with a signal that counts input pulses, but the way to code that is not clear for me. Some code would really help me to go passed this issue.

I really appriciate your help.



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

Epictetus

Antoine Chalons

0 Kudos
Message 4 of 16
(5,823 Views)
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 Verret
Product Marketing Engineer
Signal Generators
National Instruments
Message 5 of 16
(5,811 Views)
JB,

I just thought of something... You could wire the same signals into your M Series' digital lines and run a change detection task. You could then route the change detection event to your AI sample clock. This should give you the behavior you desire. Please post back if you need help implementing this.

Regards,
Ryan Verret
Product Marketing Engineer
Signal Generators
National Instruments
Message 6 of 16
(5,808 Views)