This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Reading GPIO_IDR assembly

Hello, I am using a discovery board with an STM32l152. The user push button is ported to PA0. I need to read from the IDR bit on the GPIOA when the button is pushed. I read that it can only be accessed via word only. I have already set up the moder, otyper, etc correctly and checked it against the debugger. Below is the offset address of GPIOA_IDR.

   LDR r0, =0x40000000 ;PERIPH_BASE
   ADD r0, #0x20000      ;AHBPERIPH_BASE
   ADD r0, #0x0400               ;GPIOA_BASE
   ADD r0, #0x10


   if((GPIOA-IDR & 0x1) == 1) turn on LED

I would like to do the the C statement above in assembly. Thank you very much