Datasheet

Table Of Contents
<target> Is a program label or value (see Section 3.3.3) representing instruction offset within the program (the
first instruction being offset 0). Note that because the PIO JMP instruction uses absolute addresses in
the PIO instruction memory, JMPs need to be adjusted based on the program load offset at runtime.
This is handled for you when loading a program with the Pico SDK, but care should be taken when
encoding JMP instructions for use by OUT EXEC
3.4.3. WAIT
3.4.3.1. Encoding
Bit: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
WAIT
0 0 1 Delay/side-set Pol Source Index
3.4.3.2. Operation
Stall until some condition is met.
Like all stalling instructions (Section 3.2.4), delay cycles begin after the instruction completes. That is, if any delay cycles
are present, they do not begin counting until after the wait condition is met.
Polarity:
1: wait for a 1.
0: wait for a 0.
Source: what to wait on. Values are:
00: GPIO: System GPIO input selected by Index. This is an absolute GPIO index, and is not affected by the state
machine’s input IO mapping.
01: PIN: Input pin selected by Index. This state machine’s input IO mapping is applied first, and then Index selects
which of the mapped bits to wait on.
10: IRQ: PIO IRQ flag selected by Index
11: Reserved
Index: which pin or bit to check.
WAIT x IRQ behaves slightly differently from other WAIT sources:
If Polarity is 1, the selected IRQ flag is cleared by the state machine upon the wait condition being met.
The flag index is decoded in the same way as the IRQ index field: if the MSB is set, the state machine ID (0…3) is
added to the IRQ index, by way of modulo-4 addition on the two LSBs. For example, state machine 2 with a flag value
of '0x11' will wait on flag 3, and a flag value of '0x13' will wait on flag 1. This allows multiple state machines running
the same program to synchronise with each other.
RP2040 Datasheet
3.4. Instruction Set 324