8-bit microcontrollers
CDAC,Mohali
AgendaMCS-51 family architecture
CDAC,Mohali
Computer Organization
Control unit
ALURegisterProcessorOutputInputMemory
CDAC,Mohali
Overview of MCS-51 familyIntel 8051 is a stand alone high performance single chip computer intended for use in sophisticated real time applications such as instrumentation, industrial control and computer peripherals. It provides extra features like interrupts, bit address ability and an enhanced set of instructions, which makes the chip very powerful and cost effective. The ease with which it can be interfaced with the other peripheral chips make it very powerful.
CDAC,Mohali
The features of the 8051 core are8-bit CPU optimized for control applicationsExtensive Boolean processing (Single-bit logic) capabilities4K ROM of on-chip Program Memory (0K (8031), EPROM 4K (8751))128 bytes of on-chip Data RAM16 bit PC and DPTREight bit PSW eight bit stack pointer
CDAC,Mohali
32 bi-directional and individually addressable I/O lines. Which form four 8-bit I/O Ports (P0-P3).Two 16-bit timer/countersFull duplex UART6 interrupt sources with two priority levels On-chip clock oscillator210 bit-addressable locations.Oscillator & Clock Circuit
Contd
CDAC,Mohali
Block Diagram of 8051
CDAC,Mohali
8051 Block Diagram
CDAC,Mohali
Other members of the family8031 80518052ROM 0K 4K 8KRAM 128B 128B 256BTimers 2 2 3I/O pins 32 32 32Serial p. 1 1 1Interrupt 6 6 8
CDAC,Mohali
Other 8051 microcontrollersUV EPROM version of 8051 is 8751FLASH version of 8051 is 8951OTP versionsThe one by ATMEL,FLASH ROM version of 8051
is AT89C51.AT89C51,AT89C1051,AT89C2051,AT89C52,etc
CDAC,Mohali
Pinout diagram of 8051
CDAC,Mohali
Logic Symbols
CDAC,Mohali
Pin Description of 8051PSEN (pin 29): (Program Store Enable) Enables external program (code) memory. Usually connected to EPROMs output enable (OE). It pulses low during fetch stage of an instruction. It remains high while executing a program from internal ROM. ALE (pin 30): (Address Latch Enable) used for de-multiplexing the address and data bus when port 0 is used as the data bus and low-byte of address bus. EA (pin 31): (External Access) high to execute programs from internal ROM and low to execute from external memory only.
CDAC,Mohali
RST (pin 9): (RESET) master reset of 8051. RST pin must be high for at least two machine cycles while the oscillator is running. External reset is asynchronous to the internal clock. Internal RAM is not affected by reset. Reset sets PC to 0000H.
CDAC,Mohali
8051 Oscillator & Power Pins: Pins 18 and 19 are the oscillator pins to connect the crystal of nominal frequency 12 MHz.One 8051-processor cycle consists of twelve oscillator periods. Each of the twelve oscillator periods is used for a special function by the 8051 core such as op code fetches . The time required for any 8051 instructions can be computed by dividing the clock frequency by 12, inverting that result and multiplying it by the number of processor cycles required by the instruction in question.
CDAC,Mohali
Therefore, if you have a system, which is using an 11.059MHz clock, you can compute the number of instructions per second by dividing this value by 12. This gives an instruction frequency of 921583 instructions per second. Inverting this will provide the amount of time taken by each instruction cycle (1.085 microseconds).
CDAC,Mohali
Supply and Ground pins: Pin 40 is for +5V and pin 20 is for GND. I/O Ports: Four 8-bit I/O ports. Most have alternate functions. Port 0 (pin 32-39) Dual purpose I/O port. In min. component design, it is used as a general purpose I/O port.In larger designs with external memory, it becomes a multiplexed data bus: Low byte of address bus, strobed by ALE. 8-bit instruction bus, strobed by PSEN. 8-bit data bus, strobed by WR and RD.
CDAC,Mohali
Port 1 (pin 1-8) As an I/O port: Standard bi-directional port for interfacing to external devices as required for I/O.Alternate functions: Only on some derivatives Port 2 (pin 21-28) Dual purpose I/O port.As an I/O port: Standard bi-directional general purpose I/O port.Alternate functions: High byte of address bus for external program and data memory accesses.
CDAC,Mohali
Port 3 (pin 10-17)is an 8-bit bi-directional I/O port with internal pull-ups. It also serves the functions of various special features of the 80C51. Table of alternate uses of Port- 3 pins: PINS ALTERNATE USE SFR P3.0 RXD Serial data input SBUFP3.1 TXD Serial data output SBUFP3.2 INT0 External Interrupt 0 TCON.1 P3.3 INT1 External Interrupt 1 TCON.3P3.4 T0 External Timer 0 I/P TMODP3.5 T1 External Timer 1 I/P TMODP3.6 WR External Memory write pulse - P3.7 RD External Memory read pulse -
CDAC,Mohali
Pulse P: It is the smallest interval of time within microcontroller established by the clock frequency. Machine Cycle: Smallest interval of time to accomplish any simple instruction or part of complex instruction. Made up of six states in case of MCS-51 family.State: Basic time interval for discrete operations of machine cycles, such as fetching op-code byte, decoding an opcode etc.To calculate the time for any particular instruction A and B CPU registers:Two of the general purpose registers. Hold results of instructions particularly math and logical operations.Register A is a versatile register, But register B is used with A register for multiplication and division operations and has no other function except data may be stored in it .
CDAC,Mohali
CPU TimingState 1State 2State 3State4State 5State 6P1 P2One Machine Cycle ALEEach state is divided into 2 phases, phase-1 and phase-2.
CDAC,Mohali
Flags and PSW : Flags are grouped inside PSW and PCON registers.In 8051 there are 7 flags, 4 math flags which respond automatically to the outcomes of the math operations and 3 general purpose flags which can be set or reset by the programmer.Math flags are - Auxiliary carry(AC), Carry(C), Parity(P) and Overflow (OV)General Purpose Flags - FO, GF0 and GF1PSW : CY AC F0 RS1 RS2 OV - P
CDAC,Mohali
Symbol Function CY Used in arithmetic, jump, rotate & Boolean inst AC Used for BCD arithmetic F0 User flag 0 RS1 RS1 and RS0 used to select one of the 4 RS0 register banks of internal RAM OV Used in arithmetic instructions P Shows the parity of register A
CDAC,Mohali