As already stated, you can certainly do two side-set bits - but note that they have to be on adjacent pins. First rule of PIO coding: always write your PIO code before you lay out a PCB, because you often care about the ordering of signals on GPIOs to make the code fit.
The other compromise with side-set is that side set bits, wait bits, and the flag to make side-set conditional all compete for the 5 available bits in the instruction. That's not a problem here, as you are only using one wait bit, two side-set, and one conditional - total 4 and 5 available. However, you could easily get one back as you don't need the side-set to be conditional (just add the 'side' notation on the JMP instruction as well).
For the precise code you posted, there's another alternative instead of going to two side-set bits: re-order the code to do the jump in the cucle
This does the same as your version at the cost of one extra instruction, with the one deviation that the first time round the loop it has two cycles of low rather than one - could fix that at the cost of yet another instruction if necessary.
Probably the two side-set is better if that works for you, but there are often alternatives for this kind of problem.
The other compromise with side-set is that side set bits, wait bits, and the flag to make side-set conditional all compete for the 5 available bits in the instruction. That's not a problem here, as you are only using one wait bit, two side-set, and one conditional - total 4 and 5 available. However, you could easily get one back as you don't need the side-set to be conditional (just add the 'side' notation on the JMP instruction as well).
For the precise code you posted, there's another alternative instead of going to two side-set bits: re-order the code to do the jump in the cucle
Code:
loop_10:SET pins 0 side 0[1]; spend 2 cycle on lowSET pins 1 side 1 ; spend 1 cycle on highJMP x-- pre_loop side 1;spend another cycle highSET pins 0 side 0;Duplicate the instruction that logically belongs before the JMP but moved for timing
Probably the two side-set is better if that works for you, but there are often alternatives for this kind of problem.
Statistics: Posted by arg001 — Wed Apr 17, 2024 4:24 pm