#include #include #include #include #include #include #include #include #define F_CPU 4000000 #define UART_BAUD_RATE 9600 /* 9600 baud */ #define UART_BAUD_SELECT (F_CPU/(UART_BAUD_RATE*16l)-1) typedef unsigned char u08; typedef char s08; typedef unsigned short u16; typedef short s16; /* uart globals */ static volatile u08 *uart_data_ptr; static volatile u08 uart_counter; static volatile u08 inB; SIGNAL(SIG_UART_TRANS) { uart_data_ptr++; if (--uart_counter) UDR = *uart_data_ptr; } SIGNAL(SIG_UART_RECV) { register char readIn; readIn = UDR; inB = readIn; } void uart_send(u08 *buf, u08 size) { if (!uart_counter) { uart_data_ptr = buf; uart_counter = size; UDR = *buf; } while (uart_counter != 0) { } } void uart_init(void) /* initialize uart */ { /* enable RxD/TxD and ints */ UCSRB = (1<