Professional Documents
Culture Documents
Embedded Systems: Campus Training On
Embedded Systems: Campus Training On
Campus Training
on
EMBEDDED SYSTEMS
(08th June - 10th June 2009)
By
Siva Prasad M
Application Engineer, VLSI & Embedded group
Microcontroller
• Microcontroller is a device which integrates number of
components of a microprocessor system onto a single chip. It
typically includes:-
CPU (Central Processing unit)
RAM & ROM
I/O inputs & outputs – Serial & Parallel
Timers
Interrupt Controller
By including the features that are specific to the task
(Control) , Cost is relatively low.Microcontroller are a “one chip
solutions” which drastically reduces parts count and design
costs.
String Technologies, Hyd
Microcontroller
Microcontroller
I/O Interfaces
• In an embedded system I/O interfaces are responsible for controlling or
monitoring the functionality. Following are the typical interfaces found in an
embedded system
• Digital Interface
– Digital input and output lines
• Analog interface
– Analog input and output channels
• Serial interface
– RS-232, RS-485, I2C,CAN,SPI
• LAN Interface
• Display Interface
– LCD,LED String Technologies, Hyd
Microcontroller interfaces
Microcontroller interfaces
• Motorola 6811
• Intel 8051
• Microchip 16Fxx
• Zilog Z80
• Intel
• Atmel
• Philips
• Siemens
• Dallas
• Maxim
• Sharp and many more…
String Technologies, Hyd
8051 Architecture
2 16-bit timer/counters;
Block Diagram
External interrupts
4K ROM
Interrupt program 128 bytes Timer0 Counter
Control code
RAM Timer1 Inputs
CPU
Bus Serial
4 I/O Ports Port
OSC Control
P1.0 1 40 Vcc
P1.1 2 39 P0.0(AD0
8051 P1.2 3 38 ) 0.1(AD1)
P
B1
String Technologies, Hyd
Read pin
Pins of 8051
C1
XTAL1
30pF
GND
XTAL Connection to
External Clock Source
NC XTAL2
GND
(Address - 0E0h)
• 8 - Bit Register
• Used for operations such as
• Addition
• Subtraction
• Multiplication
• Division &
• Bit Manipulations
(Address - 0F0h)
(Address - 0D0h)
• 8 - Bit Register
• Consists of 5 FLAGS
• 4 MATH FLAGS
• Carry
•Auxiliary Carry
• Parity
• Overflow
• 1 USER DEFINED FLAG
(Address - 81h)
• 8 - Bit Register.
• Stack Pointer is Initialized to 07h at RESET condition.
• Instructions such as PUSH and POP modify SP.
• UP - GROWING stack.
• Can be reinitialized to any desired location by the user.
• 16 - Bit Register
• Used to hold the Address of external Data Memory.
• Can be used as two individual 8 - bit registers such as
• Data Pointer High (DPL) - Address 82h
• Data Pointer Low (DPH) - Address 83h
• 16 - Bit Register
• Used to hold the Address of the next instruction to be executed
• Not directly accessible to the programmer.
• No internal address.
• Accumulator - A*
• Register B - B*
• Program Counter - PC
• Data Pointer - DPTR
• Stack Pointer - SP
• Program Status Word - PSW
• Ports - P0* , P1* , P2* , P3* .
• Timer Load Registers - TL0/1 & TH0/1
• Timer Config. & Ctrl Reg. - TCON*, TMOD
NOTE:
Registers marked with * are both Bit as well as Byte Addressable
• Address Bus,
• Data Bus, &
• Control Bus.
• Address Bus,
• Data Bus, &
• Control Bus.
PORTS ADDRESS
PORT 0 080h
PORT 1 090h
PORT 2 0A0h
PORT 3 0B0h
Port 0
A0-A7
ALU PSW SFR
D0-D7
Port 1
I/O
A B
Port 2
I/O
A8-A15
DPTR
PC
DPH ROM
I/O
Port 3
DPL INT
CNTR
SERIAL
RD/WR
Campus training www.unistring.com
Tuesday,
12/07/21
NITW 09:06
December
PM 7, on 39
www.stringtechnologies.net
2021 EMBEDDED SYSTEMS
12/07/21 09:06 PM
~EA
ALE System Timing BYTE / BIT SFR
ADDRESSIBLE
PSEN IE
System Interrupt
XTAL1
Timers RB3 IP
XTAL2
PCON
RESET RB2
Data Buffers SBUF
VCC Memory Controls RB1
SCON
GND
RB0 TCON
TMOD
TL0
TH0
TL1
TH1
SP
81
DPTR
DPH DPL PC
83 82
7 TF1 Timer 1 Overflow flag. Set when timer rolls from all 1s to 0. Cleared when processor
vectors to execute interrupt service routine located at program address 001Bh.
8 TR1 Timer 1 run control bit. Set to 1 by program to enable timer to count; cleared to 0 by program to
halt timer. Does not reset timer.
9 TF0 Timer 0 Over flow flag. Set when timer rolls from all 1s to 0. Cleared when processor
vectors to execute interrupt service routine located at program address 000Bh.
10 TR0 Timer 0 run control bit. Set to 1 by program to enable timer to count; cleared to 0 by program to
halt timer. Does not reset timer.
11 IE1 External interrupt 1 Edge flag. Set to 1 when a high-to-low edge signal is received on port 3 pin
3.3 (INT 1). Cleared when processor vectors to interrupt service routine located at program
address 0013h. Not related to timer operations.
12 IT1 External interrupt 1 signal type control bit. Set to 1 by program to enable external interrupt 1 to
be triggered by a falling edge signal. Set to 0 by program to enable a low-level signal or external
interrupt 1 to generate an interrupt.
13 IE0 External interrupt 0 Edge flag. Set to 1 when a high-to-low edge signal is received on port 3 pin
3.2 (INT 0). Cleared when processor vectors to interrupt service routine located at program
address 0003h. Not related to timer operations.
0 IT0 External interrupt 0 signal type control bit. Set to 1 by program to enable external interrupt 0 to
be triggered by a falling edge Campus
signal. Set training
to 0 by program to enable a low-levelwww.unistring.com
signal or external
12/07/21
Tuesday,
NITW 09:06
December
PM 7,0 to generate an interrupt. on
interrupt 43
www.stringtechnologies.net
2021 EMBEDDED SYSTEMS
12/07/21 09:06 PM
7/3 Gate OR gate enable bit which controls Run/ Stop of timer
6/2 C/T Set to 1 by program to make timer act as counter
5/1 M1 Mode select bit 1
4/0 M0 Mode select bit 0
M1 M0 Mode
0 0 0
0 1 1
1 0 2
1 1 3
Accessible by direct
& indirect addressing
(00-7F)=128 bytes
Thus,
4 - register banks => 32 bytes
1 bit addressable area => 16 bytes
1 scratch pad area => 80 bytes
128 bytes of
INTERNAL RAM
0FFFh
4 Kbytes of
Internal
ROM
0000h
Campus training www.unistring.com
12/07/21
NITW 09:06 PM String Technologies,
on Hyd 56
www.stringtechnologies.net
EMBEDDED SYSTEMS
56
12/07/21 09:06 PM
ADD-H
8051 Memory
Latch ADD-L
FFFFh
FFh
SFR’s
Direct
Addressing
64 Kbytes
only
80h of
External
7Fh Direct Memory
& In Direct
Addressing
only
00h
0000h
Program Memory
64K FFFFH
4K External
0FFFH ROM
EA=0
Internal
ROM
EA=1
0000H 0000H
Data Memory
64K FFFFH
128 bytes
External
7FH RAM
Internal
RAM
00H 0000H
0 1 1 08H-0FH
1FH 20H
Register Bank3
18H 17H
Register Bank2
0FH 10H
FFH FFH
Upper Accessible
Accessible SFR
128 by Indirect by Direct
addressing addressing
only Ports,
only
Timers,
Control
Registers,
80H 80H
Accumulator
7FH
,Stack
Pointer,
Accessible
Etc,.
by Direct &
Lower Indirect
128 addressing
00H
Campus training www.unistring.com
NITW 12/07/21
12/07/21 09:06 PM09:06 PM on 66
www.stringtechnologies.net
EMBEDDED SYSTEMS
66
12/07/21 09:06 PM
FF
F8
F7
F0 B
EF
E8
E7
E0 ACC
DF
D8
D7
D0 PSW
CF
C8
C7
C0
IP BF
B8
P3 B7
B0
IE AF
A8
P2 A7
A0
SCON SBUF 9F
98
P1 97
90
TCON TMOD TL0 TL1 TH0 TH1 8F
88
P0 SP DPL DPH PCON 87
80
Campus training www.unistring.com
12/07/21
NITW 09:06 PM String Technologies,
on Hyd 67
www.stringtechnologies.net
EMBEDDED SYSTEMS
67
12/07/21 09:06 PM
External
External
(64Kb)
indirect direct
(128) (128)