#include <avr/io.h>
#include <util/delay.h>
void cmd(int);
void data(char);
int main(void)
{ DDRB=0XFF;
DDRA=0XFF;
char a;
DDRC=0xfe;
UCSRA=0x00;
UCSRB=0x18;
UCSRC=0x06;
UBRRH=0x00;
UBRRL=0x19;
cmd(0x38);
cmd(0x01);
cmd(0x0e);
cmd(0x06);
cmd(0x80);
while(1)
{
while((UCSRA&0x80)==0);
data(UDR);
_delay_ms(1000);
UCSRA=0x00;
}
}
void cmd(int a)
{
PORTB=a;
PORTA=0x00;
PORTA=0x04;
_delay_ms(200);
PORTA=0x00;
}
void data(char s)
{
PORTB=s;
PORTA=0x01;
PORTA=0x05;
_delay_ms(200);
PORTA=0x01;
}
No comments:
Post a Comment