PIO explained PICOMITE

Author Message


Joined: 11/02/2018
Location: Australia
Posts: 1813
Posted: 06:37am 14 Dec 2022      

50Hz, 50%. all else the same as 500Hz.

'pio program
'line   code  comment
' 0     E081  GP0 output
' 1     F301  pin high, dly=19
' 2     F200  pin low, dly=18
' 3     0001  jmp 1

'program pio1
PIO program line 1,0,&hE081
PIO program line 1,1,&hF301
PIO program line 1,2,&hF200
PIO program line 1,3,&h0001

'Read freq.
n=0 'Find the start of a cycle then count cycles in 1 Sec.
Do While Pin(GP0) : Loop
Do While Not Pin(GP0) : Loop
Timer =0
Do While Timer<1000
 Do While Pin(GP0) : Loop
 Do While Not Pin(GP0) : Loop
 Inc n
Print n;" Hz at GP0"