Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 7653

SDK • Re: jmp vs .wrap

$
0
0
@gmx, yeah!

I took @giampiero minimal example code and tweaked it to use the blinking default LED (GPIO 25 on a Pico) as the jmp pin.

I used LEDs and, of course, to the human eye we see a mirroring of one input to two outputs.

So then I was delving into exactly what happens at each clock cycle of the state machine as jmp has goine from high to low, and if in fact this PIO code mirrors the input. I see that with .wrap it does. I believe the code for the PIO to change one cycle later after the inpuy pin has changed to low is more like this. In other words this is the same as using only .wrap:

Code:

.program hello.side_set 2        ; mandatory 2-bit side-set.wrap_targetlow:    jmp pin high side 0b00   ; cond jump if input HIGH, drives outputs 00    jmp low side 0b00        ; unconditional jump to low, drives outputs 00high:    jmp pin high side 0b11   ; cond jump if input HIGH, drives outputs 11    jmp low side 0b00        ; unconditional jump to low, drives outputs 00.wrap
Otherwise with jmp low side 0b11 your state machine is waiting 2 cycles before the unconditional jmp. In a real world signaling app, would it matter? Likely not, but youget my point.

But yes, I can see how jmp low side 0b00 with nothing after it ends up at the same place as .wrap

Or just use jmp low with .side_set 2 opt

Please tell me when we might use opt vs. not?

Statistics: Posted by breaker — Thu Jan 15, 2026 7:25 pm



Viewing all articles
Browse latest Browse all 7653

Trending Articles