AVR单片机M8控制256级七彩流水灯程序
#include
#include
#include
extern const
uint16_t data0,data1;
uint8_t bitcnt;
uint8_t
uint16_t ms,Sec;
uint32_t
void
{
uchar i;
}
void
{
uchar i,j;
uint
const char * n;
const uchar Mask[]={1,2,4,8,16,128,32,64,128,128,64,128,32,64,128,128,64,128,128};
const uchar OETAB[]={PIX,PIX/16,PIX/8,PIX/4,PIX/2,PIX,PIX,PIX,PIX,PIX,PIX,PIX,PIX,PIX,PIX,PIX,PIX,PIX,PIX,PIX,PIX};
for(m=0;m<4596;m+=3)
}
void Delay(void)
{
uint i,j;
for(i=0;i<400;i++)
}
void timer0_init(void)
{
}
void
{
MCUCR=(1
GICR=0x40;
}
SIGNAL(SIG_OVERFLOW0)
{
TCNT0 = 0xfe;//0xe1;;
ms++;
MsCnt++;
if(MsCnt>100000)
}
SIGNAL (SIG_INTERRUPT0)
{
static uint oldFall;
uint temp,newFall;
newFall=ms;
if(newFall>oldFall)
else
oldFall=newFall;
if(temp>80&& temp<130) // "0"信号1.125ms
else if(temp>170 && temp<220) //“1”信号2.25ms
bitcnt++;
if(bitcnt<16) //开始接收前16位
else if(bitcnt==16)
}
void
{
PORTB=0xff;
PORTC=0Xff;
PORTD=0Xff;
DDRD=(1
DDRC=(1
}
int main(void)
{
IO_ini();
int0_ini();
timer0_init();
sei();
CLR_LED2;
CLR_OE;
while(1)
}
AVR单片机M8控制七彩流水 相关文章:
- Windows CE 进程、线程和内存管理(11-09)
- RedHatLinux新手入门教程(5)(11-12)
- uClinux介绍(11-09)
- openwebmailV1.60安装教学(11-12)
- Linux嵌入式系统开发平台选型探讨(11-09)
- Windows CE 进程、线程和内存管理(二)(11-09)