Bit Specific Assembly Definitions

Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
4 replies · 2K views
sandy.bridge
Messages
797
Reaction score
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.
 
Engineering news on Phys.org
I'm not sure your question but follows.
How could a bit be set to 0x20 (a byte)

Perhaps you could clarify a bit :)
 
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.
 
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 what's happening then is for PINA0 0x40004000 would be the receive 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
 
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.