Professional Documents
Culture Documents
Microprocessor 8085 Lab Manual PDF
Microprocessor 8085 Lab Manual PDF
EXPERIMENT NO 1
Control Unit
Generates signals within uP to carry out the instruction, which has been decoded. In
reality causes certain connections between blocks of the uP to be opened or closed, so
that data goes where it is required, and so that ALU operations occur.
Accumulator
The accumulator is an 8-bit register that is a part of arithmetic/logic unit (ALU). This
register is used to store 8-bit data and to perform arithmetic and logical operations.
The result of an operation is stored in the accumulator. The accumulator is also
identified as register A.
Flags
The ALU includes five flip-flops, which are set or reset after an operation according to
data conditions of the result in the accumulator and other registers. They are called
Zero(Z), Carry (CY), Sign (S), Parity (P), and Auxiliary Carry (AC) flags; they are
listed in the Table and their bit positions in the flag register are shown in the Figure
below. The most commonly used flags are Zero, Carry, and Sign. The microprocessor
uses these flags to test data conditions. For example, after an addition of two numbers, if
the sum in the accumulator id larger than eight bits, the flip-flop uses to indicate a carry -
- called the Carry flag (CY) is set to one. When an arithmetic operation results in zero,
the flip-flop called the Zero(Z) flag is set to one. The first Figure shows an 8-bit register,
called the flag register, adjacent to the accumulator. However, it is not used as a
register; five bit positions out of eight are used to store the outputs of the five flip-flops.
The flags are stored in the 8-bit register so that the programmer can examine these flags
(data conditions) by accessing the register through an instruction These flags have
critical importance in the decision-making process of the microprocessor. The
conditions (set or reset) of the flags are tested through the software instructions. For
example, the instruction JC (Jump on Carry) is implemented to change the sequence of
a program when CY flag is set. The thorough understanding of flag is essential in writing
assembly language programs.
Instruction Register/Decoder
Temporary store for the current instruction of a program. Latest instruction sent here
Control Generator
Generates signals within uP to carry out the instruction which has been decoded. In
reality causes certain connections between blocks of the uP to be opened or closed, so
that data goes where it is required, and so that ALU operations occur.
Program:
Obsevation:
Input: 80 (4150)
80 (4251)
Output: 00 (4252)
01 (4253)
Result: Thus the program to add two 8 bit numbers was executed.
Program:
LHLD 2000H Get first 16-bit number
XCHG Save first 16-bit number in DE
LHLD 2002H Get second 16-bit number in HL
DAD D Add DE and HE
SHLD 2004H Store 16-bit result in memory locations 2004H and 2005H.
HLT Terminate program execution
Observation:
Input: 12 (2000)
23 (2001)
43 (2002)
21 (2003)
Output: 55 (2004)
55 (2005)
Result: Thus the program to add two 16 bit numbers was executed.
Program:
Observation:
Input: 06 (4150)
02 (4251)
Output: 04 (4252)
01 (4253)
Result: Thus the program to subtract two 8 bit numbers was executed.
Program:
Observation:
Input: HL = 9876H
BC = 5432H
Result: Thus the program to subtract two 16 bit numbers was executed.
Program:
Observation:
Input: 4150(10)
4151(02)
Output: 4152(20)
4153(00)
Result: Thus the program to multiply two 8 bit numbers was executed.
Program:
Observation:
Input: 4150(10)
4151(02)
Output: 4152(05)
4153(00)
Result: Thus the program to Division of two 8- bit nos. using repeated Subtraction
method was executed.
Program:
2s complement of a no
Program:
Output FE (4300)
Result: Thus the program to find largest number in an array was executed.
Observation:
Input 05 (4200)Array size
0A (4201)
F1 (4202)
1F (4203)
26 (4204)
FE (4205)
Output 0A (4300)
Result: Thus the program to find smallest number in an array was executed.
Objective: Transfer Block of data bytes from one memory location to another .
Program:
Result: Transfer Block of data bytes from one memory location to another is executed.
Program
LXI H, 4200
MOV C, M
DCR C
REPEAT: MOV D C
LXI H4201
LOOP: MOV A,M
INX H
CMPM
JC SKIP
MOV B,M
MOV M,A
DCX H
MOV M,B
INX H
SKIP: DCR D
JNZ LOOP
DCR C
JNZ REPEAT
HLT
Program:
LXI H, 4200
MOV C, M
DCR C
REPEAT: MOV D, C
LXI H, 4201
LOOP: MOVA, M
INX H
CPM M
JNC SKIP
MOV B, M
MOV M, A
DCX H
MOV M, B
INX H
SKIP: DCR D
JNZ LOOP
DCR C
JNZ REPEAT
HLT
Result: Thus the program to Arrange data bytes in descending order was executed.
(Read): This control signal enables the Read operation. When the signal is
low, the MPU reads data fro a selected I/O Port of the 8255.
(Write): This control signal enables the write operation. When the signal
goes low, MPU writes into a selected I/O Port or control register.
RESET (Reset): This is an active high signal; it clears the control register and sets
all ports in the input mode.
CONTROL WORD
Figure 1.5 shows a register called the control register. The contents of this register
called control word. This register can be accessed to write a control word when A0
and A1 are at logic 1. This control register is not accessible for a read operation.
Bit D7 of the control register specifies either I/O function or the Bit
Set/Reset function. If bit D7=1, bits D6-D0 determines I/O functions in various
modes. If bit D7=0, Port C operates in the Bit Set/Reset (BSR) mode. The BSR
control word does not affect the functions of Port A and Port B.
1. Determine the address of ports A, B and C and of the control register according to
the chip select logic and address lines A0 andA1.
Operating Modes
In this mode, ports A, B are used as two simple 8-bit I/O ports and port C as two 4-
bit ports. Each port can be programmed to function as simply an input port or an
output port. The input/output features in Mode 0 are as follows.
1. Outputs are latched.
2. Inputs are not latched.
3. Ports dont have handshake or interrupt capability.
In this mode, handshake signals are exchanged between the MPU and peripherals
prior to data transfer. The features of the mode include the following:
1. Two ports (A and B) function as 8-bit I/O ports. They can be configured as either
as input or output ports.
2. Each port uses three lines from ort C as handshake signals. The remaining two
lines of Port C can be used for simple I/O operations.
3. Input and Output data are latched.
4. Interrupt logic is supported.
Mode 2: Bidirectional Data Transfer
This mode is used primarily in applications such as data transfer between two
computers. In this mode, Port A can be configured as the bidirectional port and Port
B either in Mode 0 or Mode 1. Port A uses five signals from Port C as handshake
signals for data transfer. The remaining three signals from port C can be used either
as simple I/O or as handshake for port B.
The BSR mode is concerned only with the eight bits of port C, which can be set or
reset by writing an appropriate control word in the control register. A control word
with bit D7 =0 is recognized as a BSR control word, and it does not alter any
previously transmitted control word with bit D7=1; thus the I/O operations of ports A
and B are not affected by a BSR control word. In BSR mode, individual bits of port C
can be used for applications such as an on/off switch. Ports A and B are not affected
by the BSR Mode.
BSR CONTROL WORD
This control word, when written in the control register, sets or resets one bit at a
time,
D7 D6 D5 D4 D3 D2 D1 D0
Timer command IEB IEA PC PB PA
D6: Timer. Latched high when TC is reached, low when status reg is read or reset is done.
Timer section
MSB:
M2 M1 T13 T12 T11 T10 T9 T8
LSB:
T7 T6 T5 T4 T3 T2 T1 T0
Mode 0 Single square wave: in this mode, the timer output remains high for half the count and
goes for the remaining count, thus providing a single square wave .the pulse width is determined
by the count and the clock frequency,
Mode 1 Square wave: in this mode, the initial timer count is automatically reloaded at the end of
each count,thus providing a continuous Square wave.
Mode 3: Pulse every terminal count: this is similar to mode 2,except the initial count is
reloaded to provided a continuous wave form.
Program:
START: LXI H, 4130H
MVI D,0FH; Initialize counter.
MVI A,10H
OUT CCH ;Set Mode and Display.
MVI A,CCH;Clear display.
OUT C2H
MVI A,90H ;Write Display
OUT C2H
LOOP: MOV A,M
OUT C0H
CALL DELAY
INX H
DCR D
JNZ LOOP
JMP START
Result: Thus 8279 controller was interfaced with 8085 and program for rolling display
was executed successfully.
Theory: The DMA (8257/8237) is used to transfer data bytes between I/O and system memory
at high speed. it includes eight data lines,four control signals and eight address lines,however it
needs 16 address lines to acess 64K bytes therefore an additional eight lines must be generated
When a transfer begins,DMA places the low order bytes on the address bus and the high order
bytes on the data bus and asserts AEN and ADSTB (address strobe). These two signals are used
to latch the high order bytes from the data bus thus it places the 16 bit address on the system
bus.After the transfer of first byte,the latch is updated when the lower bytes generates a carry.
To implement the DMA transfer,the 8257 should be initialized by writing into various control
registers in the DMA channels and interfacing section. To initialize the 8257,the following steps
are necessary:
1. write a control word in the mode register than selects the channel and specifices the type
of transfer and the DMA mode.
2. write a control word in the command register that specifies parameters such as priority
among four channel DREQ and DACK active levels,and timing and enables the 8257.
3. write the starting address of the data to be transferred in the channel memory address
register.
4. write the count in the channel count register.
Program:
MVI A 00000100B
OUT 08H
MVI A 00000111B
OUT 0B H
MVI A 75H
OUT 06H
Clockwise Anti-
clockwise
A1 B1 A2 B2 A1 B1 A2 b2
1 0 0 1 1 0 1 0
0 1 0 0 0 1 0 1
0 1 0 1 0 1 0 0
1 0 1 0 1 0 0 1
The hardware setup consists of a microprocessor motherboard and stepper motor
interface board. The motherboard consists of 8085 MPU, 8KB EPROM, 8KB RAM,
Keyboard and display controller 8279, 21-key Hex-keypad and six numbers of seven
segment LEDs and Bus Expansion connector. The stepper motor interface consists of
driver transistors for stepper motor windings and address decoding circuit. The
microprocessor output the binary sequence through data bus, which are converted to
current pulses by the driver transistors and used to drive stepper motor. The software
for the system is developed in 8085 assembly language.
Address/
AD0-AD7 Control Transistor driver
8085 LATCH Address/
Decoder CS
50 Pin Expansion Connector
CPU
EPROM
D0-D7
D0-D3
Connector
Result: is executed.
System bus Latches M
RAM 8279
Keyboard Buffer
8KB LED indication for
Display output binary sequence
Display
Keyboard
C D E F int
8 9 A B Go
4 5 6 7 Nxt
0 1 2 3 Sub
Fig: Block diagram of stepper motor interface
Temp Control
MPU Plant
Input output
Operationally, the system requires two set points-upper and lower, to be entered by the
user. Whenever the temperature of the plant exceeds the upper limit or recede the
lower limit relay is turned-off, so that a temperature is maintained within limits. The
software for the temperature controller is developed in 8085 assembly language
programs.
26 pin connector
driver +V
Parallel port
SENSOR
A8-A15
590
D0-D7
NC
ADC
P SYSTEM BUS
INTERFACE
BOARD
C D E F int
8 9 A B
4 5 6 7 Nxt
0 1 2 3 Sub
KEYBOARD