edge detection encoder (counting)
jacko87
Posts: 6
Hi guys,
I have a problem with detecting the encoder signal. Can Basic Stamp detect the change of input state from low to high and high to low, and then it count the number of change?
An encoder will give a signal for example 1-0-1-0-1-0-1-0 when my motor rotates, so can I have the BS counts the number of change (from the example, it should give 7)?
In other word, I want to detect the edge (either falling edge and rising edge)...
I have a problem with detecting the encoder signal. Can Basic Stamp detect the change of input state from low to high and high to low, and then it count the number of change?
An encoder will give a signal for example 1-0-1-0-1-0-1-0 when my motor rotates, so can I have the BS counts the number of change (from the example, it should give 7)?
In other word, I want to detect the edge (either falling edge and rising edge)...
Comments
You can change "edges" by setting it to count either the 1's or the 0's.
Watch the timing.· The program loop will need to run faster than the time it takes for the pin to cycle between states, otherwise it will skip counts.· Normally this isn't a problem unless you have large wheel diameters, high RPM's, and encoders with a large number of counts per rev.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Engineering
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·"If you build it, they will come."
Post Edited (erco) : 7/1/2009 11:38:50 PM GMT