/*
横向移动“今天 YOU ARE OK?"
*/
#include<mega16.h>
#include<delay.h>
flash char char_7[]={0x08,0x04,0x12,0x95,0x55,0x32,0x04,0x08,0x84,0x45,
0x25,0x1f,0x25,0x45,0x84,0x00,0x00,0x01,0x02,0x04,
0xf8,0x04,0x02,0x01,0x00,0x00,0x3c,0x42,0x81,0x81,
0x42,0x3c,0x00,0x3f,0x40,0x80,0x80,0x40,0x3f,0x00,
0x00,0xfc,0x12,0x11,0x12,0xfc,0x00,0x00,0xfc,0x12,
0x11,0x31,0x52,0x8c,0x00,0x00,0xff,0x89,0x89,0x89,
0x89,0x89,0x00,0x00,0x3c,0x42,0x81,0x81,0x42,0x3c,
0x00,0x00,0xff,0x0c,0x1c,0x22,0x41,0x80,0x00,0x00,
0xdf,0xdf,0x00};
void display(char row)
{
char i;
for(i=0;i<=82;i++)
{
if(row<=82)
PORTB=~char_7[row];
else
PORTB=0xff;
PORTA=(1<<(82-i));
delay_ms(2);
PORTB=0xff;
if(++row>=84)row=0;
}
}
void main(void)
{
char time_counter=0,j=0;
PORTA=0x00;
DDRA=0xff;
PORTB=0xFF;
DDRB=0xff;
while(1)
{
display(j);
//delay_ms(1);
if(++time_counter>=1)
{
time_counter=0;
if(++j>=84)j=0;
}
};
} |