Datasheet

Table Of Contents
TIP
The python language output is provided as a utility. MicroPython supports programming with the PIO natively, so you
may only want to use pioasm when sharing PIO code between the Pico SDK and MicroPython. No effort is currently
made to preserve label names, synmbols or comments, as it is assumed you are either using the PIO file as a source
or python; not both. The python language output can of course be used to bootstrap your MicroPython PIO
development based on an existing PIO file.
Pico Examples: https://github.com/raspberrypi/pico-examples/tree/pre_release/pio/ws2812/generated/ws2812.py Lines 1 - 45
Ê1 # -------------------------------------------------- #
Ê2 # This file is autogenerated by pioasm; do not edit! #
Ê3 # -------------------------------------------------- #
Ê4
Ê5 import rp2
Ê6 from machine import Pin
Ê7
Ê8 # ------ #
Ê9 # ws2812 #
10 # ------ #
11
12 ws2812_T1 = 2
13 ws2812_T2 = 5
14 ws2812_T3 = 3
15
16
17 @rp2.asm_pio(sideset_init=pico.PIO.OUT_HIGH, out_init=pico.PIO.OUT_HIGH, out_shiftdir=1)
18 def ws2812():
19 wrap_target()
20 label("0")
21 out(x, 1).side(0)[2] # 0
22 jmp(not_x, "3").side(1)[1] # 1
23 jmp("0").side(1)[4] # 2
24 label("3")
25 nop().side(0)[4] # 3
26 wrap()
27
28
29 # --------------- #
30 # ws2812_parallel #
31 # --------------- #
32
33 ws2812_parallel_T1 = 2
34 ws2812_parallel_T2 = 5
35 ws2812_parallel_T3 = 3
36
37
38 @rp2.asm_pio()
39 def ws2812_parallel():
40 wrap_target()
41 out(x, 32) # 0
42 mov(pins, not null)[1] # 1
43 mov(pins, x)[4] # 2
44 mov(pins, null)[1] # 3
45 wrap()
RP2040 Datasheet
3.3. PIO Assembler (pioasm) 321