background image

tion, programmer signals may be buffered with three-state
buffers similar to the 74xx125.

The AT89C51 in the programmer does not utilize external
program or data memory, which would require sacrificing
needed I/O pins. This requires that program code and I/O
buffers be kept small enough to fit in on-chip memory.

Remote Programming Over a Commercial
Telephone Line

The programmer and display application described pre-
viously are connected to a phone line via a modem at a
remote site. Using a personal computer with a modem, a
user can upload a new program containing a new mes-
sage, which is programmed into the AT89C51 embedded
in the application. When programming is complete, the
application executes the new program, which displays the
new message.

Local Station

The local station in the test configuration consists of an
IBM PC AT-class computer connected to a Hayes-com-
patible, Prometheus 1200 baud modem. The modem was
selected because it was inexpensive and available. A
faster modem may be used if desired, although once the
file transmission time is reduced below one minute, further
reductions in transmission time do not further reduce con-
nect time charges. A possible advantage to higher trans-
mission speeds is the automatic error detection and cor-
rection available in some high speed modems.

Procomm Plus version 2.01, a commercial data communi-
cations package, is used to configure the modem, set up
communications parameters, and establish a link with the
remote modem. Procomm Plus includes a macro lan-
guage called ASPECT, which allows the user to write and
compile scripts which implement custom file transfer pro-
tocols. A simple ASPECT script was written to read the
contents of a program file and upload it to the remote pro-
grammer.

The file transfer protocol (FTP) implemented is a simple
send-and-wait, packet-oriented protocol. The transmit
and receive modes of the FTP are illustrated by the flow-
charts in figures 4 and 5, respectively. The transmitter
sends each packet without flow control and waits for a re-
sponse. The programmer (the receiver) reads and dis-
sects the packet while calculating a checksum. If the cal-
culated checksum is valid, the programmer acknowledges
the packet by sending an ACK. If the checksum is in error,
the programmer negatively acknowledges the packet by
sending a NAK. Upon receipt of an ACK, the transmitter
sends the next packet. If the transmitter receives a NAK,
it resends the same packet. Transmission proceeds in this
manner until the entire file has been transferred.

The programmer might respond to a packet by sending a
CAN, which indicates that a non-recoverable error has oc-
curred and that the transmitter should immediately abort
the file transfer. If the programmer fails to respond to a
packet within a limited period of time, the transmitter will
resend the same packet. The transmitter will continue to
resend the same packet until a valid response is received
or until the allowed number of attempts is exceeded, at
which time the file transfer is aborted.

After each packet is received and validated by the pro-
grammer, the data contained in the packet is programmed
into the AT89C51 controller in the application. After pro-
gramming, the data is read back from the controller and
verified against the received packet data. Successful veri-
fication indicates successful programming, causing the
programmer to send ACK to the transmitter. If program-
ming fails, the programmer sends CAN to signal the trans-
mitter to abort the file transfer.

The simplicity of the FTP reduces the amount of AT89C51
program memory used in the programmer. The send-and-
wait nature of the FTP allows inter-packet delays due to
AT89C51 program and erase times to be easily absorbed.
Support for program verification is transparent, requiring
no explicit command or result codes, or additional data
transfers.

The files which are uploaded to the programmer are cre-
ated with the tools in the Intel MCS-51 Software Develop-
ment Package for the IBM PC. Included in the package
are the MCS-51 Macro Assembler, MCS-51 Relocator
and Linker, and a useful utility, OH. OH converts an abso-
lute 8051 object file to an equivalent ASCII hexadecimal
object file.

The records in the hex file produced by the OH utility
serve, unchanged, as the packets in the FTP described
above; no service fields need to be added. The colon
which begins each record serves as the packet signature
field. The load address field serves as the packet se-
quence number. A checksum is provided as the last field
in each record. Since seven-bit ASCII coding is utilized,
the eighth bit of each byte is available to be used for parity
checking.

Because the AT89C51 in the programmer does not utilize
external data memory, necessary packet buffering must
be done using internal RAM. Limited memory precludes
the use of conventional FTPs which utilize packets of 128
bytes and larger. The hex packet format used in this appli-
cation limits packet data fields to 16 or fewer entries, re-
quiring little memory for buffering.

The ready availability of a utility for creating the packet-
ized program file, combined with small packet size and
adequate error checking, makes the hex packet format a
near ideal solution for this application. A disadvantage is

Microcontroller

 

4-11

Содержание AT89C51

Страница 1: ...not be driven during normal operation ALE PROG is pulsed low during pro gramming but must not be driven during normal operation During programming AT89C51 I O ports are used for the application of mode select addresses and data pos sibly requiring that the controller be iso lated from the application circuitry How this is done is application dependent and will be addressed here only in gen eral te...

Страница 2: ... and pro gram verification the programmer asserts control of port zero and part of port two The programmer is connected to ports zero and two without buffering since when inac tive its presence does not affect the normal operation of the application A transparent latch has been added between port two of the controller and the display control inputs The latch holds the display control signals inact...

Страница 3: ...rammer might respond to a packet by sending a CAN which indicates that a non recoverable error has oc curred and that the transmitter should immediately abort the file transfer If the programmer fails to respond to a packet within a limited period of time the transmitter will resend the same packet The transmitter will continue to resend the same packet until a valid response is received or until ...

Страница 4: ...ng for the next call If the caller hangs up the thirty second period must expire before another call will be answered Calls incoming dur ing the reset delay period are ignored If a valid packet header is received prior to the expiration of the reset delay period the programmer will attempt to read and validate the incoming packet At any time during packet reception an invalid character parity erro...

Страница 5: ...em to an analog telephone line and set the modem switches as indicated below Turn the modem on and apply power to the display appli cation programmer The application will begin executing its program if it contains one The programmer will initial ize the modem as shown by the activity on the modem status indicators Switch settings 1 ON 2 ON 3 ON 4 OFF 5 ON 6 ON 7 ON 8 OFF 9 OFF 10 OFF Installing an...

Страница 6: ... A1 WR DL1414T U2 8 9 10 11 2 1 12 5 4 D0 D1 D2 D3 D4 D5 D6 A0 A1 WR DL1414T U3 8 9 10 11 2 1 12 5 4 P2 0 P2 1 P2 2 P2 3 P2 4 P2 5 P2 6 P2 7 D0 D1 D2 D3 D4 D5 D6 A0 A1 WR DL1414T U4 8 9 10 11 2 1 12 5 4 D0 D1 D2 D3 D4 D5 D6 A0 A1 WR DL1414T U5 8 9 10 11 2 1 12 5 4 21 22 23 24 25 26 27 28 P0 0 P0 1 P0 2 P0 3 P0 4 P0 5 P0 6 P0 7 39 38 37 36 35 34 33 32 PSEN ALE PROG P3 6 WR P3 7 RD 29 30 16 17 AT89C...

Страница 7: ...Figure 2 AT89C51 Moving Display Application Modified for In Circuit Programming Microcontroller 4 15 ...

Страница 8: ...Figure 3 AT89C51 Programmer 4 16 Microcontroller ...

Страница 9: ...Figure 4 FTP Transmit Mode Microcontroller 4 17 ...

Страница 10: ...Figure 5 FTP Receive Mode 4 18 Microcontroller ...

Страница 11: ...eld consists of four hex digits and in dicates the absolute address at which the data in the data field is to be loaded The record type field consists of two hex digits which are always zero in data records The data field contains from one to 16 pairs of hex digits The last two hex digits are a checksum on the record length load address record type and data fields The sum of the binary equivalents...

Отзывы: