| поискавой системы для электроныых деталей |
|
STC89C53RC датащи(PDF) 159 Page - STCmicro Technology Co,.Ltd |
|
|
|||||||||||||||||||||||||||||
STC89C53RC датащи(HTML) 159 Page - STCmicro Technology Co,.Ltd |
|
159 / 165 page ![]() MEMORY TYPES AND MODELS The 8051 has various types of memory space, including internal and external code and data memory. When declaring variables, it is hence reasonable to wonder in which type of memory those variables would reside. For this purpose, several memory type specifiers are available for use, as shown in following table. Memory types used in 8051 C language Memory Type Description (Size) code Code memory (64 Kbytes) data Directly addressable internal data memory (128 bytes) idata Indirectly addressable internal data memory (256 bytes) bdata Bit-addressable internal data memory (16 bytes) xdata External data memory (64 Kbytes) pdata Paged external data memory (256 bytes) The first memory type specifier given in above table is code. This is used to specify that a variable is to reside in code memory, which has a range of up to 64 Kbytes. For example: char code errormsg[ ] = "An error occurred" ; declares a char array called errormsg that resides in code memory. If you want to put a variable into data memory, then use either of the remaining five data memory specifiers in above table. Though the choice rests on you, bear in mind that each type of data memory affect the speed of access and the size of available data memory. For instance, consider the following declarations: signed int data num1; bit bdata numbit; unsigned int xdata num2; The first statement creates a signed int variable num1 that resides in inernal data memory (00H to 7FH). The next line declares a bit variable numbit that is to reside in the bit-addressable memory locations (byte addresses 20H to 2FH), also known as bdata. Finally, the last line declares an unsigned int variable called num2 that resides in external data memory, xdata. Having a variable located in the directly addressable internal data memory speeds up access considerably; hence, for programs that are time-critical, the variables should be of type data. For other variants such as 8052 with internal data memory up to 256 bytes, the idata specifier may be used. Note however that this is slower than data since it must use indirect addressing. Meanwhile, if you would rather have your variables reside in external memory, you have the choice of declaring them as pdata or xdata. A variable declared to be in pdata resides in the first 256 bytes (a page) of external memory, while if more storage is required, xdata should be used, which allows for accessing up to 64 Kbytes of external data memory. What if when declaring a variable you forget to explicitly specify what type of memory it should reside in, or you wish that all variables are assigned a default memory type without having to specify them one by one? In this case, we make use of memory models. The following table lists the various memory models that you can use. Memory models used in 8051 C language Memory Model Description Small Variables default to the internal data memory (data) Compact Variables default to the first 256 bytes of external data memory (pdata) Large Variables default to external data memory (xdata) 159 |
|
ссылки URL |
| Вашему бизинису помогли Аллдатащит? [ DONATE ] |
Что такое Аллдатащит | реклама | контакт | Конфиденциальность | Ссылка на техническое описание | обмен ссыками | поиск по производителю All Rights Reserved©Alldatasheet.com |
| Russian : Alldatasheetru.com | Korean : Alldatasheet.co.kr | Spanish : Alldatasheet.es | French : Alldatasheet.fr | Italian : Alldatasheetit.com Portuguese : Alldatasheetpt.com | Polish : Alldatasheet.pl | Vietnamese : Alldatasheet.vn Indian : Alldatasheet.in | Mexican : Alldatasheet.com.mx | British : Alldatasheet.co.uk | New Zealand : Alldatasheet.co.nz |
|
Family Site : ic2ic.com |
icmetro.com |