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

Отправлено Вячеслав 28 августа 2001 г. 18:41

Как в Analog Devices ADuC 812 работать с таймером?
По прерыванию от таймера 0 я выдаю меандр. Частота его почему-то меняется только при изменении режима в TMOD. На изменение TH0, TL0 не реагирует. Может это один из глюков?

Вот мой код:
/* dac.C - this routine tests the DACs */

#pragma DEBUG OBJECTEXTEND CODE /* pragma lines can contain state C51 */
#pragma SMALL
#include /* prototype declarations for I/O functions */
#include /* ADuC812 header file */

static bit edinitza = 1;
unsigned j;
void handler(void) interrupt 3 // timer1 handler function
{
if (edinitza)
{
edinitza = 0;
for(j=0; j < 360; j++)
DAC1L = 0xFF;
}
else
{
edinitza = 1;
for(j=0; j < 360; j++)
DAC1L = 0;
}
}

void main (void)
{
DACCON = 0xF6; // 0..Vdd, auto-update mode, 8-bit mode, DAC1 is ON, DAC0 is OFF ie 11110110
TMOD = 0x80;
TH1 = 0xC4;
TL1 = 0x00;
TR1 = 1;
ET1 = 1; // Enable timer1 interrupt
EA = 1; // Enable interrupts in general
while (1){ ;}
}



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

Ответы



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

E-mail: info@telesys.ru