Incremental quadrature encoders are used in a great number of applications across many disciplines as they provide a low-cost way of measuring motion in systems with moving parts. Some typical examples include measuring the position of a physical control wheel or measuring the rotor angle and velocity in an electrical motor.
The example is explained in more details in the application note AN2434.
- MPLAB X IDE v6.25 or later
- XC8 (v3.00) alternatively AVR/GNU C Compiler 5.4.0 can be used
- ATtiny_DFP 3.3.272 or later
- ATtiny1617 QFN
- STK600
- STK600 Routing card
- STK600 QFN24
- Quadtrature Encoder
Setup the connections as described in the diagram above
- Download the zip file or clone the example to get the source code.
- Open
attiny1617-quadrature-decoding-mplab.X
in MPLAB. - Connect the ATtiny1617 with your programmer of choice, we used a Atmel ICE.
- Make sure the kit is selected as the tool to be programmed under project settings.
- Press the make and program button to program the device.
- Interact with the encoder and see the effect on count
PA7
directionPA4
.
We have shown how you can use a attiny1617 to do quadrature decoding. Refer to the application note AN2434 for more details about the implementation.