|
AVR单片机定时器中断的值不能保存到主程序中--请教
[复制链接]
#include
#include
#define uchar8 unsigned char
const uchar8 Relay[] =
{0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80};
uchar8 count = 0;
void time0_init(void)
{
TCCR0 = 0x00;
TCNT0 = 0xD9;
TCCR0 = 0x05;//1024分频,定时器开始
}
void port_init(void)
{
DDRC = 0xff;
PORTC = 0x00;
}
SIGNAL(SIG_OVERFLOW0)//定时器0溢出中断
{
TCNT0 = 0xD9;
count++;/////////////////////////////在中断时已经执行++操作,}
void devices_init(void)
{
cli();
port_init();
time0_init();
TIMSK = 0x01;//使能溢出中断0
sei();
}
int main(void)
{
uchar8 i = 0;
devices_init();
while(1)
{
if(count = 99)//////////////////////////在这里count的值怎么一直是0呢
{
PORTC = Relay[i%8];
i++;
count = 0;
}
}
return 0;
}
初接触有的时 AVR ATmega128,4M,怎么会这样呢,请指教
|
|