| ??? 08/17/03 14:50 Read: times |
#52736 - Big Endian or Little Endian? |
Big Endian or Little Endian that is the question!
I am an experienced control systems and electronics engineer but very new to 8051 assembler programming. I have a (Cygnal) 8051 MCU interfaced to a (Trimble) Global Positioning System module. I need to write numerous integer and floating point arithmetic routines in assembler for the 8051. The GPS engine outputs numeric data in Big Endian format, ie most significant byte foremost, whereas the 8051 architecture (originally Intel) is naturally Little Endian - least significant byte foremost. Should I write Little Endian routines to stick with convention and convert the data to/from the GPS, or should I go for efficiency and write Big Endian arithmetic routines? So far my observations are thus:- (1) ARCHITECTURE... arrangement of register bytes Those registers in the 8051 which can be considered 16-bit (eg the Data Pointer and PCA timer registers) are naturally Little Endian where such byte registers are contiguous. However the PC seems to be pushed onto the stack as if it were Big Endian! (2) ARCHITECTURE... instruction format The instruction MUL AB produces a result with most sig bits in B....is this Little Endian? However the three byte instruction LJMP addr16 has its two data bytes in Big Endian order! (3) Keil(TM) A51 Assembler Appears to assume Big Endian formats: The word data definition assembler directive DW 0ABCDh produces the byte ABh followed by CDh and the equate statement char EQU 'AB' generates the symbol char = 4142h. (4) Keil(TM) C-compiler Definitely Big Endian (5) Myke Predko "Programming and Customizing the 8051 MCU" Doesn't advocate either format but says to pick one and stick to it; has a personal preference for Little Endian for reasons of consistency with the 8051 architecture. (6) W G Marshall "Maths subroutines for the 8051 MCU" Little Endian (7) John C Wren "Utility routines" Big Endian (8) 8051/8052 Tutorial: Jorg Rockstroh and others Big Endian (9) Philips AN701 SP floating point math with XA (MCUs) Big Endian Could I please have some advice or comments from 8051 programmers who are experienced with multiple-byte arithmetic and conversions? Gary Hovey Mt Stromlo Observatory Canberra Australia |
| Topic | Author | Date |
| Big Endian or Little Endian? | 01/01/70 00:00 | |
| RE: Big Endian or Little Endian? | 01/01/70 00:00 | |
| RE: Big Endian or Little Endian? | 01/01/70 00:00 | |
| RE: Big Endian or Little Endian? | 01/01/70 00:00 | |
| RE: Big Endian or Little Endian? | 01/01/70 00:00 | |
| RE: Big Endian or Little Endian? | 01/01/70 00:00 | |
| RE: ambidextrous | 01/01/70 00:00 | |
| RE: ambidextrous | 01/01/70 00:00 | |
| RE: // Andy | 01/01/70 00:00 | |
| RE: // Andy | 01/01/70 00:00 | |
| RE: Andy - idioms | 01/01/70 00:00 | |
| RE: Big Endian or Little Endian? | 01/01/70 00:00 | |
| RE: Big Endian or Little Endian? | 01/01/70 00:00 | |
| RE: Big Endian or Little Endian? | 01/01/70 00:00 | |
| RE: Big Endian or Little Endian? | 01/01/70 00:00 | |
RE: Big Endian or Little Endian? | 01/01/70 00:00 | |
| RE: Big Endian or Little Endian? | 01/01/70 00:00 |



