[an error occurred while processing this directive] [an error occurred while processing this directive]
SFR и IDATA - физически разные области памяти
(«Телесистемы»: Конференция «Микроконтроллеры и их применение»)
[an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive]

Отправлено Cat_Thomas 25 октября 2001 г. 19:13
В ответ на: И еще отправлено Elektronik 25 октября 2001 г. 06:48

Цитата фирменного описания AT89C52 из *.pdf:

"Data Memory

The AT89C52 implements 256 bytes of on-chip RAM. The
upper 128 bytes occupy a parallel address space to the
Special Function Registers. That means the upper 128
bytes have the same addresses as the SFR space but are
physically separate from SFR space.
When an instruction accesses an internal location above
address 7FH, the address mode used in the instruction
specifies whether the CPU accesses the upper 128 bytes
of RAM or the SFR space. Instructions that use direct
addressing access SFR space.
For example, the following direct addressing instruction
accesses the SFR at location 0A0H (which is P2).
MOV 0A0H, #data
Instructions that use indirect addressing access the upper
128 bytes of RAM. For example, the following indirect
addressing instruction, where R0 contains 0A0H, accesses
the data byte at address 0A0H, rather than P2 (whose
address is 0A0H).
MOV @R0, #data
Note that stack operations are examples of indirect
addressing, so the upper 128 bytes of data RAM are avail-able
as stack space."
(Конец цитаты)

Т.е. SFR и IDATA имеют с точки зрения процессора одинаковые адреса 0x80...0xff, но отличаюся типом адресации - прямая или косвенная (DATA вообще не причем - там прямая с 0x00...0x7f). Это физически разные области памяти. В описании IAR'а есть красивая диаграмма, хорошо это описывающая - привел бы, да не знаю, как присобачить ее к письму. Поэтому в моей власти использовать 128 байт DATA (описывая спецификатором data) плюс 128 байт IDATA (специфицируя idata), лишь бы при этом хватило места под стек(в конце IDATA) и локальные переменные функций.
И Ваше удивление мне не понятно - затереть SFR, размещая idata переменные, нельзя.

Cat_Thomas

Составить ответ  |||  Конференция  |||  Архив

Ответы



Перейти к списку ответов  |||  Конференция  |||  Архив  |||  Главная страница  |||  Содержание  |||  Без кадра

E-mail: info@telesys.ru