Description
These three source code examples interface a quadrature encoder clock, data and button signals to the Propeller 2. The first two versions are useful for seeing the internals of the encoder signals, but the third version is a demo with its own encoder object.
- Rotary_Encoder_Demo1_Archive.zip – read a quadrature encoder with Spin2 and PASM
- Rotary_Encoder_Demo2_Archive.zip – read a quadrature encoder with Spin2 and a more advanced PASM that keeps track of prior positions
- Rotary_Encoder_Demo3_Archive.zip – puts the encoder into its own object
The encoder object and terminal (which may be Parallax Serial Terminal or ANSI-Compliant) are started in this method:
pub setup()
enc.start(ENC_A, ENC_B, ENC_BTN, enc.DETENT, 0, LO, HI) ' start encoder
term.tstart(BR_TERM) ' start terminal serial
The object used in the third example has a complete encoder configuration for the low and high range and button states. The output from Parallax Serial Terminal looks like this:
Tools and Operating System
- PNut_v35c.exe for Windows.
Document Author
- Ken Gracey
Source Code Author
- Jon McPhalen