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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
06/04/01 08:20
Read: times


 
#12167 - RE: Keil C : read two byte?

#define LowB(x) (*((UINT8*)&(##x)+1))
if you are doing:
LowB(wordvar)=P0;
this macro is expanded to:
(*((unsigned char*)&(wordvar)+1))=P0;

One thing I forgot:
you should replace my UINT8 with unsigned char. This macro is tested with Keil C51 V5 and V6 only. I know that this macro does not work with V3 compilers.

It is a cast to arrray of bytes and then gets offset 0 for Highbyte or offset 1 for the lowbyte so
as Andy told this is NOT portable.

Thomas


List of 18 messages in thread
TopicAuthorDate
Keil C : read two byte?            01/01/70 00:00      
RE: Keil C : read two byte?            01/01/70 00:00      
RE: Keil C : read two byte?            01/01/70 00:00      
RE: Keil C : read two byte?            01/01/70 00:00      
RE: Keil C : read two byte?            01/01/70 00:00      
RE: Keil C : read two byte?            01/01/70 00:00      
RE: Keil C : read two byte?            01/01/70 00:00      
RE: Keil C : read two byte?            01/01/70 00:00      
RE: Keil C : read two byte?            01/01/70 00:00      
RE: Keil C : read two byte?            01/01/70 00:00      
RE: Keil C : read two byte?            01/01/70 00:00      
RE: Keil C : read two byte?            01/01/70 00:00      
RE: Keil C : read two byte?            01/01/70 00:00      
RE: Keil C : read two byte?            01/01/70 00:00      
RE: Keil C : read two byte?            01/01/70 00:00      
RE: Keil C : read two byte?            01/01/70 00:00      
RE: Keil C : read two byte?            01/01/70 00:00      
RE: Keil C : read two byte?            01/01/70 00:00      

Back to Subject List