background image

AT89C51 In-Circuit Programming

This application note illustrates the in-
circuit programmability of the Atmel
AT89C51 Flash-based microcontroller.
Guidelines for the addition of in-circuit
programmability to AT89C51 applica-
tions are presented along with an appli-
cation example and the modifications to
it required to support in-circuit program-
ming. A method is then shown by which
the AT89C51 microcontroller in the ap-
plication can be reprogrammed re-
motely, over a commercial telephone
line. The circuitry described in this appli-
cation note supports five volt program-
ming only, requiring the use of an
AT89C51-XX-5. The standard AT89C51
requires 12 volts for programming.

The software for this application may be
obtained by downloading from Atmel’s
BBS: (408) 436-4309. 

General Considerations

Circuitry added to support AT89C51 in-
circuit programming should appear
transparent to the application when pro-
gramming is not taking place.

EA#/VPP must be held high during pro-
gramming. In applications which do not
utilize external program memory, this
pin may be permanently strapped to
V

CC

. Applications utilizing external pro-

gram memory require that this pin be
held low during normal operation.

RST must be held active during pro-
gramming. A means must be provided
for overriding the application reset cir-
cuit, which typically asserts RST only
briefly after power is applied.

PSEN# must be held low during pro-
gramming, but must 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 terms.

Port Used for Input

During programming, the controller
must be isolated from signals sourced
by the application circuitry. A buffer with
three-state outputs might be inserted
between the application circuitry and the
controller, with the buffer outputs three-
stated when programming is enabled.
Alternately, a multiplexer might be used
to select between signal sources, with
signals applied to the controller by either
the application circuitry or the program-
mer circuitry.

Port Used for Output

No circuit changes are required if the
application circuitry can tolerate the
state changes which occur at the port
during programming. If the prior state of
the application circuitry must be main-
tained during programming, a latch
might be inserted between the controller
and the application circuitry. The latch is
enabled during programming, preserv-
ing the state of the application circuitry.

An Application Example

The AT89C51 application shown in Fig-
ure 1 is an implementation of a moving
display. This application was selected
for its simplicity and ability to show
graphically the results of in-circuit repro-
gramming. The text to be displayed is

8-Bit
Microcontroller
with Flash

Application
Note

0287C

Microcontroller

 

4-9

Содержание 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...

Отзывы: