|
Re: Coding the Gear Tooth Sensor
First, a question - do you have digital_io_05 set as an input? if not, that may be part of your problem...
Next, i would highly recommend using Kevin Watson's encoder code (see the sticky at the top of the forum) for doing the gear tooth sensors. It needs a small amount of modification, but not much, and it sets up the GTS as interrupts, which help ensure you won't miss information. If your code above is in the main user part of your code, the line will only execute once every 26.2ms, which may or may not fall on a pulse from the GTS. an Interrupt, however, will force the code to be called to increment the counter every time the input changes from a 0 to a 1, so you shouldn't miss any information from the GTS.
|