You are on page 1of 19

Microprocessor Systems:

CPU on a single chip is called microprocessor. A


microprocessor is a Very Large Scale Integrated (VLSI) logic IC
whose logical function is controlled be an instruction code. This
instruction code is a specific combination of logic bits needed for a
microprocessor to execute its logic operations. These codes may
include instructions to perform logical, arithmetic or input/output
operations.
A microprocessor system is one type of computer system. All
computer systems have three basic functional blocks: a processing
unit, memory, and input/output. In practice these components are
connected together using either address bus, data bus or control
lines.
ASSEMBLY LANGUAGE CODE:

CNT EQU 03FD6H


APORT EQU 03FD0H
BPORT EQU 03FD2H

CODE SEGMENT

ASSUME CS: CODE


ORG 0

START: MOV AL, 90H


MOV DX, CNT
OUT DX, AL
J1: MOV DX, APORT
IN AL, DX
MOV DX, BPORT
OUT DX, AL
JMP J1

CODE ENDS

END START

 ASSEMBLER DIRECTIVES USED:

 What is assembler directive;

 These are just instructions for assemble having no code.

 EQU; assigns value to a variable


 Segment; it is used when we are going to start a
specific segment
 Assume; it tells the assembler to start the ‘cs ’
from the keyword ‘code (in this specific code)’
 Org; org directive allows to set the location
counter to a desired value at any point in the

Program. The statement ORG 2000H tells the


assembler to set the location counter to 2000H.
 ENDS/END; ‘end’ is used to terminate the
execution and ‘ends’ is used to to end the any
segment

LABEL:
A label is a symbol or group of symbols used to represent an address,
which is not known at the time the statement, is written.
PROGRAM ANALYZATON:

• CNT EQU 03FD6H:


It assigns ‘03FD6H’ to variable CNT.
CNT=03FD6H
• APORT EQU 03FD0H:
APORT=03FD0H
• BPORT EQU 03FD2H:
BPORT=03FD2H

• START: MOV AL, 90H:


It loads no.90H in AL register.
AL=90H
• MOV DX, CNT:
It copies the contents of CNT to DX register.
DX=03FD6H
• OUT DX, AL:
It sends out the data present in AL on the address present in DX.

• J1: MOV DX, APORT:


J1 is label
This instruction loads the contents of APORT in DX register.
DX=03FD0H
• IN AL, DX:
This instruction inputs the data from port present at offset address
[03FD0H] to AL register.
• MOV DX, BPORT:
This instruction copies the content present at offset of BPORT to DX
register.
• OUT DX, AL:
This instruction sends the data present in AL to the output port present
at the offset address of DX.
• JMP JI:
JMP is unconditional jump it continuously jumps to the label ‘J1’
Without checking any condition.
• END:
END OF PROGRAM EXECUTION.

CONSTRUCTING MACHINE LANGUAGE CODES FOR 8086


INSTRUCTONS:
Whenever we write a assembly language program these instructions are
first converted to machine language code so that microprocessor can read
it and this is done by assembler software.
FLOW CHART:

MOV
START
AL,90H

MOV
DX,CNT

JI:Out
Dx,APo
rt

MOV
DX,APort

IN
Al.Dx

MOV Dx,BP

OUT
DX,Al

JMP JI STOP
BLOCK DIAGRAM OF PROJECT:
SCHEMATIC DIAGRAM:
VCC

8
7
6
5
8
7
6
5
10k
3 2 A0-A2
4 D0 Q0 5
7 D1 Q1 6

1
2
3
4
1
2
3
4
8 D2 Q2 9 34 4
13 D3 Q3 12 33 D0 PA0 3
14 D4 Q4 15 32 D1 PA1 2
17 D5 Q5 16 31 D2 PA2 1
18 D6 Q6 19 30 D3 PA3 40
D7 Q7 29 D4 PA4 39
11 28 D5 PA5 38
16 8 1 LE A14-A19 27 D6 PA6 37
15 AD0 AD8 7 OE D7 PA7
14 AD1 AD9 6 74LS 373 2 9 18 2 18
13 AD2 AD 10 5 1 8 A0 PB0 19 4 A1 Y 1 16
12 AD3 AD 11 4 3 A1 PB1 20 6 A2 Y 2 14
6

11 AD4 AD 12 3 A8-A16 35 PB2 21 8 A3 Y 3 12


