WHAT IS A MICROCONTROLLER?• All of the components needed for a controller were built right onto one chip.• Thus A one chip computer, or microcontroller was born.• A microcontroller is a highly integrated chip which includes, on one chip, all or most of the parts needed for a controller.• The microcontroller could be called a "one- chip solution".
Features :• The Intel 8051 is used in embedded systems – 8-bit CPU – 4k bytes ROM for the program – 128 BYTES of RAM for variables – 32 I/O lines ( 4 PORTS WITH 8 EACH ) – 2 timers – 1 Serial port – 6 interrupt sources – Low cost (25-30 Rs per chip)
Block DiagramExternal Interrupts Interrupt 4k 128 bytes Timer 1 Control ROM RAM Timer 2 CPU OSC Bus 4 I/O Ports Serial Control P0 P2 P1 P3 TXD RXD Addr/Data
8051 – PIN DIAGRAM
8051 – 40 PIN IC
• 8051 contains four I/O ports (P0 - P3) • Each port can be used as input or output (bi-direction) Port 0 Port 1 Port 2 Port 3P0（P0.0～P0.7） P1（P1.0～P1.7） P2（P2.0～P2.7） P3（P3.0～P3.7） 8-bit R/W - 8-bit R/W - General General General Purpose I/O Purpose I/O Purpose I/O Only 8-bit R/W - General Or high if not using Or acts as a Purpose byte of the any of the multiplexed I/O address internal low byte bus for peripherals address and (timers) or data bus for external external memory external memory design interrupts. design
IMPORTANT PINS• PSEN (out): Program Store Enable, the read signal for external program memory (active low).• ALE (out): Address Latch Enable, to latch address outputs at Port0 and Port2• EA (in): External Access Enable, active low to access external program memory locations 0 to 4K• RXD,TXD: UART pins for serial I/O on Port 3• XTAL1 & XTAL2: Crystal inputs for internal oscillator.
SIGNALS - OPERATION• Vcc（pin 40）： – Vcc provides supply voltage to the chip. – The voltage source is +5V.• GND（pin 20）：ground• XTAL1 and XTAL2（pins 19,18）： – These 2 pins provide external clock. – Way 1：using a quartz crystal oscillator – Way 2：using a TTL oscillator
RST - RESET• RST（pin 9）：reset – input pin and active high • The high pulse must be high at least 2 machine cycles. – power-on reset. • Upon applying a high pulse to RST, the microcontroller will reset and all values in registers will be lost.
EA & PSEN• EA（pin 31）：external access – There is no on-chip ROM in 8031 and 8032 . – The EA pin is connected to GND to indicate the code is stored externally. – PSEN ＆ ALE are used for external ROM. – active low.• PSEN（pin 29）：program store enable – This is an output pin and is connected to the OE pin of the ROM.
ALE• ALE（pin 30）：address latch enable It is an output pin and is active high. 8051 port 0 provides both address and data. The ALE pin is used for de-multiplexing the address and data by connecting to the G pin of the 74LS373 latch.