The reset circuit has been modified by the addition of two transistors, which
allow RST on the controller to be forced high by the programmer.
PSEN and ALE/PROG, unused in the basic application, are under the direct
control of the programmer.
Programming requires programmer access to all of the four AT89C51 I/O ports,
as documented in the data sheet. The programmer is connected directly to those
controller pins which are unused by the application, while access to pins used by the
application requires special treatment, as explained in the following paragraphs.
The least significant four bits of the address generated by the programmer are
multiplexed onto port one of the controller with the data from the DIP switch. Note
that the four resistors added at the switch are not required in the basic application,
since the AT89C51 provides internal pull-ups on port one.
During the normal operation of the application, controller ports zero and two
provide data and control signals (respectively) to the displays. During programming
and program 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 inactive, 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 inactive during
programming, which eliminates erratic operation of the displays due to programmer
activity on ports zero and two. No isolation of the display data inputs is required,
since data applied to the inputs is ignored when the control signals are inactive.
The AT89C51 reset circuit, input multiplexer and output latch are controlled by a
single signal generated by the programmer. During programming, reset is asserted, the
multiplexer switches inputs, and the latch freezes the display control lines.
To ensure that the display control lines are in a known state before they are
latched, an AT89C51 external interrupt is used to allow the programmer to signal the
application before asserting reset. The application firmware responds to the interrupt
by displaying a message and deactivating the display control lines.
After programming, when reset is deasserted, the controller ports are high as the
latch becomes transparent. Since the display control inputs are inactive high, the
display contents are not disturbed until the new program writes the display. Although
not essential to this application, it might be imperative in some applications that the
state of the peripheral circuitry not be disturbed during programming.