Incremental Encoder --> Absolute Encoder
crgwbr
Posts: 614
Hello Everyone,
I'm working on a project that requires the use of a very acurette encoder.· We should be using a 12 bit absolute encoder with PWM output, but because of budget cuts, we have to use this one (2500 ppr incrementle encoder).· It has·an "NPN open collecter output."· I have yet to figure out what that means.· What I would like to do is, as soon as the unit turns on, assign the·ENCODER varible 0.· Then every step·the encoder takes up, add one too ENCODER; every step down, subtract one.· I could most likely figure this out on my own, however, I am concerned about the encoder moving while the program is doing somthing else (read keypad, display stuff on LCD, ect.).· At most, the encoder will be moving at 0.5 rpm, but moving·almost constantly.· How can I avoid this "slipage affect."
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
NerdMaster
For
Life
I'm working on a project that requires the use of a very acurette encoder.· We should be using a 12 bit absolute encoder with PWM output, but because of budget cuts, we have to use this one (2500 ppr incrementle encoder).· It has·an "NPN open collecter output."· I have yet to figure out what that means.· What I would like to do is, as soon as the unit turns on, assign the·ENCODER varible 0.· Then every step·the encoder takes up, add one too ENCODER; every step down, subtract one.· I could most likely figure this out on my own, however, I am concerned about the encoder moving while the program is doing somthing else (read keypad, display stuff on LCD, ect.).· At most, the encoder will be moving at 0.5 rpm, but moving·almost constantly.· How can I avoid this "slipage affect."
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
NerdMaster
For
Life
Comments
2500 ppr * (0.5 / 60) = 20.8333 pulses per second.
So as long as you sample faster than that, you shouldn't lose any pulses.
Or you could use the PortB interrupts and that would be even better.
NPN Open collector just means you need a pull-up resistor on the outputs.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Cheap used 4-digit LED display with driver IC·www.hc4led.com
Low power SD Data Logger www.sddatalogger.com
SX-Video Display Modules www.sxvm.com
Don't mistake experience for intelligence. And vis-vera.
Post Edited (Bean (Hitt Consulting)) : 10/5/2006 2:51:42 PM GMT
Although I'm not sure where you got the 30 revolutions per second. I had mentioned 0.5 rpm, meaning about 0.008 revolutions per secound or about 20 pulses per second. Eather way it shouldn't be a problem. Pull-up resister, that means the pulses will be low, and the space will be high, corect.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
NerdMaster
For
Life
Ol' bean multipled instead of divided. 75000 pps or 21 pps... I was close...
Your right about 21 pulses per second. That can easily be handled without missing any by using a period interrupt. For example "INTERRUPT 100" will run the interrupt routine 100 times a second.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Cheap used 4-digit LED display with driver IC·www.hc4led.com
Low power SD Data Logger www.sddatalogger.com
SX-Video Display Modules www.sxvm.com
Don't mistake experience for intelligence. And vis-vera.
·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
NerdMaster
For
Life
You must put the interrupt routine BEFORE any SUBs or code.
Then use:
INTERRUPT 100
' Run this code 100 times per second (every 10mSec)
RETURNINT
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Cheap used 4-digit LED display with driver IC·www.hc4led.com
Low power SD Data Logger www.sddatalogger.com
SX-Video Display Modules www.sxvm.com
Don't mistake experience for intelligence. And vis-vera.
·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
NerdMaster
For
Life
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
NerdMaster
For
Life
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
---
James Newton, Host of SXList.com
james at sxlist,com 1-619-652-0593 fax:1-208-279-8767
SX FAQ / Code / Tutorials / Documentation:
http://www.sxlist.com Pick faster!