Posted: 06:28am 15 Dec 2022 |
|
|
|
For #2 this is all I can manage. It works after a fashion but the phase shift is a little over 180 deg.
SetPin gp0,pio1 SetPin gp1,pio1
p0=Pio(pinctrl 0,1,,,,gp0,) p1=Pio(pinctrl 0,1,,,,gp1,)
f=2000 * 5.4 'Hz for 2700Hz out.
'pio program 'line code comment ' 0 E081 GP0 output ' 1 E101 pin high, dly=1 ' 2 E000 pin low ' 3 0001 jmp 1
'program pio1 PIO program line 1,0,&he081 PIO program line 1,1,&he100 PIO program line 1,2,&he001 PIO program line 1,3,&h0001
'write the configuration PIO init machine 1,0,f,p0,,,0 PIO init machine 1,1,f,p1,,,0
'start the pio1 code PIO start 1,0 Do While Pin(gp0) : Loop PIO start 1,1
'Check the frequency in MMBasic SetPin GP6,FIN Do Pause 1000 Print Pin(gp6);" Hz at GP6" Loop
End All attempts to invert the output within the PIO program failed. . |