Discussion:
How to synchronize the values of two shaft encoders?
(too old to reply)
Mahmoud Ismail
2008-05-30 14:10:13 UTC
Permalink
Hello everybody,
 
I'm sure that my question has been asked for hundereds of times by now, but for some reason it doesn't seam to work well with me. Thus I hope you guys can help me out.
 
I have 2 encoders that return pulses allowing me to measure their angular position.
Thus I would like to read their values at the same time, i-e synchronize there values.
The 1st is slower than the second so I thought to use the A signal of the 1st encoder as the source for "DAQmx Timing".
If I understood the correct functioning of the M series and DAQ then it should work, but for some reason it's not giving me the correct results.
it seams to me that the buffer is recording more values for the faster encoder.
My encoders run at a speed no more that 100rpm and each return 18000pulses/round.
 
I attached the vi to this message hoping that someone can tell me where my mistake is!!
 
I would be very grateful for any reply.
 
Regards
Mahmoud


SyncronizedDecoders.vi:
http://forums.ni.com/attachments/ni/250/40414/1/SyncronizedDecoders.vi
RuedigerE
2008-06-03 17:40:12 UTC
Permalink
Hi, I think the article below could help you.http://zone.ni.com/devzone/cda/epd/p/id/4439
Mahmoud Ismail
2008-06-20 11:40:09 UTC
Permalink
Thanks Ruedider,
 
I already checked it out, but I'm not sure if it helps.
The thing is that I only have two counters, which I would like to use for my Shaft encoders, thus I'm not sure if I can use the same counter as a reader and a generator at the same time!!
 
regards
Mahmoud
Kevin Price
2008-06-20 13:40:07 UTC
Permalink
Something I've done is to create a "dummy" AO task which continuously generates a constant 0V.  It's *real* purpose is provide a sampling clock signal that I can use in my encoder tasks.  Configure and start the encoder tasks first, wiring in a sample clock source with a name somthing like "Dev1/AOSampleClock".  At this point, the encoder counters are tracking position, but not yet sampling.  When you start the AO task at the desired sample rate, then the clock will also buffer up your encoder values in sync with each other.
If the encoders are in motion when you start the app, be aware of the following little nuance: all buffered samples for the 2 tasks correspond to the same instant in time BUT the very first reading for each represents the amount of position change from the time you started the encoder task until the first AO sample clock.  These initial times / position changes will be slightly different for the 2 encoder tasks.
-Kevin P.
Mahmoud Ismail
2008-06-20 14:40:08 UTC
Permalink
Thanks a lot Kevin for your comment,
Please excuse me for my very limitted knowledge in DAQ, coz I'm totally new in this field. I would like to ask, can't I simply use one of the encoders signals as my sampling frequency, because in my problem I'm not interested in the time, I'm only interested in the simultaneous position of both encoders. Thats why instead of using a sampling signal which is generated by a counter I'm wiring the "Sample Timer" directly to slower Quadreture encoder "signal in".About the 1st results, I'm already taking care of it by iliminating them out, but I noticed that the two buffers are having different amount of values which means that the values are not syncronized :(
I would be very grateful for any further help.
Mahmoud

Loading...