S-Records Programming Example - Motorola MC68302 User Manual

Integrated multi-protocol processor
Hide thumbs Also See for MC68302:
Table of Contents

Advertisement

4.5.11.17 $-RECORDS PROGRAMMING EXAMPLE.
In the following paragraphs,
an example of a downloading application is given that utilizes an
sec
channel
as a UART controller. The application performs downloads and uploads of
S records between a host computer and an intelligent peripheral through a
serial asynchronous line.
The S records are strings of ASCII characters that begin with 'S' and end in
an end-of-line character. This characteristic will be used to impose a message
structure on the communication between the devices. Note that each device
may also transmit XON and XOFF characters for flow control, which do not
form part of the program being uploaded or downloaded.
The UART mode register should be set as required, with the freeze (FRZ) bit
cleared and the enable transmitter/receiver (ENT, ENR) bits set. Receive buff-
ers should be linked to the receive buffer table with the interrupt
(I)
bit set.
For simplicity, assume that the line is not multi drop (no addresses are trans-
mitted) and that each S record will fit into a single data buffer.
Three characters should first be entered into the UART control character
table:
1. End of Line - The valid (V) bit is set; the reject (R) bit is cleared. When
an end-of-line character is received, the current buffer is closed (the next
BD taken by the IMP) and made available to the M68000 core for proc-
essing. This buffer contains an entire S record, which the processor can
now check and copy to memory or disk as required.
2. XOFF- Both V and R should be set. Whenever the M68000 core receives
a control character received interrupt and the receive control character
register contains XOFF, it should immediately stop transmitting to the
other station by setting the FRX bit in the UART mode register. This
prevents data from being lost by the other station when it runs out of
receive buffers.
3. XON -
XON should be received after XOFF. Both
V
and R should be
set. The FRZ bit on the transmitter should not be cleared. The IMP
automatically resumes transmission of the serial line at the point at
which it was previously stopped. Like XOFF, the XON character is not
stored in the receive buffer.
To receive the S records, the M68000 core must only wait forthe Rx interrupt,
indicating the reception of a complete S-record buffer. Transmission requires
assembling S records into data buffers and linking them to the transmit buffer
MOTOROLA
MC68302 USER'S MANUAL
4-51

Advertisement

Table of Contents
loading

Table of Contents