==============================
# include
/ / ===================================== char flag_t1; char flag_t0; unsigned int time_t0;
/ / =====================================
# ifndef RXB8
# define RXB8 1
# endif
# ifndef TXB8
# define TXB8 0
# endif
# ifndef UPE
# define UPE 2
# endif
# ifndef DOR
# define DOR 3
# endif
# ifndef FE
# define FE 4
# endif
# ifndef UDRE
# define UDRE 5
# endif
# ifndef RXC
# define RXC 7
# endif
/ / =====================================
# define FRAMING_ERROR (1 << FE)
# define PARITY_ERROR (1 << UPE)
# define DATA_OVERRUN (1 << DOR)
# define DATA_REGISTER_EMPTY (1 << UDRE)
# define RX_COMPLETE (1 << RXC)
/ / =====================================
/ / USART1 Receiver buffer
# define RX_BUFFER_SIZE1 16rx_buffer1 [RX_BUFFER_SIZE1];
# if RX_BUFFER_SIZE1 <256char rx_wr_index1, rx_rd_index1, rx_counter1;
# elseint rx_wr_index1, rx_rd_index1, rx_counter1;
# endif
/ / =====================================
/ / This is set on USART1 Receiver buffer overflowrx_buffer_overflow1;
/ / USART1 Receiver interrupt service routine [USART1_RXC] void usart1_rx_isr (void)
{status, data;=UCSR1A;=UDR1; ((status & (FRAMING_ERROR | PARITY_ERROR | DATA_OVERRUN)) == 0)
{_buffer1 [rx_wr_index1]=data; (+ + rx_wr_index1 == RX_BUFFER_SIZE1) rx_wr_index1=0; (+ + rx_counter1 == RX_BUFFER_SIZE1)
{_counter1=0; _buffer_overflow1=1;
};
};
}
/ / Get a character from the USART1 Receiver buffer
# pragma used + getchar1 (void)
{data; (rx_counter1 == 0);=rx_buffer1 [rx_rd_index1]; (+ + rx_rd_index1 == RX_BUFFER_SIZE1) rx_rd_index1=0;
# asm («cli»)
-rx_counter1;
# asm («sei») data;
}
# pragma used-
/ / =====================================
/ / USART1 Transmitter buffer
# define TX_BUFFER_SIZE1 16tx_buffer1 [TX_BUFFER_SIZE1];
# if TX_BUFFER_SIZE1 <256char tx_wr_index1, tx_rd_index1, tx_counter1;
# elseint tx_wr_index1, tx_rd_index1, tx_counter1;
# endif
/ / =====================================