Technical Support

C51: LITTLE-ENDIAN CAN REGISTERS, BIG-ENDIAN COMPILER


Information in this article applies to:

  • C51 Version 5.50

QUESTION

The C51 compiler stores unsigned ints in big-endian format, however the CAN registers on the C505 are stored in little-endian format. Is there a way to make the compiler store unsigned ints in little-endian format so I can write to the 16-bit CAN registers?

ANSWER

The C166 family stores 16-bit values in little-endian format. When the CAN peripheral was copied over to the 8051 devices, the registers were left in the same format, however the architecture of 8051s is big-endian.

There is no way to make the compiler store unsigned ints in little-endian format, so the CAN registers have to be loaded in single bytes, high and low.

MORE INFORMATION

Last Reviewed: Friday, July 15, 2005


Did this article provide the answer you needed?
 
Yes
No
Not Sure