Electronic Design

87C751 MCU Programmer Has Serial-Bus Interface

The Philips 87C751 is an 8-bit 8051-compatible microcontroller with a small footprint (the 24-pin "skinny DIP" package is discussed here) and special enhanced capabilities. It has 2 kbytes of EPROM program memory and 64 bytes of RAM. The most useful feature is its built-in I2C (Inter-Integrated Circuit) serial bus interface, which makes it ideal to operate as a master or slave device in I2C small-area network systems.

Its EPROM memory can be programmed using the same programming algorithm as its bigger brother, the 87C51 (the 40-pin microcontroller with 4 kbytes of program memory and 128 bytes of RAM). But there's one important addition: to place the 87C751 in any of the various programming modes, its RESET pin must be supplied with a special 10-bit serial bit stream to tell it what mode it should be in. This bit stream also must be synchronized to the clock signal applied to its XTL1 pin.1

The task of synchronizing this bit-stream generation can be resolved by taking advantage of the 87C51's ALE (Address Latch Enable) signal (see the figure). Here, the programmer is connected to a host PC serial port via the MAX232 RS-232 transceiver (U1). Power is provided by a 15-V ac wall transformer via bridge rectifier BR1 and then regulated by two voltage regulators. The 7805 (VR1) supplies 5 V to the VCC pins of all ICs and the LM317 (VR2) supplies 12.75 V for the 87C751 programming voltage, VPP, which is controlled by transistor pair Q1 and Q2. The 12.75 V will appear on the VPP pin of the 87C751 only if both Q1 and Q2 conduct; these transistors are controlled by the system's master 87C51 microcontroller (U2).In fact, the U2 controls all of the programming chores. These include receiving command and data from the host PC, providing the 87C751 with the required serial bit stream (via port pin P1.7), placing the address/data on the buses, issuing the programming pulses (via port pin P1.5), etc.

LED1 is used to indicate the programmer's working state. The data bus consists of pins D0-D7 with associated pull-up resistors. The address is multiplexed to the 87C751 by using the 74LS157 quad 2-to-1-line data selector (U3). When the "select" pin S is high, the high-order address lines (A8-A10) are activated. When S is low, the low-order address lines (A0-A7) are activated. The Philips data handbook requires that the high-order address must be placed first, then the address select pin S = ASEL is set low to latch it, and then the low-order address is placed on the bus.

The clock signal for U2 is generated by a 22.1184-MHz oscillator (OSC1). Its ALE pin outputs a signal at 1/6 the oscillator frequency. This signal then is fed to the 74LS113 dual J-K negative-edge-triggered flip-flops working in toggle mode to further divide the frequency by 2. Hence, the Q signal, which is supplied to XTL1 of the 87C751, is 1/12 of the oscillator frequency.

This important relationship allows us to take advantage of the fact that the 8051 set bit/clear bit instructions each take 12 clock cycles to execute. Therefore, we can use the set bit/clear bit instructions to form the required bit stream. For example, looking at the figure, since the 87C751's RESET pin is connected to the U2 port pin P1.7 to generate a High-Low-High bit stream, only the following code is needed:

SETB   P1.7
CLR   P1.7
SETB   P1.7

Each instruction takes 12 clock cycles to execute, so each instruction is exactly equal to a High or a Low bit pattern from the viewpoint of the target 87C751. That's because it runs 12 times slower than U2. Using this simplifying trick, the required 10-bit serial bit stream for a specific programming mode can be easily written as a software routine. The benefit is obvious—greatly simplified hardware and software design. The Philips databook also requires that the clock signal applied to the 87C751's XTL1 pin must be between 1.2 and 6 MHz. In our case it's 1.8432 MHz.

The DPDT switch SW1 is used to prevent a "hot" ZIF socket when powering up. The 87C751 should be placed in the socket before power is up and before SW1 is closed. Diode D1 is used to provide a logic high signal to the VPP pin, required by the device before 12.75 V is applied, and to block the high voltage from going to VCC. LED2 is used to indicate the programming status. Once SW1 is closed, LED2 will be on but just dimly; only when 12.75 V is applied will it illuminate at full brightness.

Once the hardware design was resolved, software development was needed to complete the project. The author's finished 87C751 programmer firmware is a binary file called p751.bin burned into U2 by using an 8x51 EPROM/Flash programmer.2 The host PC communication program is a DOS file called pgm75l.exe stored on a diskette. These files are available on Electronic Design's web site at www.elecdesign.com under Ideas For Design.


  1. Philips Semiconductors, Data Handbook IC20, 1998, page 139.
  2. Xu, G.Y. "8x51 EPROM/Flash Microcontroller Programmer," Circuit Cellar magazine, April 1998.
Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.