Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
12/31/02 15:56
Read: times


 
#35296 - RE: Keil C - How to place Structure on Port
p = (struct test*) 0x80;


You cannot access SFRs indirectly on the 8051. Therefore, the above statement yields a pointer into IDATA memory, not to SFR memory.

In C51, there is no special feature that allows you to locate a struct (or any other data type) at the address of an SFR.

On another note, the bit location of bitfields in structures is not guaranteed (LSB first or MSB first) and is even allowed to change from one release of a compiler to another. The order is guaranteed, but you aren't guaranteed whether the first bit in the struct is bit 0 or bit 7. So, using a struct as an overlay for external hardware is not a good idea.

Jon

List of 18 messages in thread
TopicAuthorDate
Keil C - How to place Structure on Port            01/01/70 00:00      
RE: Keil C - How to place Structure on Port            01/01/70 00:00      
RE: Keil C - How to place Structure on Port            01/01/70 00:00      
RE: Keil C - How to place ... Erik            01/01/70 00:00      
RE: Keil C - How to place Structure on Port            01/01/70 00:00      
RE: Keil C - How to place Structure on Port            01/01/70 00:00      
RE: Keil C - How to place Structure on Port            01/01/70 00:00      
RE: Keil C - How to place Structure on Port            01/01/70 00:00      
RE: Keil C - How to place Structure on Port            01/01/70 00:00      
RE: Keil C - Andy            01/01/70 00:00      
RE: Keil C - Andy            01/01/70 00:00      
RE: Keil C - Peter            01/01/70 00:00      
RE: Keil C - Peter            01/01/70 00:00      
RE: Keil C - Michael            01/01/70 00:00      
RE: Keil C - Peter            01/01/70 00:00      
RE: Keil C - How to place Structure on Port            01/01/70 00:00      
RE: Keil C - How to place Structure on Port            01/01/70 00:00      
RE: ANSI Bitfields            01/01/70 00:00      

Back to Subject List