00001
00006 #include <avr/io.h>
00007 #include <inttypes.h>
00008
00009 #include "portpc.h"
00010
00011
00012
00013
00014 void usart0_init(void)
00015 {
00016 UBRR0L = UBRR0V;
00017 UBRR0H = (UBRR0V>>8);
00018 UCSR0C = (1<<UCSZ01) | (1<<UCSZ00);
00019 UCSR0B = (1<<RXEN0) | (1<<TXEN0);
00020 }
00021
00022
00023
00024
00025 void send_usart0(void)
00026 {
00027 while (!(UCSR0A & (1<<UDRE0)));
00028 UDR0 = 'C';
00029 while (!(UCSR0A & (1<<UDRE0)));
00030 UDR0 = 'R';
00031 while (!(UCSR0A & (1<<UDRE0)));
00032 UDR0 = 'U';
00033 while (!(UCSR0A & (1<<UDRE0)));
00034 UDR0 = 'M';
00035 while (!(UCSR0A & (1<<UDRE0)));
00036 UDR0 = 'B';
00037 while (!(UCSR0A & (1<<UDRE0)));
00038 UDR0 = '1';
00039 while (!(UCSR0A & (1<<UDRE0)));
00040 UDR0 = '2';
00041 while (!(UCSR0A & (1<<UDRE0)));
00042 UDR0 = '8';
00043 while (!(UCSR0A & (1<<UDRE0)));
00044 UDR0 = '\r';
00045 while (!(UCSR0A & (1<<UDRE0)));
00046 UDR0 = '\n';
00047 }