Rotary Encoder decoder
This is a basic Rotary Encoder reader routine for a PIC 16F62X series micro-controller that provides a positive 'true' output on PORTB bit6 or bit7 for rotation in the opposing directions and both 'low' when no change is detected. PORTB bit5 gives 5mSec positive 'true' pulse when any valid change is detected;
PORTB bit5 is pulsed positive 'true' for about 200mSec after power-up as indication of readiness.
PORTA are inputs and PORTB b5,6 & 7 are the outputs.
Four Rotary Encoders can be used but note that all changes are sent to a single pair of outputs as would be suitable for Flight Simulator key function: Inputs are made to PORTA in sequential pairs 'AB' with 'A' on even numbered inputs and 'B' on odd numbered inputs.
Inputs should be hardware "de-bounced" to complement the software "de-bounce" function and Schmitt trigger inputs: a suggested circuit is available.
The outputs can be used to drive a 2N7002 FET which are coupled to the keyboard = & - keys for the increase/decrease function: a suggested circuit is available.
The software FSKeys6 is part of a larger programme that provides a simulated key-press for toggle input that is not included here.
The software is Copyright but may be freely used for non-commercial purposes; please contact me for permission for use in commercial activity.
Rotary Encoder reader routine
Back to Home page
content generator: Lotus Word Pro & MS Notepad