Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
61
Добавлен:
14.04.2015
Размер:
1.37 Mб
Скачать

Keil Software — Cx51 Compiler User’s Guide

371

 

 

Appendix D. Compiler Limits

The Cx51 compiler embodies some known limitations that are listed below. For the most part, there are no limits with respect to components of the C language; for example, you may specify an unlimited number of symbols or number of case statements in a switch block. If there is enough address space, several thousand symbols could be defined.

A maximum of 19 levels of indirection (access modifiers) to any standard data type are supported. This includes array descriptors, indirection operators, and function descriptors.

Names may be up to 256 characters long. The C language provides for case sensitivity in regard to function and variable names. However, for compatibility reasons, all names in the object file appear in capital letters. It is therefore irrelevant if an external object name within the source program is written in capital or small letters.

The maximum number of case statements in a switch block is not fixed.

D

Limits are imposed only by the available memory size and the maximum size

of individual functions.

 

The maximum number of nested function calls in an invocation parameter list is 10.

The maximum number of nested include files is 9. This value is independent of list files, preprocessor files, or whether or not an object file is to be generated.

The maximum depth of directives for conditional compilation is 20. This is a preprocessor limitation.

Instruction blocks ({…}) may be nested up to 15 levels deep.

Macros may be nested up to 8 levels deep.

A maximum of 32 parameters may be passed in a macro or function call.

The maximum length of a line or a macro definition is 2000 characters. Even after a macro expansion, the result may not exceed 2000 characters.

372

Appendix D. Compiler Limits

 

 

D

Keil Software — Cx51 Compiler User’s Guide

373

 

 

Appendix E. Byte Ordering

Most microprocessors have a memory architecture that is composed of 8-bit address locations known as bytes. Many data items (addresses, numbers, and strings) are too long to be stored using a single byte and must be stored in a series of consecutive bytes.

When using data that are stored in multiple bytes, byte ordering becomes an issue. Unfortunately, there is not just one standard for the order in which bytes in multi-byte data are stored. There are two popular methods of byte ordering currently in widespread use.

The first method is called little endian and is often referred to as Intel order. In little endian, the least significant, or low-order byte is stored first. For example, a 16-bit integer value of 0x1234 (4660 decimal) would be stored using the little endian method in two consecutive bytes as follows:

Address

+0

+1

Contents

0x34

0x12

 

 

 

A 32-bit integer value of 0x57415244 (1463898692 decimal) would be stored

E

using the little endian method as follows:

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Address

+0

+1

+2

+3

 

 

 

 

 

 

 

 

 

Contents

0x44

0x52

0x41

0x57

 

 

A second method of accessing multi-byte data is called big endian and is often referred to as Motorola order. In big endian, the most significant, or high-order byte is stored first, and the least significant, or low-order byte is stored last. For example, a 16-bit integer value of 0x1234 would be stored using the big endian method in two consecutive bytes as follows:

Address

+0

+1

Contents

0x12

0x34

A 32-bit integer value of 0x004A4F4E would be stored using the big endian method as follows:

Address

+0

+1

+2

+3

Contents

0x00

0x4A

0x4F

0x4E

374

Appendix E. Byte Ordering

 

 

The 8051 is an 8-bit machine and has no instructions for directly manipulating data objects that are larger than 8 bits. Multi-byte data are stored according to the following rules.

The 8051 LCALL instruction stores the address of the next instruction on the stack. The address is pushed onto the stack low-order byte first. The address is, therefore, stored in memory in little endian format.

All other 16-bit and 32-bit values are stored, contrary to other Intel processors, in big endian format, with the high-order byte stored first. For example, the LJMP and LCALL instructions expect 16-bit addresses that are in big endian format.

Floating-point numbers are stored according to the IEEE-754 format and are stored in big endian format with the high-order byte stored first.

If your 8051 embedded application performs data communications with other microprocessors, it may be necessary to know the byte ordering method used by the other CPU. This is certainly true when transmitting raw binary data.

E

Соседние файлы в папке HLP