counting encoder pluses.
Deano1936
Posts: 15
I'm using a BS2pe stamp. I have a DC servo motor with an optical encoder that puts out 400 pulses per rev. I have tested the unit using the P basic "COUNT" function .
It works great. I would like to output a motor stop command when the counter reaches a predetermined count. The problem I have with the count function is that I can't use the count viable until the count duration time has been reach. Can anyone give me a source code that would accomplish this task ?
Thank you.
Dean
It works great. I would like to output a motor stop command when the counter reaches a predetermined count. The problem I have with the count function is that I can't use the count viable until the count duration time has been reach. Can anyone give me a source code that would accomplish this task ?
Thank you.
Dean
Comments
-Phil
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·"If you build it, they will come."
Regards
Allie
what is the link to the pak. thanks, jim
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
The smarter I get, the more I understand I don't know!
Go to www.awce.com for the pak. Under awc electronics logo choose pak selection guide then choose pulse I/O pak-VII.
Simple counting of pulses may work for what you are doing, but I am not sure you are aware that encoders produce two out-of-phase count channels, and a true decoder will count both up and down as appropriate to track the position of the encoder. A simple counter on one of the channels can't do that.
The Stamp will have to return often to read the encoder, or else it might seriously overshoot. Ideally for your purpose, your coprocessor would provide an simple "interrupt" on a pin so that the Stamp could easily poll for the end of the travel. The coprocessor would have to have a count/compare/interrupt function, but I don't know of one that does that.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com