17.4.12 Position Counter Initialization Modes
By using the PIMOD[2:0] bits in the QEIx Control register (QEIxCON[12:10]), the user application can specify how the Position Counter is initialized during the module operation.
- Mode 0 – The Position Counter is unaffected by the index input.
- Mode 1 – The Position Counter is cleared whenever an index input event is detected.
- Mode 2 – The Position Counter is initialized with the contents of the QEIxIC register on the next detected index input event. When the index event occurs, the PIMOD[2:0] bits are cleared and then the counter operates in Mode 0.
- Mode 3 – The Position Counter is initialized with the contents of the QEIxIC register on the next detected index input event following the assertion of the home input. When an index event occurs following the home event, the PIMOD[2:0] bits are cleared and then the counter operates in Mode 0.
- Mode 4 – The Position Counter is initialized with the contents of the QEIxIC register on the second detected index input event following the assertion of the home input. When the second index event occurs following the home event, the PIMOD[2:0] bits are cleared and then the counter operates in Mode 0.
- Mode 5 – The Position Counter is cleared when the Position Counter value equals the QEIxGEC register value.
- Mode 6 – The Position Counter is loaded with the contents of the QEIxLEC register when the Position Counter value equals the QEIxGEC register value and a count up pulse is detected. The counter is loaded with the contents of the QEIxGEC register when the Position Counter value equals the QEIxLEC register value and a count down pulse is detected.
- Mode 7 – Modulo Count mode with index pulse clearing. The Position Counter is loaded with the contents of the QEIxLEC register when the Position Counter equals the QEIxGEC register’s contents and a count up pulse is detected. The Position Counter is loaded with the contents of the QEIxGEC register when the Position Counter equals the QEIxLEC register contents and a count down pulse is detected. If an index pulse is detected, the Position Counter is cleared whenever an index input event is detected.