[an error occurred while processing this directive] [an error occurred while processing this directive]
Ответ: (+) смотри
(«Телесистемы»: Конференция «Микроконтроллеры и их применение»)
[an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive]

Отправлено Jedi 13 ноября 2001 г. 17:53
В ответ на: Помогите начинающему отправлено Andrew_p 13 ноября 2001 г. 16:46

The compiler uses the sfrb and sfrw keywords to access the AVR microcontroller’s I/O Registers, using the IN and OUT assembly instructions.

Example:

/* Define the SFRs */
sfrb PINA=0x19; /* 8 bit access to the SFR */
sfrw TCNT1=0x2c; /* 16 bit access to the SFR */

void main(void) {
unsigned char a;
a=PINA; /* Read PORTA input pins */
TCNT1=0x1111; /* Write to TCNT1L & TCNT1H registers */
}

The addresses of I/O registers are predefined in the following header files, located in the ..\INC subdirectory:

tiny22.h

90s2313.h

90s2323.h

90s2333.h

90s2343.h

90s4414.h

90s4433.h

90s4434.h

90s8515.h

90s8534.h

90s8535.h

mega603.h

mega103.h

mega161.h

mega163.h

94k10.h

94k20.h

94k40.h

You may #include the corresponding file, for the processor that you use, at the beginning of your program.

CodeVisionAVR C Compiler, (C) 1998-2000 Pavel Haiduc, HP InfoTech S.R.L.

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

Ответы



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

E-mail: info@telesys.ru