The 8051

  So far we have been examining the way in which a microprocessor executes instructions by reading them from ROM, decoding them and carrying out the operations (with more reading of memory if necessary). These concepts are the same for both microprocessor and microcontroller systems. A microcontroller contains the CPU, ROM, RAM and I/O ports all on the one chip. However, the address bus, data bus and control bus connect these devices in the same way as in a microprocessor system (in the microprocessor system the busses are external while in the microcontroller they are internal).
  8051 Family
  The 8051 is just one of the MCS-51 family of microcontrollers developed by Intel. The design of each of the MCS-51 microcontrollers are more or less the same. The differences between each member of the family is the amount of on-chip memory and the number of timers, as detailed in the table below.
Microcontroller On-chip Code Memory On-chip Data Memory Timers
8051 4K ROM 128 bytes 2
8031 0 128 bytes 2
8751 4K EPROM 128 bytes 2
8052 8K ROM 256 bytes 3
8032 0 256 bytes 3
8752 8K EPROM 256 bytes 3
  Each chip also contains:
  • four 8-bit input/output (I/0) ports
  • serial interface
  • 64K external code memory space
  • 64K external data memory space
  • Boolean processor
  • 210 bit-addressable locations
  • 4us multiply/divide
  8051 Pinout
  The diagram above shows the 8051 pinout. The chip is a 40-pin package.
  Port 0 - pins 32 to 39 make up the 8-bit I/O port 0. However, if external memory is used, these lines are used as a multiplexed address and data bus.
  Port 1 - pins 1 to 8 make up the 8-bit I/O port 1.
  Port 2 - pins 21 to 28 make up the 8-bit I/O port 2. However, if external memory is used, these lines make up the high-byte of the external address (A8 to A15).
  Port 3 - pins 10 to 17 make up the 8-bit I/O port 3. However, each of these eight pins also has an alternate function, as detailed in the table below.
Pin Name Bit Address Function
P3.0 RXD B0H Receive data for serial port
P3.1 TXD B1H Transmit data for serial port
P3.2 INT0-bar B2H External interrupt 0
P3.3 INT1-bar B3H External interrupt 1
P3.4 T0 B4H Timer/counter 0 external input
P3.5 T1 B5H Timer/counter 1 external input
P3.6 WR-bar B6H External data memory write strobe
P3.7 RD-bar B7H External data memory read strobe
  RST - the reset input is on pin 9. This pin is used for resetting the 8051 (ie; loading the PC with the correct startup value).
  EA-bar - the external access, on pin 31, is used for enabling or disabling the on-chip ROM. When tied high (5V), the 8051 executes instructions in internal ROM when executing in the lower 4K (8K for the 8052) of memory. If tied low the 8051 will always execute instructions in external memory. The 8031 and 8032 should always have pin 31 tied low as there is no internal code memory.
  ALE - the address latch enable is on pin 30. The ALE is used for latching the low byte of the address into an external register. We will deal with this at a later date.
  PSEN-bar - the program store enable is an output signal on pin 29. This signal is used for fetching instructions from external code memory. We will also deal with this at a later date.
Copyright (c) 2005-2006 James Rogers