10 AD5 AD 13 2 5 RESET PB3 22 A4 Y4
9 AD6 AD 14 39 3 2 OR2 36 R D PB4 23 1
AD7 AD 15 4 D0 Q0 5 6 WR PB5 24 G
19 38 7 D1 Q1 6 CS PB6 25 74LS 240
C LK A 1 6 /S 3 3 7 8 D2 Q2 9 PB7 330ohm
31 A 1 7 /S 4 3 6 13 D3 Q3 12 14
18 H O LD A 1 8 /S 5 3 5 14 D4 Q4 15 1 15 PC0 15
33 IN T R A 1 9 /S 6 17 D5 Q5 16 2 A Y0 14 PC1 16

1
17 MN 25 18 D6 Q6 19 3 B Y1 13 PC2 17
22 NMI A LE 34 D7 Q7 C Y2 12 PC3 13
21 READY B H E /S 7 26 11 6 Y3 11 PC4 12
23 RST DEN 27 1 LE 4 G1 Y4 10 PC5 11
TEST D T /R 30 OE 0 5 G 2A Y5 9 PC6 10
H LD A 24 74LS373 G 2B Y6 7 PC7 VCC
IN TA 28 Y7 8255
M /IO 32 74LS138
2
3

RD 29 A16-A17 A8-A15 2 1 11 9
WR 13 A1 Y1 7
8 0 8 6 M IN A8-A13 15 A2 Y2 5
17 A3 Y3 3
10 7 4 L S 1 41 1 A4 Y4
9 A0 D 0 12 19
8 A1 D 1 13 G
7 A2 D 2 15 74LS240
6 A3 D 3 16
5 A4 D 4 17
4 A5 D 5 18
3 A6 D 6 19
25 A7 D7
24 A8
21 A9
23 A10
2 A11
A12
2 22
6

31

1 27 O E
3 20 W E
74LS 14 26 C S1
CS2 VCC
6264
42
510
C P U- C LK
C RY S TA L O S CI LA T OR
510
100

CL K S Y S- C LK
U 16
P CL K
3 8
7 AEN1 C LK 2
AEN2 PC LK
1 4 .7 4 5 6 M H Z 14 5 R AM - VC C
EFI R EAD Y 10 1 2 3
12 RESET
17 O S C
16 X1
X2
C R Y STAL 15 2K 2K1
1 ASY NC
C1 CSYNC
13 R A M- A
4 F /C
6 RDY1
11 RDY2 R A M- B
RES

D 10 8284
470K

V CC
511
D 3 -1 N 4 1 4 8

1 M IC R O F
100

RA M -V C C

D4

C 6 -4 7 3 .6 V
B A TTE R Y
VCC

470K

74LS14

SW2 NMI R3
1 2 TO NMI PINOF MP

100

1 M IC R O F 2

M/IO'
2
3

1 IOR'
3
4

RD' 2
1 MEMR'
3

2
1 1OW'
WR' 3

2
1 MEMW'
3
RECTIFIER BRIDGE

STEPDOWN TRANSFORMER

D1

1
T1
1 5
VOLTAGE
220V 2 - + 4 FILTERS REGULATOR +5V
VCC
4 8

TR A N S F O R M E R
3 B R ID G E

VCC

470K

IC 6 D VCC
SW 1
100
9 8
NMI
IN 4 1 4 8
1uF
7 4 L S 1 4 /S O
100

R A M -V C C
47
IN 4 1 4 8

3 .6 V
BATTER Y
ADDRESS DECODING:

PORT A:
8255
I/P

ENB

0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 1 0 0 0 0

DEC
IP
HEX CODE: 03FD0H

PORT B:

0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 1 0 0 1 0

HEX CODE: 03FD2H

PORT C:

0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 1 0 1 0 0

HEX CODE: 03FD4H

CONTROL REGISTER:

0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 1 0 1 1 0

HEX CODE:03FD6H
Intel 8086 microprocessor architecture:

The Intel 8086 is16 bit microprocessor that is use as CPU in microcomputer. Its
chareristics are

(1): The 8086 has16-bit data bus. So it can read data from or write data to memory
and ports either 16-bit or 8-bit at a time

(2):The 8086 has 20-bit address bus. So it can address any one of (2^20) memory
location.

(3):It has17 control/timing,3 power = 56. But 8086 has just 40 pins.

8086 Pins Discription:


AD0-AD15 (out): multiplexed address/data bus signals
NMI & INTR (in):
interrupt request
inputs

MN/MX* (in):
Minimum/maximum
operating mode

BHE* (out): Bus High


Enable - determines if
byte or word memory
access (with A0)

CLK(in):Pin number
19 is System clock

INTA* (out): Interrupt


acknowledge

RD* (out): Read bus


