Sie sind auf Seite 1von 16

MICROCONTROLLERS

MICROCONTROLLERS- INTRODUCTION
• For a microprocessor to give a system which can be used
for control, additional chips are necessary, for example:
– Memory devices for program storage

– Input/output ports to allow it to communicate with the


external world and receive signals from it.

• MICROCONTROLLER is the integration of a


microprocessor with memory and input/output interfaces,
and other peripherals such as timers, on a single chip.

• Intel 8051, Motorola 68HC11 are examples of 8-bit


microcontrollers in that the data path is 8-bits wide.
Microcontroller Unit (MCU)
Block Diagram

• An integrated electronic computing and logic device that includes three major
components on a single chip.
– Microprocessor

– Memory

– I/O ports

• Includes support devices


– Timers

– A/D converter

– Serial I/O

• All components connected by common communication lines called the system


BUS.
A SINGLE CHIP MICROCONTROLLERS

4
MICROCONTROLLERS –
Embedded Systems

• An embedded system is a special-purpose computer system designed to


perform one or a few dedicated functions often with real-time.

• An integrated device which consists of multiple devices

– Microprocessor (MPU)

– Memory

– I/O (Input/Output) ports

• Often has its own dedicated software.


Microprocessor Vs Microcontroller

MICROPROCESSOR MICROCONTROLLER
• CPU is stand-alone, RAM, • CPU, RAM, ROM, I/O and timer
ROM, I/O, timer are separate are all on a single chip
• designer can decide on the • fix amount of on-chip ROM, RAM,
amount of ROM, RAM and I/O ports
I/O ports. • for applications in which cost,
• expansive power and space are critical
• versatility • single-purpose
• general-purpose
8051 MICROCONTROLLER

• 4K bytes internal ROM

• 128 bytes internal RAM

• Four 8-bit I/O ports (P0 - P3).

• Two 16-bit timers/counters

• One serial interface

CPU RAM ROM


A single chip
I/O Serial Microcontroller
Timer COM
Port
Port
Block Diagram - 8051 Microcontroller
External 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
Comparison of the 8051 Family Members
8051- Pin out Diagram

P1.0 1 40 Vcc

P1.1 2 39 P0.0(AD0)

P1.2 3 38 P0.1(AD1)

P1.3 4 37 P0.2(AD2)

P1.4 5 36 P0.3(AD3)
Ext
Memory
P1.5 6 8051 35 P0.4(AD4) Address

P1.6 7 34 P0.5(AD5)

P1.7 8 33 P0.6(AD6)

RST 9 32 P0.7(AD7)

(RXD) P3.0 10 31 EA/VPP


(Serial)
Ext Memory
(TXD) P3.1 11 30 ALE/PROG Access Control

(INT0) P3.2 12 29 PSEN


interrupt
(INT1) P3.3 13 28 P2.7(A15)

(T0) P3.4 14 27 P2.6(A14)


Timer
(T1) P3.5 15 26 P2.5(A13)

(WR) P3.6 16 25 P2.4(A12)


Ex M W/R
(RD) P3.7 17 24 P2.3(A11) Ext Memory
Address

XTAL 2 18 23 P2.2(A10)
clock
XTAL 1 19 22 P2.1(A9)

GND 20 21 P2.0(A8)
IMPORTANT PINS (IO Ports)

• One of the most useful features of the 8051 is


that it contains four I/O ports (P0 - P3)

• Port 0 (pins 32-39):P0(P0.0~P0.7)


– 8-bit R/W - General Purpose I/O
– Or data bus for external memory design

• Port 1 (pins 1-8) :P1(P1.0~P1.7)


– Only 8-bit R/W - General Purpose I/O

• Port 2 (pins 21-28):P2(P2.0~P2.7)


– 8-bit R/W - General Purpose I/O
– Or address bus for external memory design

• Port 3 (pins 10-17):P3(P3.0~P3.7)


– General Purpose I/O
– if not using any of the internal peripherals
(timers) or external interrupts.

• Each port can be used as input or output (bi-


direction)
Port 3 Alternate Functions
IMPORTANT PINS

• EA: The EA (External Access) pin is used to control or execute the internal or external memory

access. The signal 0 is for external memory access and signal 1 for internal memory access. It is an
input pin which indicates that the code is stored externally.

• PSEN: The PSEN' Program Store Enable, If external ROM (memory) is used for storing program
then a logic zero (0) appears on it every time the microcontroller reads a byte from memory. This is
an output pin which is used to read from external program memory.

• ALE: The ALE (Address Latch Enable) activates the port 0 joined with port 2 to provide 16 bit
external address bus to access the external memory.

• XTAL1 & XTAL2: Crystal inputs for internal oscillator on Port 3.


SYSTEM CLOCK & OSCILLATOR CIRCUITS

• The 8051 requires an external oscillator circuit. The oscillator circuit


usually runs around 12MHz, the crystal generates 12M pulses in one second.
The pulse is used to synchronize the system operation in a controlled pace..

• A MACHINE CYCLE is minimum amount time a simplest machine


instruction must take.

• An 8051 machine cycle consists of 12 crystal pulses (clock cycle).


SYSTEM CLOCK & OSCILLATOR CIRCUITS…

The first 6 crystal pulses (clock cycle) is used to fetch the opcode and the
second 6 pulses are used to perform the operation on the operands in the
ALU.
XTAL2

Crystal

XTAL!

GND

Crystal to 8051 XTAL 1/2


MACHINE CYCLE
 Find the machine cycle for
(a) XTAL = 11.0592 MHz
(b) XTAL = 16 MHz

Solution:
As we know that 1-Machine Cycle = 12 Crystal Pulses
(a) 11.0592 MHz / 12 = 921.6 kHz
machine cycle = 1 / 921.6 kHz = 1.085 s
(b) 16 MHz / 12 = 1.333 MHz;
machine cycle = 1 / 1.333 MHz = 0.75 s

Das könnte Ihnen auch gefallen