Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Bit Specific Assembly Definitions

  1. Nov 12, 2013 #1
    I have an example given in the textbook that defines port A bits 5 as PA5 equ 0x40004080. Port A is 0x40004000, and the first 7 bits are for data. I do not see how bit 5 is 0x80. I figured that would be bit 7 and bits 5 would be 0x20. We use ARM assembly language for LM4F120H5QR microcontroller.
  2. jcsd
  3. Nov 12, 2013 #2
    I'm not sure your question but follows.
    How could a bit be set to 0x20 (a byte)

    Perhaps you could clarify a bit :)
  4. Nov 12, 2013 #3
    It is a 32-bit microcontroller. This is simply supposed to be a bit specific assembly definition. The example that is given is for PORT A and the bits defined are 5. The answer is PA5 equ 0x40004080, and I don't really see why.
  5. Nov 12, 2013 #4
    Okay sorry I'm a bit slow sometimes I see what you are asking.
    I've never actually programmed the LM4F120H5QR, but in other cases there were 3 registers associated with a port. A Receive enable, a Write enable and a data register.

    My guess is whats happening then is for PINA0 0x40004000 would be the recieve 0x40004001 would be the write 0x40004002 would be the data.
    Extending this out to port 5, you would get 0x40004080 for the data.
    Again this is all supposition :) hopefully it'll point you in the right direction
  6. Nov 12, 2013 #5
    So when they refer to bit 5 of port A, they are referring to the data bit of pin A5? I have never encountered this before and I was scanning through the data sheet to see if that would help.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook