Introduction To MC
Introduction To MC
Introduction To MC
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 MCS51 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. On-chip Code On-chip Data Microcontroller Timers Memory Memory 8051 8031 8751 8052 8032 4K ROM 0 4K EPROM 8K ROM 0 128 bytes 128 bytes 128 bytes 256 bytes 256 bytes 256 bytes 2 2 2 3 3 3
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, 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 P3.1 TXD B0H B1H Receive data for serial port Transmit data for serial port External interrupt 0 External interrupt 1 Timer/counter 0 external input Timer/counter 1 external input External data memory write strobe
P3.2 INT0-bar B2H P3.3 INT1-bar B3H P3.4 T0 P3.5 T1 P3.6 WR-bar B4H B5H B6H
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.