#include<iom16v.h>
#include<macros.h>
#define uchar unsigned char
#define uint unsigned int
#pragma date:code const table[]="I LIKE YOU";
#pragma date:code const table1[]=" WU WANG WO";
uchar num;
void delay(uint z)
{
uint x,y;
for(x=z;x>0;x--)
for(y=110;y>0;y--);
}
void write_com(uchar com)
{
DDRA|=BIT(4);
PORTA&=~BIT(4);
DDRB=0XFF;
PORTB=com;
DDRA|=BIT(6);
PORTA|=BIT(6);
delay(20);
DDRA|=BIT(6);
PORTA&=~BIT(6);
}
void write_DATE(uchar DATE)
{
DDRA|=BIT(4);
PORTA|=BIT(4);
DDRB=0XFF;
PORTB=DATE;
DDRA|=BIT(6);
PORTA|=BIT(6);
delay(20);
DDRA|=BIT(6);
PORTA&=~BIT(6);
}
void init()
{
DDRA|=BIT(5);
PORTA&=~BIT(5);
DDRA|=BIT(6);
PORTA&=~BIT(6);
write_com(0x38);
write_com(0x0c);
write_com(0x06);
write_com(0x01);
write_com(0x80);
}
void main()
{
init();
for(num=0;num<11;num++)
{
write_DATE();
}
while(1);
}
|