【文章內(nèi)容簡介】
the controller to be forced high by the programmer. PSEN and ALE/PROG, unused in the basic application, areunder 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 pullups 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 bees 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. The Programmer The programmer (Figure 3) generates the addresses, data and control signals necessary to program the AT89C51 embedded in the application. The programmer circuitry consists of an AT89C51 and an RS232 level translator. The controller runs at MHz, which allows the serial port to operate at a number of standard baud rates. A Maxim MAX232 line driver/receiver produces RS232 levels at the serial interface while requiring only a five volt supply. Many of the signals generated by the programmer are connected directly, without buffering, to the AT89C51 in the application. These signals, when inactive, are not threestated, but are pulled high. The AT89C51 has internal pullups of approximately three Kohms on ports one, two and three. Because port zero does not have internal pullups, external pullups of ten Kohms have been added to permit proper operation of program verification mode. The sample application operates correctly in this environment. If required for patibility with an application, programmer signals may be buffered with threestate 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 onchip memory. Remote Programming Over a Commercial Telephone Line The programmer and display application described previously are connected to a phone line via a modem at a remote site. Using a personal puter with a modem, a user can upload a new program containing a new message, which is programmed into the AT89C51 embedded in the application. When programming is plete, 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 ATclass puter connected to a Hayespatible, 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 connect time charges. A possible advantage to higher transmission speeds is the automatic error detection and correction available in some high speed modems. Prom Plus version , a mercial data munications package, is used to configure the modem, set up munications parameters, and establish a link with the remote modem. Prom Plus includes a macro language called ASPECT, w