PIO explained PICOMITE


Author Message
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 5975
Posted: 10:39am 15 Dec 2022      

Hi phil99,

You have found a good solution !! Having 2 state machines run identical code, and start the second machine 180 degrees out of phase (the Do While Pin(gp0):Loop waits for GP0 to get low, and then starts the ssecond state machine, that starts with a setting gp1 high). Excellent thinking. The phase error you see lies in 2 things:

- the delay in executing the MMBasic "Do While" and "Start PIO", but more so the PIO instruction that sets the GP1 port output. That is one instruction (with a loop of 4 instructions long) giving 90 degrees phase error.

You could improve that behaviour by increasing the clock for the PIO, and adding delay in all instructions except for the one that set's output. But the phase error will never vanish.


The solution that you where originally trying (I guess) and that did not work is attached below as a ZIP. I do not want to "publish" the solution yet, to give others the chance to work on a solution. Unless they cannot resist, then they must unpack the ZIP.
Without details from you I estimate you did not get any signal on GP1. That symptom will be explained in the next chapter, and will be the introduction for the PIO EXECUTE command...( lifting part of the vail)....





Volhout
exercise_3_2.zip
Edited 2022-12-15 20:56 by Volhout