You are on page 1of 22

MICROCONTROLL ERS

8051

WHAT IS A MICROCONTROLLER?
• All of the components needed for a controller were built right onto one chip. • 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

MICROPROCESSOR vs MICRO CONTROLLER .

I/O ports. the space it takes. and timers externally to make them functional q Make the system bulkier and much more expensive q Have the advantage of versatility on the amount of RAM. ROM. and I/O ports v The fixed amount of on-chip ROM. and number of I/O ports makes them ideal for applications in which cost and space are critical. and the . ROM. the power it consumes. RAM.MICROPROCESSOR Vs MICRO CONTROLLER General-purpose microprocessors   Microcontroller q Must add RAM. v In many applications.

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 (10-15 cents per .

Block Diagram External Interrupts Interrupt Control 4k ROM 128 bytes RAM Timer 1 Timer 2 CPU OSC Bus Control 4 I/O Ports Serial P0 P2 P1 Addr/Data P3 TXD RXD .

8051 – PIN DIAGRAM .

8051 – 40 PIN IC .

P3) • Each port can be used as input or output (bi-direction) • .• • 8051 contains four I/O ports (P0 .

PORT 3 – MULTIPLE FUNCTIONS .

ALE(out): Address Latch Enable. active low to access external program memory locations 0 to 4K RXD.IMPORTANT PINS • • • PSEN(out): Program Store Enable.TXD: UART pins for serial I/O on Port 3 • • • • • . to latch address outputs at Port0 and Port2 EA(in): External Access Enable. the read signal for external program memory (active low).

• GND ( pin 20 ): ground • XTAL1 and XTAL2 ( pins 19.OPERATION • Vcc ( pin 40 ): – Vcc provides supply voltage to the chip. – The voltage source is +5V.SIGNALS . – Way 1 : using a quartz crystal oscillator .18 ): – These 2 pins provide external clock.

QUARTZ CRYSTAL OSCILLATOR • Using a quartz crystal oscillator • We can observe the frequency on the XTAL2 pin. • C2 XTAL2 30pF C1 XTAL1 30pF GND .

XTAL Connection to an External Clock Source • Using a TTL oscillator • XTAL2 is unconnected.  N C EXTERNAL OSCILLATOR SIGNAL XTAL2 XTAL1 GND .

RESET • RST ( pin 9 ): reset – input pin and active high • The high pulse must be high at least 2 machine cycles. • Reset values of some 8051 registers  . – power-on reset.RST . • Upon applying a high pulse to RST. the microcontroller will reset and all values in registers will be lost.

RESET Value of Some 8051 Registers: Register PC ACC B PSW SP DPTR RAM are all zero Reset Value 0000 0000 0000 0000 0007 0000 .

2 K X2 RST .RESET CIRCUITARY Vcc 31 10 uF 30 pF EA/VPP X1 9 8.

–The EA’ pin is connected to GND to indicate the code is stored externally. –For 8051.EA’ & PSEN’ EA’ ( pin 31 ): external access –There is no on-chip ROM in 8031 and 8032 . EA’ pin is connected to Vcc. PSEN’ ( pin 29 ): program store enable –This is an output pin and is connected to the OE pin of the ROM. –PSEN’ & ALE are used for external ROM. –active low. .

v8051 port 0 provides both address and data.ALE ALE ( pin 30 ): address latch enable vIt is an output pin and is active high. . vThe ALE pin is used for de-multiplexing the address and data by connecting to the G pin of the 74LS373 latch.

External code memory WR RD PSEN ALE P0.0 P0.7 8051 D7 A8 A15 ROM G D 74LS373 .7 OE CS A0 A7 D0 EA P2.0 P2.

External data memory WR RD PSEN ALE P0.7 8051 D7 A8 A15 RAM .7 WR RD G D 74LS373 CS A0 A7 D0 EA P2.0 P0.0 P2.