Microprocessor and Interfacing ECX 4236 PDF
Microprocessor and Interfacing ECX 4236 PDF
G. S. Nadeera Meedin
B.Tech (Hons), AMIE(SL)
WHY Microprocessor and Interfacing
?
About the Course
Why do we need to learn
Microprocessor / Controllers ?
• The microprocessor is the core of computer
systems.
• Nowadays many communication, digital
entertainment, portable devices, are controlled by
them.
• A designer should know what types of
components he needs, ways to reduce production
costs and product reliable.
The necessary tools for a
Microprocessor / controller
• CPU: Central Processing Unit
• I/O: Input /Output
• Bus: Address bus & Data bus
• Memory: RAM & ROM
• Timer
• Interrupt
• Serial Port
• Parallel Port
Microprocessors :
General-purpose microprocessor
CPU for Computers
No RAM, ROM, I/O on CPU chip itself
Example:Intel’s x86, Motorola’s 680x0
A smaller computer
On-chip RAM, ROM, I/O ports...
Example:Motorola’s 6811, Intel’s 8051, Zilog’s Z8 and PIC
16X
Microprocessor Microcontroller
CPU is stand-alone, RAM, • CPU, RAM, ROM, I/O and
ROM, I/O, timer are timer are all on a single chip
separate • fix amount of on-chip ROM,
designer can decide on the RAM, I/O ports
amount of ROM, RAM and • for applications in which cost,
I/O ports. power and space are critical
expansive • single-purpose
versatility
general-purpose
Lab Organization
Lab 1 :
• Identify the basic functions available in the AES-51
development board.
• Run the self-test program and familiar with the each functions
of the AES-51 development board.
• Familiar with the 8052 simulator
• Assemble the programs written in Assignment #1 and
observe the results by using AES-51 development board.
Prerequisites
• An understanding of decimal,
hexadecimal and binary number
systems.
• Compiler : ASM 51
http://www.metaice.com/ASM51/ASM51.htm
• Simulator : 8052
http://www.vaultbbs.com/sim8052/download.php
First Assembly Program
Translation Process
ORG 0000H
MOV R0, #5
MOV A, #6
ADD A,R0
END
First Assembly Program : Assemble
First Assembly Program .LST file
CPU
Bus Serial
4 I/O Ports
OSC Control Port
P0 P1 P2 P3 TxD RxD
Address/Data
Pin Description of the 8051
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)
Types of Memory
On – Chip Memory
Registers
A
R0
DPTR DPH DPL
R1
R2 PC PC
R3
R5
R6
R7
7FH
The register used to access Scratch pad RAM
the stack is called SP
(stack pointer) register. 30H
2FH
Bit-Addressable RAM
The stack pointer in the 20H
8051 is only 8 bits wide, 1FH Register Bank 3
18H
which means that it can 17H
take value 00 to FFH. 10H
Register Bank 2
Conditional Jumps :
JZ Jump if A=0
JB Jump if bit=1
0 0 0 13-bit Timer.
0 1 1 16-bit Timer
1 0 2 8-bit auto-reload
1 1 3 Timer mode
TCON SFR
Bit Time
Bit Name Explanation of Function
Address r
Timer 1 Overflow. This bit is set by the
7 TF1 8Fh 1
microcontroller when Timer 1 overflows.
Timer 1 Run. When this bit is set Timer 1
6 TR1 8Eh is turned on. When this bit is clear Timer 1 1
is off.
Timer 0 Overflow. This bit is set by the
5 TF0 8Dh 0
microcontroller when Timer 0 overflows.
Timer 0 Run. When this bit is set Timer 0
4 TR0 8Ch is turned on. When this bit is clear Timer 0 0
is off.
TCON SFR
Bit Time
Bit Name Explanation of Function
Address r
Timer 1 Overflow. This bit is set by the
7 TF1 8Fh 1
microcontroller when Timer 1 overflows.
Timer 1 Run. When this bit is set Timer 1
6 TR1 8Eh is turned on. When this bit is clear Timer 1 1
is off.
Timer 0 Overflow. This bit is set by the
5 TF0 8Dh 0
microcontroller when Timer 0 overflows.
Timer 0 Run. When this bit is set Timer 0
4 TR0 8Ch is turned on. When this bit is clear Timer 0 0
is off.
Using Timers
• Initializing a Timer
Vcc
10 K
P0.0
Port
DS5000 P0.1
P0.2
8751 P0.3
8951 P0.4 0
P0.5
P0.6
P0.7
Course Summary
Learn a lot