/* mija 2008source file for hw USART ATtiny2313fixed boud rate 9600 8N1PD1 - TXPD0 - RXver.: 0.0 TESTED*/#include <avr/io.h>#include "rs232.h"//**************************************************************void rs232_init(void){//set baud rate fixed 9600 8N1UCSRA = UCSRA | ( 1 << U2X) ;UBRRH = 0;UBRRL = 12;//enable RX TXUCSRB = (1<<RXEN)|(1<<TXEN);//8N1//UCSRC = (1<<UMSEL);}int rs232_put(char data){// Wait for empty transmit bufferwhile ( !( UCSRA & (1<<UDRE)) );// Put data into buffer, sends the dataUDR = data;return 0;}int rs232_get(void){// Wait for data to be receivedwhile ( !(UCSRA & (1<<RXC)) );// Get and return received data from bufferreturn UDR;}