cycle in progress

WR* (out): Write bus cycle in progress

M/IO* (out): memory or I/O transfer occuring over bus


DT/R* (out): Data transmit/receive (direction of data transfer through external buffers)

A16/S3-A19/S6 (out): Address/status


S4-S3: 00-ES, 01-SS, 10-CS, 11-DS
S5: INTE flag, S6=0

DEN* (out): Data enable, signals that bus lines are being used to transfer data

HOLD (in): Causes 8086 to relinquish bus, used in DMA

HLDA (out): Hold acknowledge, signals bus lines have been relinquished

TEST* (in): If high, 8086 enters idle mode (for use with other processors, e.g., 8087)

READY (in): To generate wait states (for slow memory/I/O devices)

RESET(in): Reset processor, terminate current activity, initialize registers

Code segment (CS) is a 16-bit register containing address of 64 KB


segment with processor instructions. The processor uses CS segment for
all accesses to instructions referenced by instruction pointer (IP) register.
CS register cannot be changed directly. The CS register is automatically
updated during far jump, far call and far return instructions.

Stack segment (SS) is a 16-bit register containing address of 64KB


segment with program stack. By default, the processor assumes that all
data referenced by the stack pointer (SP) and base pointer (BP) registers is
located in the stack segment. SS register can be changed directly using
POP instruction.

Data segment (DS) is a 16-bit register containing address of 64KB


segment with program data. By default, the processor assumes that all
data referenced by general registers (AX, BX, CX, DX) and index register
(SI, DI) is located in the data segment. DS register can be changed directly
using POP and LDS instructions.

Extra segment (ES) is a 16-bit register containing address of 64KB


segment, usually with program data. By default, the processor assumes
that the DI register references the ES segment in string manipulation
instructions. ES register can be changed directly using POP and LES
instructions.
It is possible to change default segments used by general and index
registers by prefixing instructions with a CS, SS, DS or ES prefix.
All general registers of the 8086 microprocessor can be used for arithmetic
and logic operations. The general registers are:

Accumulator register consists of 2 8-bit registers AL and AH, which can


be combined together and used as a 16-bit register AX. AL in this case
contains the low-order byte of the word, and AH contains the high-order
byte. Accumulator can be used for I/O operations and string manipulation.

Flags is a 16-bit register containing 9 1-bit flags:

Carry Flag (CF) - set if there was a carry from or borrow to the most
significant bit during last result calculation.

Auxiliary carry Flag (AF) - set if there was a carry from or borrow to
bits 0-3 in the AL register

Direction Flag (DF) - if set then string manipulation instructions will


auto-decrement index registers. If cleared then the index registers
will be auto-incremented.

Interrupt-enable Flag (IF) - setting this bit enables maskable


interrupts.

Single-step Flag (TF) - if set then single-step interrupt will occur after
the next instruction.

Sign Flag (SF) - set if the most significant bit of the result is set.

Zero Flag (ZF) - set if the result is zero.

Parity Flag (PF) - set if parity (the number of "1" bits) in the low-order
byte of the result is even.

Overflow Flag (OF) set if the result is too large positive number, or is
too small negative number to fit into destination operand.
8255 Programmable Peripheral Interface (PPI):

THE 8255 (PPI :)

The 8086 microprocessor has no port to connect input and output devices
With it so in order to interface the input and output devices with 8086
microprocessor we use another IC numbered 8255 (ppi).

8255 SPECIFICATIONS;

 40 Pins DIP…(DUAL INLINE PACKAGE)


 3 8bits ports
o PA…port A
o PB…port B
o PC…port C
 Chip select… (CS...active low)
 02 input pins (from mp)
 Read and write pins
 8 data pins (D0-D7)
 control register

GROUPS OF 8255:
The ports of 8255(ppi) are divided in to two (2) groups i.e. group A&B

1. G.A=PA+PC(low)
2. G.B=PB+PC(high)

CONTROL REGISTER:

Control register contains the control word and on the basis of this control
word the ports are configured as input or output port.

mod mod mod PA PCH mod PB PCL


Mod=1
i/o mod

!……… ... group A………………!............group B…………..!

CONTENT OF CONTROL REGISTER (IN THIS VERY CASE):

8 bit word:

1 0 0 1 0 0 0 0

PA= input port

PB= output port

PC= output port


Advantage of this project:
Now, I am able to interface any I/O devices with microprocessor by
using programmable peripheral. This project helped in a lot in
understanding of the interfacing, I hope this project will help me a lot
in the future, specially in the final project of Engineering.

You might also like