You are on page 1of 25

Embedded Microcontroller

Systems

Prof. Cherrice Traver ECE/CS-352: Embedded Microcontroller Systems


Overview
• Basic components of digital computers
• Microcontrollers and Embedded Systems
• Applications and Common Microcontrollers
• The MCS-51 Family of Microcontrollers
• On-chip memory, registers
• On-chip facilities overview

Prof. Cherrice Traver ECE/CS-352: Embedded Microcontroller Systems


Basic Components of Digital
Computer

• CPU
• Memory Memory
• I/O CPU
I/O

Could be a chip, a
board, or several
boards
Prof. Cherrice Traver ECE/CS-352: Embedded Microcontroller Systems
Microcontrollers

Memory
ROM RAM
CPU

I/O

Subsystems:
Timers, Counters, Analog
A single chip Interfaces, I/O interfaces

Prof. Cherrice Traver ECE/CS-352: Embedded Microcontroller Systems


Embedded Systems

Prof. Cherrice Traver ECE/CS-352: Embedded Microcontroller Systems


Real Time Control

Must be able to respond


predictably and in a
known amount of time

Environment cannot wait


for microcontroller to
respond.

Prof. Cherrice Traver ECE/CS-352: Embedded Microcontroller Systems


Embedded System
General Block Diagram

Sensor conditioning

Output interfaces
sensor
actuator
Microcontroller
sensor
(uC) indicator
sensor

Prof. Cherrice Traver ECE/CS-352: Embedded Microcontroller Systems


Common Microcontrollers
•Atmel •Motorola
•ARM •8-bit
•Intel •68HC05
•8-bit •68HC08
•8XC42 •68HC11
•MCS48 •16-bit
•MCS51 •68HC12
•8xC251 •68HC16
•16-bit •32-bit
•MCS96 •683xx
•MXS296 •Texas Instruments
•National Semiconductor •TMS370
•COP8 •MSP430
•Microchip •Zilog
•12-bit instruction PIC •Z8
•14-bit instruction PIC •Z86E02
•PIC16F84
•16-bit instruction PIC
•NEC

Prof. Cherrice Traver ECE/CS-352: Embedded Microcontroller Systems


Microcontroller Architectures
Memory
0
Address Bus
Program
CPU Data Bus + Data Von Neumann
2n
Architecture
Memory
0
Address Bus
Program
CPU Fetch Bus Harvard
Address Bus 0
Architecture
Data Bus Data

Prof. Cherrice Traver ECE/CS-352: Embedded Microcontroller Systems


MCS-51 “Family” of
Microcontollers

• 8051 introduced by Intel in late 1970s


• Now produced by many companies in many
variations
• The most pupular microcontroller – about
40% of market share
• 8-bit microcontroller

Prof. Cherrice Traver ECE/CS-352: Embedded Microcontroller Systems


“Original” 8051 Microcontroller
Oscillator 4096 Bytes 128 Bytes Two 16 Bit
and timing Program Data Timer/Event
Memory Memory Counters

8051 Internal data bus


CPU

64 K Byte Bus Programmable Programmable


Expansion I/O Serial Port Full
Control Duplex UART
Synchronous Shifter
subsystem interrupts

External interrupts Control Parallel ports Serial Output


Address Data Bus Serial Input
I/O pins
Prof. Cherrice Traver ECE/CS-352: Embedded Microcontroller Systems
Review Binary/Hexidecimal
Decimal Binary Hexidecimal
0 0000 0 Conversions:
1 0001 1
2
3
0010
0011
2
3
1000 1110 (binary)
4 0100 4 8 E (hex)
5 0101 5
6 0110 6
7 0111 7 Notations for hex:
8 1000 8
9 1001 9
10 1010 A
0x8E
11 1011 B
12 1100 C 8Eh
13 1101 D
14 1110 E
15 1111 F 8E16

Prof. Cherrice Traver ECE/CS-352: Embedded Microcontroller Systems


