*
* GccApplication1.c
*
* Created: 2014-9-22 20:21:51
* Author: Administrator
*/
#include <avr/io.h>
#define uchar unsigned char
#define uint unsigned int
uchar tab1[8]={0x7F,0x3F,0x1F,0x0F,0x07,0x03,0x01,0x00};
uchar tab2[8]={0xFE,0xFC,0xF8,0xF0,0xE0,0xC0,0x80,0x00};
uchar tab3[8]={0x80,0xC0,0xE0,0xF0,0xF8,0xFC,0xFE,0xFF};
uchar tab4[9]={0xFE,0xFD,0xFB,0xF7,0xEF,0xDF,0xBF,0x7F,0xFF};
uchar tab5[8]={0x01,0x03,0x07,0x0F,0x1F,0x3F,0x7F,0xFF};
uchar tab6[8]={0x80,0xC0,0xE0,0xF0,0xF8,0xFC,0xFE,0xFF};
void delay_ms(uint dd)
{
uint i,j;
for(i=dd;i>0;i--)
{
for(j=0;j<100;j++)
;
}
}
int main(void)
{
uint i;
DDRC=0xFF; //PC端口为输出方式
PORTC=0xFF; //PC端口输出全部为“1”
DDRD=0xFF; //PD端口为输出方式
PORTD=0xFF; //PD端口输出全部为“1”
while(1)
{
for(i=0;i<8;i++)
{
PORTC=tab1[i];
PORTD=tab2[i];
delay_ms(1000);
}
for(i=0;i<8;i++)
{
PORTD=tab3[i];
delay_ms(1000);
}
for(i=0;i<8;i++)
{
PORTC=tab3[i];
delay_ms(1000);
}
for(i=0;i<9;i++)
{
PORTC=tab4[i];
delay_ms(1000);
}
for(i=0;i<8;i++)
{
PORTD=tab4[i];
delay_ms(1000);
}
PORTC=0x00;
PORTD=0x00;
delay_ms(3000);
for(i=0;i<8;i++)
{
PORTC=tab5[i];
PORTD=tab6[i];
delay_ms(1000);
}
PORTC=0xFF;
PORTD=0xFF;
delay_ms(2000);
}
}