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

94 Chapter 3. Language Extensions

 

Memory Models

 

The memory model determines the default memory type to use for function

 

arguments, automatic variables, and declarations with no explicit memory type

 

specifier. You specify the memory model on the Cx51 compiler command line

 

using the SMALL, COMPACT and LARGE control directives. Refer to

 

“Control Directives” on page 20 for more information about these directives.

 

 

 

NOTE

 

Except in very special select applications, the SMALL memory model generates

3

the fastest, most efficient code.

By explicitly declaring a variable with a memory type specifier, you may

override the default memory type imposed by the memory model. Refer to

“Memory Types” on page 95 for more information.

Small Model

In this model, all variables, by default, reside in the internal data memory of the 8051 system. (This is the same as if they were declared explicitly using the data memory type specifier.) In this memory model, variable access is very efficient. However, all objects, as well as the stack must fit into the internal RAM. Stack size is critical because the real stack size depends upon the nesting depth of the various functions. Typically, if the linker/locator is configured to overlay variables in the internal data memory, the small model is the best model to use.

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