Thread: Speed Sensor
View Single Post
  #10   Spotlight this post!  
Unread 13-01-2006, 05:44
BradAMiller BradAMiller is offline
Registered User
AKA: Brad
#0190 ( Gompei and the Herd)
Team Role: Mentor
 
Join Date: Mar 2004
Location: Worcester, MA
Posts: 592
BradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant future
Re: Speed Sensor

Quote:
Originally Posted by Workaphobia
Will that work with any encoder, or only quadrature encoders?
The code will probably work with any single input encoder provided that you tell it that the B Channel is an input that is always high or low (disconnected or jumpered). The code will read what it thinks is the B channel and it will see the same value, making it always count in the same direction.

For example, in the interrupt service routine for EasyC you connect the A channel to pins 1-6. When the interrupt on the A channel happens, the code reads the B channel to decide whether to count up or down. It doesn't matter if the B channel is actually connected to an encoder - it only sets the count direction.

If you decide to use EasyC it has built-in encoders that only look at a single input.

Brad