PIO explained PICOMITE

Author Message


Joined: 11/02/2018
Location: Australia
Posts: 1368
Posted: 12:27am 12 Dec 2022      

You were testing us to make sure we were paying attention!

'disconnect ARM from GP2
SetPin GP2,pio1

'configure pio1
p=Pio(pinctrl 0,1,,,,GP2,)
f=2000 'Hz

'pio program
'line   code  comment
' 0     E081  GP2 output
' 1     E001  pin high
' 2     E000  pin low
' 3     0001  jmp 1

'program pio1
'PIO PROGRAM LINE pio, line,instruction
PIO program line 1,0,&hE081
PIO program line 1,1,&hE001
PIO program line 1,2,&hE000
PIO program line 1,3,&h0001

'write the configuration: PIO, state machine, frequency,pincontrol,,,start address
PIO init machine 1,0,f,p,,,0

'start the pio1 code
PIO start 1,0

SetPin GP6,fin
Pause 1000
Print Pin(gp6);" Hz from PIO1"
Pause 5000
PIO stop 1,0

> option cpuspeed 126000
Produces the tone.

PS  The subject of Chapter Ten got my attention.
Have been playing with 74HC595s, driving with just 1 Pico pin
Edited 2022-12-12 14:51 by phil99