cancel
Showing results for 
Search instead for 
Did you mean: 

I would like to drive STM32L011D3 GPIO in output to "1" or "0" with a minimum of instruction. I think we need:1 LDR + 1 ORR or AND + 1 STR = 3 instructions and 5 cycles Is there a more cycle-efficient way to do this?

LaurentLef
Associate II

Is it possible to set an output to "1" or "0" with an instruction of one cycle?

2 REPLIES 2

Do a singular write to the BSRR register rather than RMW the ODR one.​

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

Use hardware (e.g. timers) wherever possible.

Relationship between instructions and machine cycles is far from being straighforward.

JW