On-Chip DATA Memory: RAM
Internal RAM

Prof. Cherrice Traver ECE/CS-352: Embedded Microcontroller Systems


1F
Registers
Four Register Banks
Bank 3 Each bank has R0-R7
18
17

Bank 2
10
0F

Bank 1
08
07 R7
06 R6
05 R5
04 R4
03 R3 Bank 0
02 R2
01 R1
00 R0

Prof. Cherrice Traver ECE/CS-352: Embedded Microcontroller Systems


Bit Addressable Memory
2F 7F 78 20h – 2Fh (16 locations X
2E 8-bits = 128 bits)
2D
2C
Bit addressing:
2B
mov C, 1Ah
2A
29
or
28 mov C, 23h.2
27
26
25
24
23 1A
22 10
21 0F 08
20 07 06 05 04 03 02 01 00

Prof. Cherrice Traver ECE/CS-352: Embedded Microcontroller Systems


Special Function Registers
DATA registers

CONTROL registers

•Timers
•Serial ports Addresses 80h – FFh
•Interrupt system
•Analog to Digital converter Direct Addressing used to
•Digital to Analog converter access SPRs
•Etc.

Prof. Cherrice Traver ECE/CS-352: Embedded Microcontroller Systems


On-Chip Memory: Program/Data

Prof. Cherrice Traver ECE/CS-352: Embedded Microcontroller Systems


8051 CPU Registers
A (Accumulator)
B
PSW (Program Status Word)
SP (Stack Pointer)
PC (Program Counter)
DPTR (Data Pointer)

Used in assembler
instructions

Prof. Cherrice Traver ECE/CS-352: Embedded Microcontroller Systems


On-Chip Facilities Overview
(Original 8051)

• Parallel Input/Output Ports


• System Clock Generator
• Serial Port
• Timers
• Interrupt Control

Prof. Cherrice Traver ECE/CS-352: Embedded Microcontroller Systems


Parallel I/O Ports
• Each port can be input or output
• Direction is set in Special Function Registers

Port0 Port1 Port2 Port3


latch latch latch latch

Port0 Port1 Port2 Port3

Prof. Cherrice Traver ECE/CS-352: Embedded Microcontroller Systems


System Clock Generator
External crystal oscillator

Input sysclk
circuit

8051
Original 8051 uses 12 sysclk cycles per “machine cycle”

Prof. Cherrice Traver ECE/CS-352: Embedded Microcontroller Systems


Serial Port (UART)
Original 8051 had one serial port

TX (transmit)
Serial
Port RX (receive)

Data sent and received serially


BAUD rate must agree between sender and receiver
Transmission modes selected using SFR

Prof. Cherrice Traver ECE/CS-352: Embedded Microcontroller Systems


Internal Timers
Original 8051 has 2 timers

16 bits 16 bits

TH0 : TL0 TH1 : TL1


Timer 0 Timer 1

Timers increment on each system clock


Timer registers (TH0, TL0, TH1, TL1) can be read or written to
Timer overflow can cause “interrupts” or set SFR bits high

Prof. Cherrice Traver ECE/CS-352: Embedded Microcontroller Systems


Interrupt Control

mov a, #2
mov b, #16
mul ab
mov R0, a
Program Execution

mov R1, b interrupt


mov a, #12 ISR: orl P1MDIN, #40h
mov b, #20 orl P1MDOUT,#40h
mul ab cpl P1.6
add a, R0
return
reti
mov R0, a
mov a, R1
addc a, b
mov R1, a
end

Prof. Cherrice Traver ECE/CS-352: Embedded Microcontroller Systems


Interrupt Control

Original 8051 has five sources of interrupts


• Timer 1 overflow
• Timer 2 overflow
• External Interrupt 0
• External Interrupt 1
• Serial Port events (buffer full, buffee empty, etc)

Interrupts enabled and disabled using SFR

Prof. Cherrice Traver ECE/CS-352: Embedded Microcontroller Systems

You might also like