background image

 

AVR350

 

 

5

1472D-AVR-01/08 

9 Pseudo-Code 

9.1 purge.c 

initialize timer1 counter for a 1 second delay read uart for 1 

second 

9.2 receive.c 

send a ’C’ character to sender until receive buffer is full  

validate received packet send an ACK or a NACK to sender 

if packet was bad then wait for new good packet 

while not end of transmission 

wait for buffer to fill 

validate the packet 

Act on data received or monitor errors 

send an ACK or a NACK to sender 

9.3 recv_wait.c 

initialize timer1 counter for a 1 second delay  

wait till buffer is full or timeout 

9.4 respond.c 

clear error flags 

If packet was good or end of transmission then 

Send an ACK 

Else 

Purge senders uart transmit buffer 

Send a NACK 

9.5 sendc.c 

initialize timer1 counter for a 3 second delay 

clear error flags 

while buffer is not full 

send ’C’ character to sender, signaling CRC mode 

enable timer counter 

wait for buffer full or timeout 

if timed out clear error flags 

restart timer 

9.6 uart.c 

check uart for framing or overrun errors 

read byte from uart 

verify first byte in receive buffer is valid 

if buffer is full set buffer full flag 

Summary of Contents for AVR AVR350

Page 1: ...s than 1K Bytes of Code Space C High level Language Code 1 Introduction The Xmodem protocol was created years ago as a simple means of having two computers talk to each other With its half duplex mode...

Page 2: ...132 133 Start of Header Packet Number Packet Number Packet Data 16 bit CRC 3 Definitions The following defines are used for protocol flow control Table 3 1 Protocol Flow Control Symbol Description Val...

Page 3: ...self correcting after the receiver NACKs the sender 6 Data Flow Diagram The data flow diagram below simulates a 5 packet file being sent Table 6 1 Data Flow Diagram Sender Receiver C Times Out after T...

Page 4: ...scillator This is sufficiently accurate at room temperature for operation up to 38 4K Baud For higher Baud rates the on board 3 6864MHz oscillator or a 7 3728 MHz crystal should be used with the init...

Page 5: ...9 3 recv_wait c initialize timer1 counter for a 1 second delay wait till buffer is full or timeout 9 4 respond c clear error flags If packet was good or end of transmission then Send an ACK Else Purge...

Page 6: ...cond character in buffer plus the third character in buffer 0xff then compute CRC on packet data if CRC ok then increment packet number packet good else packet bad else bad packet number checksum else...

Page 7: ...ARRANTY RELATING TO ITS PRODUCTS INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTY OF MERCHANTABILITY FITNESS FOR A PARTICULAR PURPOSE OR NON INFRINGEMENT IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIR...

Reviews: