Specifications

13
AVR064
2529A–AVR–11/02
Receive Data from PC These routines take care of data coming from the PC through the UART interface.
Figure 12. Receive Packet from PC
USART_RXC_interrupt Receiving data from the PC is done in the USART_RXC_interrupt routine. It will discard
all data until the correct preamble bytes are received. Then it will store the succeeding
bytes in a receive buffer until the byte for Line Feed appears (ASCII value: 0x0D) This
indicates the end of the packet and RX_Packet_complete Flag will be set to TRUE.
Read the UDR0 Register
which Contains the
Received Byte.
Interrupt [USART_RXC_vect] Void USART0_RXC_interrupt (Void)
Preamble
Received?
Store Received
Byte in Receive
Buffer
Received
Byte = 0x0D?
(ascii Value for Line Feed,
End of Packet)
Preamble Received = FALSE
RX_Packet Complete = TRUE
YES
YES
NO
NO
RX_Packet
Complete?
Byte in
Receive Buffer = 0x0D
or 0x20? (End of Packet
or New Byte)
Convert ASCII
Byte to HEX
Store the HEX
Byte to SRAM
There May Be Up to
Three ASCII Bytes to
Get One HEX Byte
Any Byte
Converted?
Byte in
Receive Buffer
= 0x0D?
YES
NO
YES
NO
Set RX_Packet
Complete = FALSE
YES
NO
NO
YES
Return
Return from
Interrupt
Store_RX_data
RXC Interrupt