dsPIC30F Quadrature Encoder Interface Module
© 2005 Microchip Technology Inc.
Page 11
© 2005 Microchip Technology Incorporated. All Rights Reserved. dsPIC30F Quadrature Encoder Interface Module 11
Position Counter
O Up/down counter
O Counts pulses generated by the decoder
O Count is accumulated in POSCNT register
O POSCNT can be accessed, both for read
and write
O Its value can be compared to MAXCNT
register
The position counter can be used either for position or speed measurement.
To measure motor position, we must know the relationship between the
displacement and the number of phase pulses we get from the encoder. This
relation can be known in advance, or can be measured during initialization by
accumulating the total count for the maximum allowed displacement. We can
set a constant value in the Maximum Count register, which is typically the
number of pulse edges generated by one encoder revolution. As soon as we
have a match between the Position Count and the Maximum Count, an interrupt
is generated. In the Interrupt Service Routine, the user software can increment
or decrerment a software counter containing the most significant bits of the
position count.
For speed measurement application, the time interval between two index pulses
or count match events gives a measure of the angular velocity.