Design Ideas: January 4, 1996
In an 8051-based system without external program memory, the program-store enable (PSEN) pin is useless. However, you can indirectly control this pin using software. To do so, you execute the move-constant- (MOVC-) instruction-implementing table look-up. By accessing locations in external program memory (which is actually nonexistent), you can produce pulses on the PSEN line without disturbing program flow. Although you need a register for storing output data, you dont have to install a decoder. PSEN operates as an internally predecoded write strobe. Thus, you can have this 33rd controllable pin for "free." Unfortunately, the MOVC instruction causes the 16-bit address to emit externally on ports P0 and P2. This technique is advisable only for systems that dont suffer from temporary changes of these ports.
The circuit in Figure 1a uses PSEN to clock a serial register. Input data come from the A8 address line, and parallel outputs drive LEDs. By repeating MOVC with A8=0 or A8=1, you can obtain an arbitrary on/off LED pattern. If bubbling serial data through register cells is inconvenient, you can also use PSEN to implement a regular output port. The circuit in Figure 1b stores address bits A0 through A7 into a parallel register.
Note that because P0 lines act as address and data, the µP tristates these lines before PSEN activation. Therefore, you cant use these lines without an address latch. You can indirectly use P2 lines, but remember that the effective MOVC address must fall into external memory. All patterns, therefore, are not valid. (DI #1811)