Professional Documents
Culture Documents
Adobe Scan 04-Jul-2023
Adobe Scan 04-Jul-2023
an detect
signals
SSors are Temipofary Ihstriciói WReg ZReg
Accumülatör register
Elao realster register FBRég Reg
DReg EReg
The CALL instruction is used to transfer program control to a subprogram or flag is set.
and loads the
subroutine. This instruction pushes the current PC contents onto the stack
stored in the W and Z
given address into the PC. The given address is temporarily control is
Thus the program
registers and placed on the bus for the fetch cycle.
instruction exchanges the
transferred to the address given in the instruction. XCHG
and Z registers are used
contents of H with D and L with E. At the time of exchange W c) Instruc
for temporary storage of data. opcode of
memory r
1, General purpose registers : The CPU
B, C, D, E, H and L are 8-bit general
purpose registers can be used as a separate 8-bit further se
and HL, HL pair also functions as a data
registers or as 16-bit register pairs BC, DE d) Progra
pointer or memory pointer. earlier, m
2. Special purpose registers : sequentia
stores the
tri-state eight bit register. It is extensively used in
a) Register A (Accumuiator) : It is a operations, as well as in, input/output (I/0)
the PC
arithmetic, logic, load and store logical operations is stored in processO
and
operations. Most of the times the result of arithmetic byte ins t
as accumulator.
the register A.. Hence it is also identified incremer
the
It is an 8-bit register, in which five of
b) Flag Register (Program status word) :
counter
flags : S (Sign flag), Z (Zero flag), AC
bits carry significant information in the form of instructic
flag), as shown in Fig. 2.2.3.
(Auxiliary Carry flag), P (Parity flag), and CY (Carry e) Stack
Dy D6 Ds D4 D P2 D1 D
tempora
S of the m
Fig. 2.2.3 Flag register
operations, if bit D, of the
S-Sign flag : After the execution of arithmetic or logical
2:2.2
the number will be viewed as
result is 1, the sign flag is set. In a given byte if D, is 1, The
as positive number.
negative number. If D, is 0, the number will be considered arithme
ALU is zero and flag
Z-Zero flag : The zero flag sets if the result of operation in subtrac
register content becomes and E
resets if 'result is non zero. The zero flag is also set if a certain
decisio
zero following an increment or decrement operation of that register.
i.e.,
AC-Auxiliary Carry flag: This flag is set if there is an overflow out of bit 3 2.2.3
BCD
carry from lower nibble to higher nibble (D bit to D, bit). This flag is used for
operations and it is not available for the programmer. The
P-Parity flag : Parity is defined by the number of ones present in the accumulator. timing
After an arithmetic or logical operation if the result has an even number of ones, Th
about
i.e. even parity, the flag is set. If the parity is odd, flag is reset. IO/M
he instruction
oder decodes Registers
it.
Tempa
sor performs réglster-s,
Ternp Parallel
regiater Accumulator
lusive - OR. 6pors
General
purpose
4 gives data registers
rd is sent to Stack
ALU; pointer Serial
e result is
Program
Counter
of certain
ations are StatuS hstructöp
tegister register
eferred to
iterupt
rts of the RAM
address Rrogram
different addres
egistr
struction egister
struction and,
contro cOunter
Internal memory
Fig. 1.4.1 Block diagram of
ReviewQuestion microcontroller
1. Draw and explain the block
diagram ofa microcontroller.
cient. 1,5. Comparison between Microprocessor and Microcontroller
OM), GTU Winter-15,19
orts
Sr. NoR
Microproressof Microontroller
ler
lso d4Miregister
roprocesso
clockand
kand
COntains ALUUcontol únirMictoconrolletcont
ContainsueroprocesS
he
nd
and timingcircait)differentmenory
interrúpt (ROM arnd
circuit.,rcuit and peripheralRAM),deyices
I/O nterfactng
such as
28 AD cOnvee serjal Gtimer etc
tö movex dataIthas one
hetwpermémov ándCPUg or two
gata between mentoty nstritctons
attlcpU
tomove
X
4oVcc
39HOLD
Sariall sID
ports
RESET OUTI sDNetHLDA signas
initiated
Extemally
SOD
SID 5kd
37CLK(OUT)
36 RESET IN
TRAP
RST 7.5
TRAPC6U38READY RST 6.6
RST 5.5
RST 7.5 C 7 3 a O o M INTR Ko Kadarosaa
RST 6.5 C8ax33s,
READY
RST 5.59 32 RD HOLD
INTR 1
808BA
WR RESETIN
acknowiedgment
slgnal
External -ALE
INTA C17k2130ALE -So Control
AD, 2 29 S INTA and
HLDA 10/M status
AD, JA1s -RD signals
AD, WR
signals
Clock
AD,C152g A3 ReseloutJ
AD,16 O25DA12 Power
Vcc(+ 5v) supply
ADs ,24A11 CLKOUT GND
ADA18 23A40
AD,9. 220Ag
Vss 20. 21A
Fig. 2.3.1 (a) Pin configuration Fig. 2.3.1 (b) Functional pin diagram
b) Data bus and address bus
a) Power supply and frequency signals.
c) Control bus d) Interrupt signals
e) Serial I/0 signals ) DMA signals
g) Reset signals
Signals
2.3.3 Control and Status
: We know that AD, to AD, lines are
A) ALE (Address Latch Enable) (Output) during T, of the
of address (Ao Az) is available only
multiplexed and the lower half
necessary during T, and T, of machine
machine cycle. This lower half of address is also lower half
memory or I/0 port. This means that the
cycle to access specific location in available
address must be latched in T; of the machine cycle, So that it is
of an done by
of lower half of an address bus is
throughout the machine cycle. The latching
ALE signal from 8085.
using external latch and
and WR (Output) : A low on RD indicates that the data must be read from
B) RD indicates that the
selected menmory location or I/0port via data bus. A low on WR
the
memory location or I/0 port via data bus,
data must be written into the selected
indicates whether I/0 operation or memory
C) 1O /M S, and S, (Output) : I0/M
carried out. &; and Sp indicate the type of machine cycle in progress.
operation is being
microprocessor to sense whether a peripheral is
D) READY (Input):It is used by the processor waits. It is thus used to synchronize
the
ready or not for data transfer. If not,
slower peripherals to the microprocessor.
2.3.4 Interrupt Signals
5.5,
five hardware interrupt signals : RST
Hardware Interrupts (Input) : The 8085 has
RST 7.5, TRAP and INTR. The microprocessor recognizes interrupt requests on
RST 6.5,
instruction execution.
these lines at the end of the current
: The INTA (Interrupt Acknowledge).signal is used to indicate that
INTA (0utput)
interrupt.
the processor has acknowledged an INTR
knowladge
TECHNICAL PUBLICA TIONS-An up thrust for
MiaroproceSSors and Microcontrollers 2- 11 8085 MicroproceSSor Architecture
instructions.
mnchine control
13. Giue exenples for instructions, arithmetic instructions, logic instructions and
14. Give luo exanples for data transfer
branch instructions. microprocessoT.
suitable examples the data transfer instructions in 8085
15. Describe toith explaining about the various types of
operations.
the 8085 instruction st,
16. Disc1uss in detail about
4.3 Addressing Modes
.and
programming flexibility for each microprocessor is the number
Part .of .the memory. The
different kind of ways the programner can refer to data stored 'in the
addressing
access -data are referred to as
ditterent way3 that a microprocessor can
modes. The 8085 has 5 addressing modes. These are :
1. Immediate 2. Register
3. Direct 4. Indirect
5. Inplied
1. 1mmediate addressing mode :
in an immediate addressing mode, 8 or 16 bit data can be specified as a part of
instruction. In 8085, the instructions having T letter fall under this category. T indicates
immediate addressing mode.
Example
MVI A, 20H Moves 8 bit immediate data (20H) into accumulator
MVI M, 30H ;Moves 8 bit immediate data (30H) into the
;memory location pointed by HL register pair.
LXI SP, 2700H ; Moves 16 bit immediate data (2700H) into SP.
LXI D, 10FFH ;Moves 16 bit immediate data (10FFH) into DE
-;register pair (D= 10H and E = FFH).
2. Register addressing mode:
The register addressing mode specifies the source operand, destination operand, or
both to be contained in an 8085 registers. This results in faster execution, since it is not
necessary to access memory locations for operands.
Example :
MOV A, B :Moves the contents of register Binto the accumnulator.
SPHL ;Moves the contents of HL registerpair into stack pointer.
ADD C ;Adds the contents of register C into the contents of accumulator
;and stores result in the accumulator.
CLK
PCH PC=PC+
BgArdeVUnspe
A1s-Ag VMemony Addre
PC,
AD, -ADo
ALE
RD
r Instruction
Fig. 5.2,1 Timing dlagram for MOV r,
TECHNICAL PUBLICATIONS An up thrust for knowledge
A o e o r enc ARAOrOntler aO85 Timing Diagrams
6- 21 BOBS Timing Disgrans Mlctoproce tsors onc Microcontrotarn 5-22
2. Memory read :This machine cycle reads the data from addressed memory location Review Question
into specified register of the microprocessor.
1, Draw and e
OPCODE FETCH MEMORY READ
T4 T2 T 5.4 Timing
This instructio
CLK address is given
PC =PC:1 POA PC* PC + 1
1. Opcode fe
address bus.The
A15-Ag ghordar
Memory Address eciaMecnoty Accress the microproces
PCL PCL
Program counter
AD,- ADo Eow-order:
Nemory Opcode Low-Qrdafke: MVIAdala 3E 2. Memory
AddreS5 Data MVIBdata.06 high order add
MMCdata' oEr
MVID, data 16*
MVILE dala 1E
addressed outp
ALE MVIH; data 26
MVI Ly.dala 2E
Table 5.3.1
10/M S, - So joM=0,S=1, S,3jOIM=0,s-0,
SX A
RD
AD
Fig. 5.3.1
ins Fig. 5.3.1 shows the timings required for different signals. Table 5.3.1 gives the
instructions for which the timing diagrams are same. Only difference is in opcode.
AC
dat ACI, data.. ADI, data.. ANI, data.. CPI, data.. ORI, data.. SBI, data.. SUI, data., XRI,
data..
con These instructions perform logical operation specified in the instruction with the
contents of accumulator and the data within the instruction. They require the following
machine cycles.
1. Opcode fetch : Program counter gives the memory address on low-order and
high-order address bus. This machine cycle is required for reading the opcode into
2 Review Q
the microprocessor and decode it. Program counter is incremented by one.
2. Memory read : This machine cycle reads the data from addressed memory location 1. Dre
and after performing specified logical operation result is stored in the accumulator.
Flg. 6.2.2
The 8051 consists of following flags.
CY-Carry Flag : This flag is set if there is an overflow out of bit 7. The
also serves as a borrow flag for carry flag
subtraction. In both the examples shown below,
the carry flag is set.
AC-Auxiliary Carry Flag : This flag is set if there is an overflow out of bit 3 i.e.,
carry from lower nibble to higher nibble (D, bit to D, bit).
ADDITION
SUBTRACTION
9B H 1001 1011
+ 75 H 89 H 1000 1001
+ 0111 0101 AB H
Carry 110 H 10001 0000 1010 1011
Borrow 1 DE H n1101 1110
" FO -
Available for user for general purpose.
Even though there are 128 memory locations intended to be occupied by them, the
ba
basic core, shared by all types of 8051 microcontrollers, has only 21 such registers. Rest
of of locations are intentionally left unoccupied in order to enable the
fu manufacturers to
further develop microcontrollers keeping them compatible with the previous versions.
Fig. 6.2.3 shows special function bit addresses.
Direct Hardware
Bit address
byte registar
address
(MSB) (LSB) symbol
OFFH
OFOH
7 0 F5 F4F3F2 EFO B
OEOH ACC
OB8H IP
OA8H AC AB AA Ae A8 IE
OAOH AZAB A5 A4 AO P2
SCON
90H P1
Voc + 5V
PO.O (A DSN
ROAD
POR tAD)
Port 1
Port 0
PO4 ADA
RO5AD
RST
P3.C(RXDi EA (Vpp)
ALE (PROG)
R3.2 NTO
PSEN
Port 3 28
P25 (A13)
M6
Port 2
Oscillator
signals
9
GND
Fig. 6.3.1
Pin-out of 8051
The 8051 has 32
I/O
aio 3). AlI four ports arepins configured as four eight-bit parallel ports (P0, P1, P2
output (or both). All bidirectional ie. each pin willI be configured as nput
port-pins are
consists of a latch, an output multiplexedexcept the pins of port 1. Each port
Port 0 driver and an input
(Pins 3239) : Port 0
input buffers
buffer.
byte of-the of port Oare used topins can be used as I/O pins. The output drives and
external0 can memory access external memory. Port 0outputs the low order
read. Thus, port
Port (Pins 1 -8) :
1 address,time
be used as a mltiplexed with the data being written or
multiplexed address//data
data bus.
Port 2(Pins 21 Port 11 pins can be
ontroller Architecture Mieroprocessors nnd Mieroeortroters 4051 Microeontroller Architecture
Summer-16, 18 Byte
addres8
ss up to 64 K ayte
addrass
aternal program 1E
1D
Bank 3
1B
19
18
17 B
16 R
16
14
Bank 2
13
12 R
11
10 B, B B, 8, B B, 8,
OF
0E
0D 68
0C
Bank 1
0B
OA
08
07
06 37G534s33
05
Bank 0
04
272625
03
02 R
01
00
5. Explan full duplex, half duplex and smplex serial data transfer.
6. WAat is asynchronous serial communication ?
7. Explain the format of asynchronous serial communication.
8. Exzriain the function of RS232C pins of DB-9 connector.
Fig. 10.3.1
The way in which SBUF is used for the transmission and reception of the data during
erial communication is explained below.
Transmission : When a byte of data is to be transmitted via the TxD pin, the
SBUF is loaded with this data byte. As soon as a data byte is written into SBUF, it
is framed with the start and stop bits and transmitted serially via the TxD pin.
Reception : When 8051 receives data serially via RxD pin of it, the 8051 deframes
it. The start and stop bits are separated out from a byte of data. This byte is
placed in SBUF register.
t pattern of $CON register
The 8051 provides four programmable modes for serial data comnunication. A
articular mode can be selected by setting the SM0 and SM1 bits in SCON. The mode
lection also decides the baud rate. The Fig. 10.3.2 shows the bit patterns for SCON.
SMSSCON6Serlapàrt Mbde?cortoebia
SM2
artwarototspentotoraneftK
saON4
orenblectBaeserialtdaa
SCONT RrarSiitnergyprag
SetbyhEateeA
SCON0REeronfarrubis
Barcway
Noleae ofSMOsM1 28eectswP
if (sW==0)
TECHNICAL PUBLICATIONS An up thrust lor knowiedge TECHNICAL PUBLICATIONS-An up thrust for knowBedge
Microprocosaora ond Mlcrocontrollers 13-0 Appllcatlons ond Dotlgn of Mlerocontroler Basod Systams
Review Questions
1. What is sourcing and sinking currents ?
2. With adiagram explain how LED can be tnterfaced to 8051.
13.2 Interfacing Multiplexed 7-Segment Display
GTU Winter.07,13,15,19, Summer-16,17,18
Seven-segment display : Seven-segment displays are generally used as mumerical
indicators. and consists of a number of LEDs
arranged in seven-segments as shown in the
Fig. 13.2.1.
Any number between 0 and 9 can be indicated Dh
by lighting the appropriate segments. Fig. 13.2.1 Seven-segment display
The seven-segments are labelled to g and dot is
labelled as h. By forward biasing different LED segments, we can display the digits 0
through 9. For instance, to display 0, we need to light up a, b, c, d, e, and . To light up
5, we need segiments a, f, g, Cand d.
e
Dh Oh
Dh Oh
d d
C E G
A
Subr
AGA
Fig. 13.2,6
P3.3
P3.4
w
0
K,
8051
Input K5
3kR 28
TUUTUTUUUUID 4 Analog
Analog inputs
5
inputs
6
Address
SOC !
EOC ALE
0808/
DB3 DB7
OUTPUT CONTROL DB6
CLK DB5
Voc DB4
REF + DBO
GND 6) REF
DB1 DB2
OE