Great! Thanks! I had forgotten that the X and Y registers are 32-bit when pushed from the outside! Works perfectly.
An interesting feature is that after I finish my pulse looping I wrap back to the beginning which does another blocking pull. So I can decide whether to push another set of pulses, or just let it hang until I deactivate the sm.
Here is the result in micropython syntax for posterity:
An interesting feature is that after I finish my pulse looping I wrap back to the beginning which does another blocking pull. So I can decide whether to push another set of pulses, or just let it hang until I deactivate the sm.
Here is the result in micropython syntax for posterity:
Code:
@rp2.asm_pio(set_init=(rp2.PIO.OUT_LOW, rp2.PIO.OUT_LOW))def encoder_fwd_fast(): pull() mov(x, osr) jmp(x_dec, "step") # Do x-- label("step") # Cycles: 2 set(pins, 1) # A¬B nop() # Cycles: 2 set(pins, 3) # A B nop() # Cycles: 2 set(pins, 2) # ¬A B nop() # Cycles: 2 set(pins, 0) # ¬A¬B jmp(x_dec, "step")
Statistics: Posted by dov — Sat May 04, 2024 8:57 pm