3 1 FinalPresentatio Lecturematerial 4 5 6 EMBEDDED
3 1 FinalPresentatio Lecturematerial 4 5 6 EMBEDDED
July 2021
Students are requested to refrain from using these learning resources outside this domain
• Hardware :Interface to
CPU: Central Processing Unit
the real world I/O: Input /Output
Bus: Address bus & Data bus
Memory: RAM & ROM
Timer
Interrupt
Serial Port
• Software : to handle Parallel Port
with inputs ADC/DAC
A smaller computer
On-chip RAM, ROM, I/O ports...etc….
Example:Motorola’s 6811, Intel’s 8051, Zilog’s Z8 and Microchip’s PIC16X
Expensive but versatile and supports general-purpose Ideal for stand alone dedicated applications where
applications . (ex. SLV control) cost, power and space are critical. (ex Washing
machine)
Several op codes for external memory access Limited instructions to access external memory
Complex but rich instruction set Simple lean instruction set (but increased programmer
overhead)
Involves rapid data /code movement between chip Involves rapid bit/byte movements inside chip
and external memory locations
CPU
Bus Serial
4 I/O Ports
OSC Control Port
P0 P1 P2 P3 TxD RxD
Address/Data
P1.0 1 40 Vcc
P1.1 2 39 P0.0(AD0)
P1.2 3 38 P0.1(AD1)
P1.3
P1.4
4
5
8051 37
36
P0.2(AD2)
P0.3(AD3)
P1.5 6 (8031) 35 P0.4(AD4)
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
(TXD)P3.1 11 30 ALE/PROG
(INT0)P3.2 12 29 PSEN
(INT1)P3.3 13 28 P2.7(A15)
(T0)P3.4 14 27 P2.6(A14)
(T1)P3.5 15 26 P2.5(A13)
(WR)P3.6 16 25 P2.4(A12)
(RD)P3.7 17 24 P2.3(A11)
XTAL2 18 23 P2.2(A10)
XTAL1 19 22 P2.1(A9)
GND 20 21 P2.0(A8)
Port
8051 P0.1
P0.2
8751 P0.3
P0.4 0
8951 P0.5
P0.6
P0.7
DR BINU PAUL , EMBEDDED SYSTEM LECTURE 5-6 9/6/2021 16
PORT 3 ALTERNATE FUNCTIONS
P3.0 RxD 10
P3.1 TxD 11
P3.2 INT0 12
P3.3 INT1 13
P3.4 T0 14
P3.5 T1 15
P3.6 WR 16
P3.7 RD 17
+
10 uF
31
EA/VPP
30 pF X1
19
11.0592 MHz
8.2 K
X2
18
30 pF
9 RST
DR BINU PAUL , EMBEDDED SYSTEM LECTURE 5-6 9/6/2021 18
Registers Address
A 0E0h
B 0F0h
PSW 0D0h
SP 81h
DPTR(h) 83h
DPTR(l) 82h
R0-R7 Depending on Banks
IP 0B8h
PSW format IE 0ABh
CY AC F0 RS RS OV x P P0-P3 80h,90h,0A0h,0B0h
1 0
SCON 98h
RS1 RS0 selection
00 Bank 0
SBUF 99h
8k
1FFFH 32k
4k 7FFFH
0FFFH
0000H DS5000-32
0000H
8051, 8751
AT89C51
8752
0000H
AT89C52
64kbytes
60kb
4kb
30H
2FH
Bit-Addressable RAM
20H
1FH
Register Bank 3
Stack and Bank 1 18H
clash occurs on reset, 17H
10H
Register Bank 2
As SP on reset
0FH (Register Bank 1
points at 07h
08H
07H Register Bank 0
00H
DR BINU PAUL , EMBEDDED SYSTEM LECTURE 5-6 9/6/2021 23
STACK OF 8051 ( SP REGISTER HAS ADDRESS 81H)
The register used to access
the stack is called SP (stack
7FH
pointer) register.
Scratch pad RAM
30H
The stack pointer in the
2FH
8051 is only 8 bits wide, Bit-Addressable RAM
which means that it can 20H
take value 00 to FFH. 1FH Register Bank 3
When 8051 powered up, 18H
17H
the SP register contains 10H
Register Bank 2
◼ Hexadecimal
◼ Binary
◼ BCD
MOV DPTR, A
MOV Rm, Rn
MOV A,#65H
MOV R6,#65H
MOV DPTR,#2343H
MOV P1,#65H
SETB C ; CY=1
SETB P0.0 ;bit 0 from port 0 =1
SETB P3.7 ;bit 7 from port 3 =1
SETB ACC.2 ;bit 2 from ACCUMULATOR =1
SETB 05 ;set high D5 of RAM loc. 20h
Note:
CLR instruction is as same as SETB
i.e.:
CLR C ;CY=0 (CY flag)
INC R7
DEC A
DEC 40H ; [40]=[40]-1
Data Transfer
Arithmetic
Program Control
Conditional Jumps
JZ addr Jump if A=0
JNZ addr Jump if A≠ 0
DJNZ Reg, addr Decrement and jump if Reg ≠0
CJNE A,byte,addr Jump if A≠ byte
CJNE reg, #data, Jump if byte ≠ #data
addr
JC addr Jump if CY=1
JNC addr Jump if CY=0
JB bit, addr Jump if bit=1
JNB bit, addr Jump if bit=0
JBC bit, addr Jump if bit=1 and clear bit
Up counting
16 bit counters (can be configured as 13 bit or 8 bit also)
TH0 8Ch
TL0 8Ah
TH1 8Dh
TL1 8Bh
Count Address
registers
TH0 8Ch
TL0 8Ah
TH1 8Dh
TL1 8Bh
Interrupt
service
routine
EA : Global enable/disable.
--- : Undefined.
ET2 :Enable Timer 2 interrupt.(in 8052/ reserved in 8051)
ES :Enable Serial port interrupt.
ET1 :Enable Timer 1 interrupt.
EX1 :Enable External 1 interrupt.
ET0 : Enable Timer 0 interrupt.
EX0 : Enable External 0 interrupt.
Note: Hard wired priority incase two interrupts with same s/w priority occurs is
Ps <PT1 <Px1 <PT0 <Px0
INT0 0003h
INT1 0013h
Thank You