USART ASYNCHRONOUS TRANSMITTER (ATMEGA32)
#include <avr/io.h>
#include <util/delay.h>
int main(void)
{
int i;
char S[]="hello";
DDRD=0x02;
UCSRA=0X00;
UCSRB=0X18;
UCSRC=0X06;
UBRRL=0X19;
UBRRH=0X00;
for (i=0;S[i]!='\0';i++)
{
UDR=S[i];
while((UCSRA&0X40)==0);
UCSRA=0X00;
_delay_ms(1000);
}
while(1);
}
No comments:
Post a Comment