为什么会出现这种情况啊?该怎样解决啊?
/*
Name:
Copyright:
Author:
Date: 30/09/15 23:43
Descrip
tion: 通过查询方式实现流水灯的程序
*/
#include"mega16.h"
#define uint unsigned int
#define uchar unsigned char
flash unsigned char tab[8] = {0xfe,0xfd,0xfb,0xf7,0xef,0xcf,0xbf,0x7f};
//uint cnt = 0; //invalid expression
unsigned char cnt = 0;
void led(void);
/***************delay*******************************/
void delay(uint k)
{
uint m,n;
for(m = 0;m<k;m++)
{
for(n = 0;n<1140;n++)
{
;
}
}
}
void main(void)
{
DDRC = 0XFF; //initial output model
PORTC = 0xff;
TCCR0 = 0x05;//0x05 0000 0101 WGM01 = 0 WGM00 = 0,选择普通模式;
//CS00 = 1.COMO1 = 0,CS02 = 1.选择1024分频 ???
TCNT0 = 0X00;//?
OCR0 = 0X00;//?
TIMSK = 0X00;//?
#asm("sei")//总的中断打开 与SREG |= 0X80 即将I位置1;用#asm("cli")禁止全局中断
while(1)
{
//while(!(TIFR&0X01)) ;//?????有点儿疑问!!!!!!
if(TIFR&0X01 ==0)
{
TIFR |=0X01;
cnt++;
if(cnt ==10)
{
cnt =0;
led();
}
TCNT0 = 0X00;
}
}
}
void led(void)
{
uchar i;
for(i = 0;i<8;i++)
{
PORTC = tab
;
delay(1000);
}
}
问的方式有问题吗?
一周热门 更多>