Programming Raspberry Pi Pico PIO
We saw the PIO system back in Chapter 1. We could read encoders in Python on the Pico central cores; however, we can make monitoring the encoders the responsibility of PIO, letting those central cores do other things. The PIO system can read and decode the Gray code emitted by the encoders. This section will show how to program PIO in assembler and load the programs with CircuitPython.
Introduction to PIO programming
As we saw in Chapter 1, Pico has two PIO devices, each with four state machines. We program PIO in assembly language. Instructions command PIO to perform operations such as manipulating IO pins, registers, and first in first out (FIFO) queues. The following diagram is a simplified representation of a state machine:
Figure 6.5 – The Raspberry Pi Pico PIO state machines
The preceding diagram shows Raspberry Pi Pico PIO state machines, highlighting registers and other features. It shows the two PIO devices...