not logged in | [Login]

Refer store register for notes about memory address format used by these instructions.

Example;

#get the value of Timer 2's Control Register 
#into r0 so that it is returned to uPy
@micropython.asm_thumb
def get_random_value():
  movwt(r1, stm.TIM2)
  ldr(r0, [r1, stm.TIM_CR1) 

ldr(regA, [regB, offset]) load a 32bit WORD from address (regB+offset) into regA

ldrb(regA, [regB, offset]) load an 8bit Unsigned BYTE from address (regB+offset) into regA. Zero extend the result to 32 bits.

ldrh(regA, [regB, offset]) load a 16bit Unsigned HALF-WORD from address(regB+offset) into regA. Zero extend the result to 32 bits.

back