0% found this document useful (0 votes)
60 views

Mupi Lab Manual Part 1

Uploaded by

ansalv
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
60 views

Mupi Lab Manual Part 1

Uploaded by

ansalv
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 52

MICROPROCESSOR LAB MANUAL

Date: EXPT NO: 1


INTRODUCTION TO 8085 MICROPROCESSOR TRAINER KIT
Aim
1. To study the 8085 microprocessors
2. Study of 8085 microprocessor kit- STS 85
1. 8085 microprocessor
The salient features of 8085 processor are
• It is an 8-bit microprocessor.
• It is manufactured with N-MOS technology.
• It has 16-bit address bus and hence can address up to 216 = 65536 bytes (64KB) memory locations through A0
to A15 address lines.
• The first 8 lines of address bus and 8 lines of data bus are multiplexed through AD0-AD7.
• It requires +5V power supply and its clock frequency is around 3 MHz.
• It is enclosed with 40 pins DIP.
Architecture of 8085 Microprocessor
a) General purpose registers
In 8085 there are 6 general purposes 8-bit registers i.e., B, C, D, E, H and L. The combination of 8-bit register is known
as register pair, which can hold 16-bit data. The possible register pairs in 8085 are B-C, D-E and H-L. Here HL pair
is used as the default memory pointer to point a memory location indirectly.
b) Accumulator
It is an 8-bit register which hold one of the operands during ALU operation and it stores the result of the ALU
operation.
c) Program counter (PC)
It is a 16-bit register which sequences the execution of instructions in a program. Thus, PC always contains the address
of next instructions to be executed.
d) Stack pointer (Sp)
It is a 16-bit special purpose register which is used to hold address of the stack top.
e) Arithmetic and logical unit (ALU)
It carries out all arithmetic and logical operation between the contents of accumulator and memory or internal register
and the result is stored back into accumulator.
f) Temporary register

It is an 8-bit register associated with ALU which hold data for operation temporarily and is not accessible to the
programmer.

g) Flags
Flag register in 8085 has five 1-bit flags.
• Sign - set if the most significant bit of the result is 1.
Department of EEE TKMCE Kollam 2019 Scheme
MICROPROCESSOR LAB MANUAL
• Zero - set if the result is zero.
• Auxiliary carry - set if there was a carry out from bit 3 to bit 4 of the result.
• Parity - set if the parity in the result is even.
• Carry - set if there was a carry during addition, or borrow during subtraction/comparison/rotation.

Fig. 1 Architecture of Intel 8085 Microprocessor

Fig. 2 Bit position of various flags in flag register of 8085 Microprocessor

h) Interrupts signals
8085 processor has 5 interrupts. They are INTR,RST 5.5, RST 6.5, RST 7.5 and TRAP in the order of their priority
(from lowest to highest)

i) Reset Signals
RESET IN
Department of EEE TKMCE Kollam 2019 Scheme
MICROPROCESSOR LAB MANUAL
When this signal goes low Program counter is set to zeroes, μp is reset and resets the interrupt enable and HLDA flip-
flops.

RESET OUT
This signal indicates that μp is being reset. This signal can be used to reset other devices. The signal is synchronized to
the processor clock.

Serial communication Signal


SID - Serial Input Data Line: The data on this line is loaded into accumulator bit 7 whenever a RIM instruction is
executed.
SOD – Serial Output Data Line: The SIM instruction loads the value of bit 7 of the accumulator into SOD latch if bit
6 (SOE) of the accumulator is 1.

j) Instruction register and decoder

Instruction register is an 8-bit register just like other registers of microprocessor.


• When instructions are fetched from memory, it is directed to Instruction register. So, the instruction registers are
specifically used to store the instructions that are fetched from memory.

• Instruction decoder decodes the information present in the Instruction register for further processing.

k) DMA Signals

HOLD
Indicates that another master is requesting the use of the address and data buses. The CPU, upon receiving the hold
request, will relinquish the use of the bus as soon as the completion of the current bus transfer. Internal processing can
continue. The processor can regain the bus only after the HOLD is removed.

HLDA
Hold Acknowledge Indicates that the CPU has received the HOLD request and that it will relinquish the bus in the next
clock cycle

l) READY
• This signal Synchronizes the fast CPU and the slow memory, peripherals.

• If READY is high during a read or write cycle, it indicates that the memory or peripheral is ready to send or
receive data.

• If READY is low, the CPU will wait an integral number of clock cycle for READY to go high before completing
the read or write cycle.

m) Timing and control unit:

• Timing and control unit is a very important unit as it synchronizes the registers and flow of data through various
registers and other units.

• This unit consists of an oscillator and controller sequencer which sends control signals needed for internal and
external control of data and other units.

Department of EEE TKMCE Kollam 2019 Scheme


MICROPROCESSOR LAB MANUAL
• The oscillator generates two- phase clock signals which aids in synchronizing all the registers of 8085
microprocessor.

PIN Description
Address Bus

• The pins A0 – A15 denote the address bus.


• Here, A8 – A15 is the address bus which carries Higher order address of the memory
• A0– A7 lines carries low order address of the memory and the data from/to the memory in time shared mode
Address / Data Bus

• AD0 – AD7 constitutes the address / Data bus


ALE: (Address Latch Enable)

• This signal goes high during the first clock cycle and enables the lower order address bits.
̅
𝐈𝐎/𝐌

• This is a status signal to distinguish whether the address on the address bus is for memory or I/O.
• When these pins go high, the address is for an I/O device.
S0 and S1

• These are status signal which provides different status and functions as shown in Table below.

̅
𝐈𝐎/𝐌 S1 S0 Operation
0 0 0 Halt
0 0 1 Memory Write
0 1 0 Memory Read
0 1 1 Opcode Fetch
1 0 1 I/O Write
1 1 0 I/O Read
1 1 1 Interrupt Acknowledge
̅̅̅̅
𝐑𝐃

• This is an active low signal


• This signal is used to control READ operation of the microprocessor
̅̅̅̅̅
𝐖𝐑

• This is also an active low signal


• This signal is used to control WRITE operation of the microprocessor

HOLD

• This indicates if any other device is requesting the use of address and data bus.

HLDA

• HLDA is the acknowledgement signal for HOLD


Department of EEE TKMCE Kollam 2019 Scheme
MICROPROCESSOR LAB MANUAL
• It indicates whether the hold signal is received or not.

INTR

• INTR is an interrupt request signal


• It can be enabled or disabled by using software

INTA
• When the microprocessor receives interrupt signal, it has to be acknowledged.

RST 5.5, RST 6.5, RST 7.5


• These are the restart interrupts
• These are maskable interrupt

TRAP
• Trap is the only non-maskable interrupt
• It cannot be enabled (or) disabled using program

RESET IN
• This signal is used to reset the microprocessor by setting the program counter to zero.

X1, X2
• These are the terminals which are connected to external oscillator to produce the necessary and suitable clock
operation.

SID
• This pin provides serial input data

SOD
• This pin provides serial output data

Department of EEE TKMCE Kollam 2019 Scheme


MICROPROCESSOR LAB MANUAL
2. Study of 8085 microprocessor kit-STS 8085
STS 8085 microprocessor kit includes

• 8085 microprocessors
• 32Kb RAM
• 32Kb ROM
• 16-bit programmable timer / Counter
• Programmable peripheral Interface (PPI)8255
• Interrupt controller (8259)
• 28 key keyboard,
• 6 seven segment LED for display.
The keyboard and the display are interfaced with 8085 through the keyboard/display interface 8279.The keyboard
enables the user to enter and store the 8085 hex machine code representing the 8085 assembly language programs on
R/W memory. A program can be executed using the function keys on the keyboard and the result can be displayed on
the 7 segment LEDs. The LEDs are also used to display memory addresses and their contents while entering, modifying
or examining the programs.

Keyboard description
STS 8085 LED has 28 keys and 6-digit seven segment display to communicate with outside world. When the system
initially is switched on a message ‘STS 85’ is displayed. The following are the commands which are selected using the
keys.

RESET - Reset the system


VCT INT - Hardware interrupt via keyboard, RST 7.5
SHIFT - Provides dual function to all keys
GO - To execute a program
EMEM - Examine memory helps the user to examine any memory location and modify any location.
REG - Examine register and modify the contents
PRE - To verify the contents of previous memory location from that of existing location
NEXT - To verify the contents of next memory location
“.” - Terminator used to terminate the command
DEL - Delete the part of the program or data with relocation by one or more bytes
INS - Insert the part of the program or data with relocation by one or more bytes
BLOCK MOVE - Allows user to move a block of memory to any RAM area
FILL - Allows user to fill RAM area with a constant
REL - Relocate program written for some memory area to be transferred to another area.
INSD - Inserts one or more bytes in the users program/ data area
DELD - Deletes one or more data bytes in the users program/data area
STRG - Finds out the strings of data lying at a particular address or addresses
MEMC - Memory compare used for comparing two blocks of memory for equality
0-F - Hexadecimal keys
Department of EEE TKMCE Kollam 2019 Scheme
MICROPROCESSOR LAB MANUAL
• All commands are followed by a set of numerical parameters by PREV, NEXT and ‘.’ (Execute) to work as
delimiters.
• A ‘-‘on MSD shows that the system is waiting for a command.
• Err shows an invalid command
• A ‘.’ on the LSD of address field shows that system expects an address.
How to enter machine codes?
Assembly language program for addition of two 8-bit numbers is shown below:
MVI A, 32H
MVI B, 12H
ADD B
STA 2150H
HLT
(Assume the machine code is saving in to location 2100H onwards)
PRESS ADDRESS FIELD DATA FIELD
RESET XXXX
EMEM
2100 2100

NEXT 2100

3E 2100 3E
NEXT 2101
32 2101 32
NEXT 2102
06 2102 06
NEXT 2103
12 2103 12
NEXT 2104
80 2104 80
NEXT 2105
32 2105 32
NEXT 2106
50 2106 50
NEXT 2107
21 2107 21
NEXT 2108
76 2108 76
NEXT 2109

Department of EEE TKMCE Kollam 2019 Scheme


MICROPROCESSOR LAB MANUAL
Date: EXPT NO: 2
STUDY OF DATA TRANSFER GROUP OF INSTRUCTION
AIM:

A) To study various data transfer group of instructions of 8085


B) To write and test assembly language programs to do the following:
a. Load an 8-bit number in C register and transfer to location XX50H.
b. Copy a number stored in memory location XX50H to XX51H.
c. Interchange the content of memory location XX50H and XX60H.
d. Copy the content of XX50H and XX51H in H-L register pair.
e. Move the content of an address location to accumulator for the following cases
i. Address stored in H-L register pair.
ii. Address stored in B-C register pair.
iii. Address stored in D-E register pair.
f. Interchange two 16-bit numbers stored in memory.
g. Transfer 10 8-bit numbers stored in memory location starting from XX50H to memory location starting
from XX70H.
i. In same order
ii. In reverse order

DATA TRANSFER GROUP OF INSTRUCTIONS


This group of instructions copy data from a location called a source to another location called a
destination, without modifying the contents of the source. In technical manuals, the term data transfer is
used for this copying function. However, the term transfer is misleading; it creates the impression that the
contents of the source are destroyed when, in fact, the contents are retained without any modification. The
various types of data transfer (copy) are listed below together with examples of each type:

Types of data transfer group of instructions


Types Examples
1. Between Registers. 1. Copy the contents of the register B into register D.
2. Specific data byte to a register or a memory 2. Load register B with the data byte 32H.
location. 3. From a memory location 2000H to register B.
3. Between a memory location and a register. 4. From an input keyboard to the accumulator.
4. Between an I/O device and the accumulator.

Department of EEE TKMCE Kollam 2019 Scheme


MICROPROCESSOR LAB MANUAL
SI. Instructions Operation Bytes Machine T-States Addressing Flag
No Cycle mode
1 MOV r1, r2 [r1]  [r2] 1 OF (1) 4 Register No
2 MOV r, M [A][[H][L]] 1 OF+MR (2) 4+3=7 Register indirect No
3 MOV M, r [[H][L]]  [r] 1 OF+MW (2) 4+3=7 Register indirect No
4 MVI M, data8 [[H][L]]  data8 2 OF +MR+ MW (3) 4+3*2=10 Immediate / No
Register indirect
5 MVI r, data8 [r]  8-bit data; 2 OF+MR (2) 4+3=7 Immediate No
6 LXI rp, data16 [rp] 16-bit data 3 OF+MR+MR (3) 4+3+3=10 Immediate No
7 LDA addr16 [A]  [address] 3 OF+MR+MR+MR (4) 4+3*3=13 Direct No
8 STA addr16 [address]  [A] 3 OF+MR+MR+MW (4) 4+3*3=13 Direct No
9 LHLD addr16 [L][address] & 2 OF+MR+MR+MR+MR (2) 4+3*4=16 Direct No
[H][address+1]
10 SHLD addr16 [L]→[address] & 2 OF+MR+MR+MW+MW (2) 4+3*4=16 Direct No
[H]→[address+1]
11 LDAX rp [A] [[rph][rpl]] 1 OF+MR (2) 4+3=7 Register indirect No
12 STAX rp [A]→ [[rph][rpl]] 1 OF+MW (2) 4+3=7 Register indirect No
13 XCHG [HL]↔[DE]; 1 OF (1) 4 Register No

PROGRAMS

Load an 8-bit number in C register and transfer to location XX50H.


Memory Machine Code Label Mnemonics Comments
Address

X000 MVI C, FF ; [C]FFH


MOV A, C ; [A][C]
STA 2050H ; [A]→[2050H]
HLT ; STOP

Data: - Output: -
[C] [FFH] [2050H] = FFH

Copy a number stored in memory location XX50H to XX51H


Memory Machine Code Label Mnemonics Comments
Address LXI H,XX50H

X100 LDA 2050 ; [A][2050H]


STA 2051 ; [A]→[2051H]
HLT ; STOP

Data: - Output: -
[2050H] = FFH [2051H] = FFH

Interchange the content of memory location XX50H and XX60H


Memory Machine Code Label Mnemonics Comments
Address

X200 LDA 2050H ; [A][2050H]

Department of EEE TKMCE Kollam 2019 Scheme


MICROPROCESSOR LAB MANUAL
MOV B, A ; [B][A]
LDA 2060H ; [A][2060H]
STA 2050 ; [A]→[2050H]
MOV A, B ; [A][B]
STA 2060 ; [A]→[2060H]
HLT ; STOP

Data: - Output: -
[2050H] = FFH [2050H] = 01H
[2060H] = 01H [2050H] = FFH

Copy the content of XX50H and XX51H in H-L register pair*Use Single step exec
Memory Machine Code Label Mnemonics Comments
Address

X210 LHLD 2050 ; [L][2050H], [H][2051H],


HLT ; STOP

Data: - Output: -
[2050H] = 01H [L] = 01H
[2051H] = ABH [H] = ABH

Move the content of a location to accumulator (Address in H-L pair) *Use Single step exec
Memory Machine Code Label LXI H,XX50H
Mnemonics Comments
Address

X220 LXI H, 2250H ; [L]50H, [H]22H


MOV A, M ; [A] [[H][L]]
HLT ; STOP

Data: - Output: -
[2250H] = 01H [A] = 01H

Move the content of a location to accumulator (Address in B-C pair) *Use Single step exec
LXI H,XX50H
Memory Machine Code Label Mnemonics Comments
Address

X230 LXI B, 2250H ; [C]50H, [B]22H


LDAX B ; [A] [[B][C]]
HLT ; STOP

Output: -
[A] = 01H
Move the content of a location to accumulator (Address in D-E pair) *Use Single step exec
Memory Machine Code Label Mnemonics
LXI H,XX50H Comments
Address

X240 LXI D, 2250H ; [E]50H, [D]22H


LDAX D ; [A] [[D][E]]

Department of EEE TKMCE Kollam 2019 Scheme


MICROPROCESSOR LAB MANUAL
HLT ; STOP

Data: - Output: -
[2250H] = 01H [A] = 01H

Interchange two 16-bit numbers stored in memory


Memory Machine Code Label Mnemonics Comments
Address

X300 LHLD 2350H ; 1st 16-bit number in H-L pair


XCHG ; Get 1st number in D-E pair.
LHLD 2360 ; 2nd 16-bit number in H-L pair
SHLD 2350 ; 2nd 6-bit number in 1st location
XCHG ; 1st 16-bit number in H-L pair
SHLD 2360
LXI H,XX50H ; 1st 16-bit number in 2nd location
HLT ; STOP

Data: - Output: -
1st No FFB0H [2350] =B0H [2350] =A0H
[2351] =F1H [2351] =FFH
2nd No FFB0H [2360] =A0H [2360] =B0H
[2361] =FFH [2361] =F1H

Bock transfer – Same order


Memory Machine Code Label Mnemonics Comments
Address

X400 MVI C, 0A ; Array count in C register


LXI H, 2450 ; Initialize memory pointer (Source)
LXI D, 2470 ; Initialize memory pointer (Result)
REPEAT: MOV A, M ; get array number in accumulator
STAX D ; Save the array number in destination
INX H
LXI H,XX50H ; Increment source location
INX D ; Increment destination location
DCR C ; Decrement the count
JNZ REPEAT ; Repeat till count =0
HLT ; Stop

Data: - Output: -
[2450] =00H [2470] =00H
[2451] =01H [2471] =01H
[2452] =02H [2472] =02H
[2453] =03H [2473] =03H
[2454] =04H [2474] =04H
[2455] =05H [2475] =05H
[2456] =06H [2476] =06H
[2457] =07H [2477] =07H
Department of EEE TKMCE Kollam 2019 Scheme
MICROPROCESSOR LAB MANUAL
[2458] =08H [2478] =08H
[2459] =09H [2479] =09H

Bock transfer – Reverse order


Memory Address Machine Code Label Mnemonics Comments

X400 MVI C, 0A ; Array count in C register


LXI H, 2450 ; Initialize memory pointer (Source)
LXI D, 2479 ; Initialize memory pointer (Result)
REPEAT: MOV A, M ; get array number in accumulator
STAX D ; Save the array number in destination
LXI H,XX50H
INX H ; Increment source location

DCX D ; Decrement destination location

DCR C ; Decrement the count

JNZ REPEAT ; Repeat till count =0

HLT ; Stop

Data: - Output: -
[2450] =00H [2470] =09H
[2451] =01H [2471] =08H
[2452] =02H [2472] =07H
[2453] =03H [2473] =06H
[2454] =04H [2474] =05H
[2455] =05H [2475] =04H
[2456] =06H [2476] =03H
[2457] =07H [2477] =02H
[2458] =08H [2478] =01H
[2459] =09H [2479] =00H

RESULTS
The various data transfer group of instructions are studied and various programs were written, executed and
obtained the required results

Department of EEE TKMCE Kollam 2019 Scheme


MICROPROCESSOR LAB MANUAL
Date: EXPT NO: 3
STUDY OF ARITHMETIC GROUP OF INSTRUCTION

AIM:
A. To study all the arithmetic group of instructions.
B. To write and test assembly language programs to do the following:
1. Add a set of 8-bit numbers stored in memory as an array starting from location XX51H.The number
of elements in the array is saved in location XX50H. Assume the sum is more than 8 bits. Save the
result in next location of the array.
2. Add any two 2-digit BCD numbers which are stored in locations XX70H and XX71H, and store the
result in next memory location.
3. Subtract one BCD number from other which are stored in location XX70H and XX71H and store the
result in location XX75H.
4. Add any two 16-bit numbers which are stored in location XX80H onwards. Assume the sum is greater
than 16 bits.
5. Two 8-bit numbers are stored in location XX90H and XX91H. Multiply these 8-bit numbers by
repeated addition procedure.

A. Arithmetic Group of Instructions.

These instructions perform arithmetic operations such as addition, subtraction, increment, and
decrement. The flag status is get affected by execution of this group of instructions.
Addition

During addition, any 8-bit number, or the contents of a register or the contents of a memory location
can be added to the contents of the accumulator and the sum (LSB result) is stored in the accumulator. It is not
possible to perform direct addition between general purpose registers (E.g., the contents of register D cannot
be added directly to the contents of the register E). The instruction DAD is an exception; it adds 16-bit data
which are stored in register pair with the content of H-L register pair and the result is stored in H-L register
pair.
Subtraction

Any 8-bit number, or the contents of a register, or the contents of a memory location can be subtracted
from the contents of the accumulator and the results stored in the accumulator. Similar to addition, no two other
registers can be subtracted directly.
Increment/Decrement

The 8-bit contents of a register or a memory location can be incremented or decrement by 1. Similarly,
the 16-bit contents of a register pair (BC/DE/HL) can be incremented or decrement by 1. While incrementing
or decrementing register content , all flags will be affected except the carry flag. No flag is affected in
Department of EEE TKMCE Kollam 2019 Scheme
MICROPROCESSOR LAB MANUAL
incrementing or decrementing register pair content.

Table 1: Various arithmetic group of instructions of 8085


SI. Instructi Machine Addressing
Operation Bytes T-States Flag
No ons Cycle mode
1 ADD r [A]← [A]+ [r] 1 OF (1) 4 Register All
2 ADD M [A]← [A]+ [[H][L]] 2 OF+MR (2) 4+3=7 Register indirect All
3 ADI d8 [A] ← [A]+ d8 2 OF+MR (2) 4+3=7 Immediate All
4 ADC r [A]← [A]+ [r]+[CY]; 1 OF (1) 4 Register All
5 ADC M [A]← [A]+ [[H][L]] +[CY]; 2 OF+MR (2) 4+3=7 Register indirect All
6 ACI d8 [A] ← [A]+ d8+[CY]; 2 OF+MR (2) 4+3=7 Immediate All
7 DAD rp [H-L] ← [H-L] +[rp]; 1 OF+BI+BI (3) 4+3*2=10 Register CY
8 SUB r [A]← [A] - [r] 1 OF (1) 4 Register All
9 SUB M [A]← [A] - [[H][L]] 2 OF+MR (2) 4+3=7 Register indirect All
10 SUI d8 [A] ← [A] - d8 2 OF+MR (2) 4+3=7 Immediate All
11 SBB r [A]← [A] - [r] -[CY]; 1 OF (1) 4 Register All
12 SBB M [A]← [A] - [[H][L]] - [CY]; 2 OF+MR (2) 4+3=7 Register indirect All
13 SBI d8 [A] ← [A] - d8 - [CY]; 2 OF+MR (2) 4+3=7 Immediate All
All
14 INR r [r] ← [r]+1 1 OF (1) 4 Register except
CY
All
OF+MR+MW
15 INR M [[H-L]] ← [[H-L]] +1 1 4+3*2=10 Register indirect except
(3)
CY
All
16 DCR r [r] ← [r] -1 1 OF (1) 4 Register except
CY
All
OF+MR+MW
17 DCR M [[H-L]] ← [[H-L]] -1 1 4+3*2=10 Register indirect except
(3)
CY
18 INX rp [rp] ← [rp] + 1 1 OF 6 Register None
19 DCX rp [rp] ← [rp] - 1 1 OF 6 Register None
20 DAA Decimal Adjust Accumulator 1 OF 4 Implied All

Department of EEE TKMCE Kollam 2019 Scheme


MICROPROCESSOR LAB MANUAL

B. PROGRAMS

Add a set of 8-bit numbers


Memory Machine Code Label Mnemonics Comments
Address
X100 MVI A,00 ; Clear Accumulator
MOV B, A ; Clear B for Carry
LXI H, XX50H ; Initialize memory pointer (data)
MOV C, M ; Count in C register
REPEAT: INX H ; Increment the pointer
ADD M ; [A] [A]+[[H],[L]]
JNC SKIP ; If no carry then goes to SKIP
INR B ; Increment B reg to consider CY
SKIP: DCR C ; Reduce the count by 1
LXI H,XX50H
JNZ REPEAT ; Repeat addition till count = 0
INX H ; Location of LSB result
MOV M, A ; Save the LSB result

INX H ; Location of MSB result

MOV M, B ; Save the MSB result

HLT ; Stop

Data: - Output: -
[XX50] = [XXXX] =
[XX51] = [XXXX] =
[XX52] =
[XX53] =
[XX54] =
[XX55] =
….

Department of EEE TKMCE Kollam 2019 Scheme


MICROPROCESSOR LAB MANUAL
Add any two-digit BCD numbers and store the results in next memory location.
Memory Machine Code Label Mnemonics Comments
Address
X200 MVI C,00 ; Clear C for Carry
LXI H, XX70H ; Initialize memory pointer (data)
MOV A, M ; First BCD number in A register
INX H ; Increment the pointer (2nd BCD No. Location)
ADD M ; ADD two BCD Numbers
DAA ; Convert results of addition in to BCD
JNC SKIP ; Skip if no Carry
INR C ; Consider Carry
SKIP: INX H
LXI H,XX50H ; Increment the pointer to save the LSB result
MOV M, A
LXI H,XX50H ; Save the result
INX H ; Increment the pointer to save the MSB result
MOV M, C ; Save the result
HLT ; Stop

Data: - [XX70] ← 98H Output: - [XX72] = H


[XX71] ← 88H [XX73] = H

Subtract one BCD number from another


Memory Machine Code Label Mnemonics Comments
Address
X200 LXI H, XX71H ; Initialize memory pointer (2nd BCD number Loc.)
MVI A, 99H ; Load 99H to A directly
SUB M ; 9s complement of 2nd number in A
ADI 01H ; 10s complement of 2nd number in A
DCX H ; Point Location corresponding to 1st BCD Number
ADD M ; [A][A]+[[H][L]]
DAA ; Convert results of addition in to BCD
LXI H,XX50H
STA XX75H ; Store the result to location XX75
HLT ; Stop

Data: - [XX70] ← 98H Output: - [XX75] = H


[XX71] ← 88H

Department of EEE TKMCE Kollam 2019 Scheme


MICROPROCESSOR LAB MANUAL
Add any two 16-bit numbers
Memory Machine Code Label Mnemonics Comments
Address
X200 MVI C,00H ; Clear C for Carry
LHLD XX80H ; [L][XX80H] & [H][XX81H]- 1st 16-bit Num
XCHG ; Get 1st 16-bit number in D-E pair
LHLD XX82H ; 2nd 16-bit Number in H-L pair
DAD D ; [H-L]  [H-L] +[D-E];
JNC SKIP ; If no carry goes to instruction corresponding to SKIP
INR C ; Increment C Register for carry
SKIP: SHLD XX84H ; Store the LSB results in XX84H and XX85H
MOV A, C ; Move CY (MSB Result) to A
STA 8407
LXI H,XX50H ; Store the MSB results in XX86H
HLT ; Stop

Data: - Output: -
[XX80] =B0H [XX84] = H
First No FFB0H
[XX81] =FFH
[XX82] =A0H [XX85] = H
2nd No FFB0H
[XX83] =FFH

Multiply two 8-bit numbers by repeated addition procedure.


Memory Machine Code Label Mnemonics Comments
Address
X300 MVI A,00 ; Clear Accumulator
MOV B, A ; Clear B for Carry
LXI H, XX90H ; Initialize memory pointer (data)
MOV C, M ; First number is in C register for count
INX H ; Increment the pointer for 2nd number
LOOP: ADD M ; [A][A]+[[H][L]]
JNC SKIP ; Skip if no Carry
INR B ; Increment B reg to consider CY
SKIP: DCR C ; Reduce the count by 1
LXI
LXI H,XX50H
JNZ H,XX50H
LOOP ; Repeat addition till count = 0
INX H ; Location of LSB result
MOV M, A ; Save the LSB result
INX H ; Location of MSB result
MOV M, B ; Save the MSB result
HLT ; Stop

Department of EEE TKMCE Kollam 2019 Scheme


MICROPROCESSOR LAB MANUAL
Data: - [XX90] ← 89H Output: - [XX92] = H

[XX91] ← 91H [XX93] = H

RESULTS
The various arithmetic group of instructions are studied and various programs were written, executed and
obtained the required results

Department of EEE TKMCE Kollam 2019 Scheme


MICROPROCESSOR LAB MANUAL

Date: EXPT NO: 4


STUDY OF LOGICAL GROUP OF INSTRUCTION

AIM:
A. To study all the logical group of instructions of 8085.
B. To write and test assembly language programs to do the following:
1. An array of 8-bit numbers is stored in memory location starting from X501H onwards. Find largest
number in the array. The number of elements in the array is stored in location X500H.
2. An array of 8-bit numbers is stored in memory location starting from X601H onwards. Find largest
number in the array. The number of elements in the array is stored in location X600H.
3. An array of 8-bit numbers is stored in memory location starting from X701H onwards. Pick all odd
numbers from the array and store them in location starting from X750H onwards. The number of
elements in the array is stored in location X700H.
4. An 8-bit number is stored in location X850H. Find the sum of nibbles of the 8-bit number
5. An array of 8-bit numbers is stored in memory location starting from X801H onwards. Arrange the
numbers in ascending order. The number of elements in the array is stored in location X800H.
6. An array of 8-bit numbers is stored in memory location starting from X801H onwards. Arrange the
numbers in descending order. The number of elements in the array is stored in location X800H.

a) Logical Group of Instructions.


Logical Instructions- These instructions perform various logical operations with the contents of the
accumulator.
AND, OR, Exclusive-OR of any 8-bit number, or the contents of a register, or of a memory location can be
logically AND ed, OR ed, or Exclusive-OR ed with the contents of the accumulator. The results are stored in
the accumulator.
Rotate Instructions- Each bit in the accumulator can be shifted either left or right to the next position.
Compare Instructions- Any 8-bit number or the contents of a register, or a memory location can be compared
for equality, greater than, or less than, with the contents of the accumulator.
Complement Instructions - The contents of the accumulator can be complemented. All 0s are replaced with
1s and all 1s are replaced with 0s.

Table 1: Various logical group of instructions of 8085


SI. Machine Addressing
Instructions Operation Bytes T-States Flag
No Cycle mode
1 ANA r [A]← [A] [r] 1 OF (1) 4 Register
Register
2 ANA M [A]← [A]  [[H][L]] 2 OF+MR (2) 4+3=7
indirect
3 ANI d8 [A] ← [A]  d8 2 OF+MR (2) 4+3=7 Immediate
Department of EEE TKMCE Kollam 2019 Scheme
MICROPROCESSOR LAB MANUAL
4 ORA r [A]← [A]  [r] 1 OF (1) 4 Register
Register
5 ORA M [A]← [A]  [[H][L]] 2 OF+MR (2) 4+3=7
indirect
6 ORI d8 [A] ← [A]  d8 2 OF+MR (2) 4+3=7 Immediate
7 XRA r [A]← [A]  [r] 1 OF (1) 4 Register
Register
8 XRA M [A]← [A]  [[H][L]] 2 OF+MR (2) 4+3=7
indirect
9 XRI d8 [A] ← [A]  d8 2 OF+MR (2) 4+3=7 Immediate
10 CMA [A] ← [𝐴̅] 1 OF (1) 4 Implicit
11 CMC ̅̅̅]
[CS] ← [CS 1 OF (1) 4 Implicit
12 STC [A] ← 1 1 OF (1) 4 Implicit
13 CMP r [A] - [r] 1 OF (1) 4 Register
Register
14 CMP M [A] - [[H][L]] 2 OF+MR (2) 4+3=7
indirect
15 CPI d8 [A] - d8 2 OF+MR (2) 4+3=7 Immediate
[An+1] ←[An];
16 RLC [A0] ←[A7]; 1 OF (1) 4 Implicit
[CY]←[A7];
[A7] ←[A0];
17 RRC [CY]←[A0]; 1 OF (1) 4 Implicit
[An]←[An+1];
[An+1] ←[An];
18 RAL [CY]←[A7]; 1 OF (1) 4 Implicit
[A0] ←[CY];
[An]←[An+1];
19 RAR [CY]←[A0]; 1 OF (1) 4 Implicit
[A7] ←[CY];

b) PROGRAMS
(i) Find largest number in the array
Memory Machine Code Label Mnemonics Comments
Address

X100 SUB A ; Clear accumulator


LXI H, X500H ; Initialize memory pointer
MOV C, M ; Move count to C register
LOOP: INX H ; Increment the memory pointer
CMP M ; Subtract number from content of A
JNC SKIP ; If [A]>the number go to SKIP
MOV A, M ; If [A]< number move the number to A
SKIP: DCR C ; Decrement the count
JNZ LOOP ; Repeat above process till [C]=0
LXI
STA H,XX50H
X550H ; Save the largest number into X850H
HLT ; Stop

Department of EEE TKMCE Kollam 2019 Scheme


MICROPROCESSOR LAB MANUAL

Data: - Output: -
[X500] =05 [X550] =0A
[X501] =07
[X502] =04
[X503] =08
[X504] =09
[X505] =0A

(ii) Find smallest number in the array


Memory Machine Code Label Mnemonics Comments
Address
X100 SUB A ; Clear accumulator
LXI H, X600H ; Initialize memory pointer
MOV C, M ; Move count to C register
LOOP: INX H ; Increment the memory pointer
CMP M ; Subtract number from content of A
JC SKIP ; If [A]< the number go to SKIP
MOV A, M ; If [A]> number move the number to A
SKIP: DCR C ; Decrement the count
JNZ LOOP ; Repeat above process till [C]=0
LXI
STA H,XX50H
X650H ; Save the largest number into X850H
HLT ; Stop

Data: - Output: -
[X600] =05 [X550] =04
[X601] =07
[X602] =04
[X603] =08
[X604] =09
[X605] =0A

Department of EEE TKMCE Kollam 2019 Scheme


MICROPROCESSOR LAB MANUAL
(iii) Pick odd numbers in an array.
Memory Machine Code Label Mnemonics Comments
Address
X100 LXI H, X700H ; Initialize memory pointer (Source)
LXI H, X750H ; Initialize memory pointer (Destination)
MOV C, M ; Move count to C register
UP: INX H ; Increment the memory pointer (Source)
MOV A, M ; Move the number to A
RRC ; [A] is Rotated 1 position right
JNC DOWN ; If no carry (if number is even) go to DOWN
RLC ; Recover original number in to A
STAX D ; Store the odd number to destination Loc.
LXI
INX H,XX50H
D ; Increment the memory pointer (Destination)
DOWN: DCR C ; Decrement the count
JNZ UP ; Repeat above process till [C]=0
HLT ; Stop

Data: - Output: -
[X700] =05 [X750] =
[X701] =07 [X751] =
[X702] =04 [X752] =
[X703] =08 [X753] =
[X704] =09 [X754] =
[X705] =0A

(iv) sum of nibbles of the 8-bit number


Memory Machine Code Label Mnemonics Comments
Address

X100 LXI H, X850H ; Initialize memory pointer (Source)


MOV A, M ; Load the number to A
ANI 0FH ; Separate LSB nibble
MOV B, A ; Save LSB nibble to B register
MOV A, M ; Load the number to A
ANI F0H ; [A]  F0H → [A]
RRC ; Rotate (A) right
RRC ; Rotate (A) right
RRC ; Rotate (A) right
RRC ; Rotate (A) right
ADD B ; [A]+[B]→ [A]
INX H ; Increment the memory pointer
MOV M, A ; Save the result into next location
HLT ; Stop

Department of EEE TKMCE Kollam 2019 Scheme


MICROPROCESSOR LAB MANUAL

Data: - Output: -
[X850] =05 [X851] =

(v) Numbers in ascending order


Memory Machine Code Label Mnemonics Comments
Address

X100 LXI H, X800H ; Initialize the memory pointer


MOV D, M ; Move number of elements in the array to D
DCR D ; Count for outer loop comparison
L2: LXI H, X800H ; Initialize the memory pointer
MOV C, M ; Move number of elements in the array to C
DCR C ; Count for inner loop comparison
INX H ; Increment the memory pointer
MOV A, M ; Move the number to A
L1: INX H ; Increment the memory pointer
MOV B, M ; Move the number to B register
CMP B ; [A]-[B]
JC DOWN ; If [A]< number, no need to replace [A]
MOV M, A ; If [A]> number, [A]→M, & M→ Prev loc
DCX H ; Previous location
MOV M, B ; [B] → [[H][L]]
INX H ; Increment the memory pointer to retain last Loc
DOWN: DCR C ; Reduce inner loop count by 1
JNZ L1 ; Repeat inner loop comparison till [C] = 0
DCR D ; Reduce outer loop count by 1
JNZ L2 ; Repeat inner loop comparison till [D] = 0
HLT ; Stop

Data: - Output: -
[X800] = [X800] =
[X801] = [X801] =
[X802] = [X802] =
[X803] = [X803] =
[X804] = [X804] =
[X805] = [X805] =
[X806] = [X806] =
[X807] = [X807] =
[X808] = [X808] =
[X809] = [X809] =
[X80A] = [X80A] =

Department of EEE TKMCE Kollam 2019 Scheme


MICROPROCESSOR LAB MANUAL
(vi) Numbers in descending order
Memory Machine Code Label Mnemonics Comments
Address
X100 LXI H, X800H ; Initialize the memory pointer
MOV D, M ; Move number of elements in the array to D
DCR D ; Count for outer loop comparison
L2: LXI H, X800H ; Initialize the memory pointer
MOV C, M ; Move number of elements in the array to C
DCR C ; Count for inner loop comparison
INX H ; Increment the memory pointer
MOV A, M ; Move the number to A
L1: INX H ; Increment the memory pointer
MOV B, M ; Move the number to B register
CMP B ; [A]-[B]
JNC DOWN ; If [A]< number, no need to replace [A]
MOV M, A ; If [A]> number, [A]→M, & M→ Prev loc
DCX H ; Previous location
MOV M, B ; [B] → [[H][L]]
INX H ; Increment the memory pointer to retain last Loc
DOWN: DCR C ; Reduce inner loop count by 1
JNZ L1 ; Repeat inner loop comparison till [C] = 0
DCR D ; Reduce outer loop count by 1
JNZ L2 ; Repeat inner loop comparison till [D] = 0
HLT ; Stop

Data: - Output: -
[X800] = [X800] =
[X801] = [X801] =
[X802] = [X802] =
[X803] = [X803] =
[X804] = [X804] =
[X805] = [X805] =
[X806] = [X806] =
[X807] = [X807] =
[X808] = [X808] =
[X809] = [X809] =
[X80A] = [X80A] =

Department of EEE TKMCE Kollam 2019 Scheme


MICROPROCESSOR LAB MANUAL
Date: EXPT NO: 5
CODE CONVERSION

AIM: To write and test assembly language programs to do the following


task and also draw the flow charts
a) Convert 8 bit binary stored in memory to equivalent BCD
Table 31: Binary to BCD conversion

Memory Address Machine Code Label Mnemonics Comments

MVI C,00H ; Clear B


MOV B, C ; Clear C
LXI H,4600H ; Initialize MP
MOV A, M ; Move number to A
HUND: CPI 64H ; comp num with 64H
JC TENS ; if CY=1 go to label TENS
SUI 64H ; Number- 64H
INR B ; Increment number of 100s
JMP HUND ; Jump to label HUND
TENS: CPI 0AH ; comp num with 0AH
JC ONES ; if CY=1 go to label ONES
SUI 0AH ; Number- 0AH
INR C ; Increment number of 10s
JMP TENS ; Jump to label TENS
ONES: INX H ; Increment MP
MOV M, A ; Move num of Ones
INX H ; Increment MP
MOV M, C ; Move num of Tens
INX H ; Increment MP
MOV M,B ; Move num of Hundreds
HLT ; Stop

Data: [4600] → FF
Output: [4601] → 05 [4602] → 05 [4603] → 02
i.e BCD is 255

Department of EEE TKMCE Kollam 2019 Scheme


MICROPROCESSOR LAB MANUAL

Program
Table 32: BCD to binary conversion

Memory Address Machine Code Label Mnemonics Comments


LXI H,4300H
MOV A, M
ANI 0F
MOV B, A
MOV A, M
RRC
RRC
RRC
RRC
MOV D, A
MVI A,00H
MOV E,0A
UP: ADD D
DCR E
JNZ UP
ADD B
STA 4301
HLT

DATA: [4300] → 99
OUTPUT: [4301] → 63

RESULT:-

The given arithmetic and logic programs were written and executed.

40
Dept. of EEE T.K.M COLLEGE OF ENGINEERING
MICROPROCESSOR LAB MANUAL

Date: EXPT NO: 6

STUDY OF I/O AND MACHINE CONTROL GROUP OF


INSTRUCTIONS
AIM: A) To study all the I/O and machine control group of instructions of 8085

B) To write and test assembly language program to evaluate P=A*B+C*D where


A,B, C & D are one byte numbers.

33: I/O and Machine Control group of instructions

Si Machine T- Addressing
Instructions Comments
No Cycle states modes
[A] ← [Port address];
1 IN Port add (8) Content of input port 3 10 Direct
address is moved in to
Accumulator
[Port address] ← [A];
2 OUT Port add (8) Content of Accumulator is 3 10 Direct
moved in to port address

sp=sp-1;
3 PUSH rp (rph)→ sp-1; sp=sp-2; Register
3 13
(rpl) → sp-2 indirect

sp=sp-1;
(A)→ sp-1; sp=sp-2; Register
3 12
4 PUSH PSW (FR) → sp-2 indirect

(rpl)← (sp); sp=sp+1;


(rph) ← (sp+1) Register
5 POP rp 3 10
sp =sp+2 indirect

(FR)← (sp); sp=sp+1;


(A) ← (sp+1) Register
6 POP PSW 3 10
sp =sp+2 indirect

7 Processor will halt by this 1 5 --


HLT
instruction
8 NOP No operation is performed 1 5 --
9 EI Enables interrupt system 1 4 --
10 DI Disable interrupt system 1 4
--

27
Dept. of EEE T.K.M COLLEGE OF ENGINEERING
MICROPROCESSOR LAB MANUAL
Implement the 8085 interrupts --
11 SIM RST 7.5, RST 6.5, and RST 5.5, 1 4
and serial data output.
Read the status of interrupts 7.5,
12 RIM 6.5, 5.5 and read serial data input 1 4 --
bit.
Copy H-L pair to the Stack
Pointer (SP) , Loads the contents 1 6 --
13 SPHL
of H-L pair into SP.
[SP] ←[H][L]

Exchange H–L with top of stack


14 [L]↔ [[SP]] 5 16 Register
XTHL
[H] ↔[[SP+1]] indirect

PROGRAMS

Repeated multiplication using subroutine


Find P = A*B+C*D

Repeated multiplication using subroutine (Main Program)

Memory Address Machine Code Label Mnemonics Comments


LXI SP 3FFF
LXI H 3500H
MOV B, M
INX H
MOV C, M
CALL MULT
INX H
MOV B, M
INX H
MOV C, M
XCHG
CALL MULT
DAD D
SHLD 3600H
HLT

Subroutine

Memory Address Machine Code Label Mnemonics Comments


MULT: MVI A,00H
MOV D, A
REPT: ADD B
JNC SKIP
INR D
SKIP: DCR C
JNZ REPT
MOV E, A
RET

28
Dept. of EEE T.K.M COLLEGE OF ENGINEERING
MICROPROCESSOR LAB MANUAL
Data:- Output:-
[3500] → 00 [3600]→0C
[3501] →01
[3502] →03
[3503] →04

RESULT: - The programs using I/O machine control group of instructions are written and verified

29
Dept. of EEE T.K.M COLLEGE OF ENGINEERING
MICROPROCESSOR LAB MANUAL

Date: EXPT NO: 7


STUDY OF PROGRAMMABLE PERIPHERAL INTERFACE 8255
AIM : A) To study the functioning of 8255 PPI

B) To generate a rectangular wave of duty cycle 60%

STUDY OF 8255 PPI


The main function of PPI 8255 is to interface peripheral device to the microprocessor.
It has 8bit ports-Port A, Port-B ,Port-C. Port C is divided into 4 pots. Port C upper and Port C
lower. Each port can be programmed either as input port or output port.

Figure 6 : Functional Diagram Of 8255 PPI

ARCHITECTURE OF 8255
✓ Intel 8255 is a 40 pin IC package
✓ Operate on single 5V supply
✓ ambient temperature 0-70 degree Celsius
✓ VOT=2.4V

30
Dept. of EEE T.K.M COLLEGE OF ENGINEERING
MICROPROCESSOR LAB MANUAL

Figure 7: Pin details of 8255 PPI

For the purpose of controlling the 4 I/O ports, they are divided into two groups namely Group
a and Group B. Group A contain Port A and Port Cupper. Group B contain Port B and Port Clower

CONTROL SIGNALS

𝑪𝑺- Chip select signal: Low status of 𝑐𝑠 enables communication between microprocessor.

𝑹𝑫- When 𝑅𝐷 goes low, it allows microprocessor to read data.

𝑾𝑹- Microprocessor writes data input output port of 8255 and control word register when this goes
low.

𝑨0 & 𝑨1 - The selection of I/O port and CWR is done using 𝑨0 & 𝑨1

Table 42: of Control world register and ports of 8255 PPI


CS A1 A0 Address Selection
0 0 0 00 PORT – A
0 0 1 01 PORT – B
0 1 0 02 PORT – C
0 1 1 03 CONTROL REGISTER
1 X X -- 8255 is not selected

When system power up, RESET signal applied to 8255 and clear the control register and set all
ports to input port. 8255 will continue in this state until µP give a control word in control
register. Control word determines the modes of operation of 8255

31
Dept. of EEE T.K.M COLLEGE OF ENGINEERING
MICROPROCESSOR LAB MANUAL

OPERATING MODES OF 8255

Basically 8255 has two modes of operation. I/O mode and BSR mode of operation. I/O
mode operations can again classified into three categories mode0, mode1, mode2.

Mode 0: It is a simple input or output mode. This mode of operation is applicable to PORT A, PORT B
& PORT C. Here any port can be either input or output. There is no need of control signals to
write or read data from specified port.

Mode 1: (strobbed I/O mode of operation)

Port A and port B can be operated in this mode and pins of port C ( 6 pins : 3 pins for A and 3 pins for B)
are need to control port A and port B. 𝑃𝐶0, 𝑃𝐶1& 𝑃𝐶2 are used to control port B. if port A is designed
an input port in mode 1. 𝑃𝐶3, 𝑃𝐶4& 𝑃𝐶5 are used for controlling port A.
If port A is designed as output port in mode 1, 𝑃𝐶3, 𝑃𝐶5& 𝑃𝐶7 are used to control it. In all cases,
remaining pins of port C can be as input or output.
Mode 2: (Bidirectional mode)

This mode of operation is only for port A. Here port A can be operated as bidirectional port.
When port A is programmed in mode 2, Port B can be used in either mode 0 or mode 1. Here 𝑃𝐶0 to
𝑃𝐶7are used for controlling port A.
BSR mode of operation: (Bit Set Mode)

By using BSR mode of operation, any bits of port C can set or cleared. Control word
format with BSR bit is shown in fig.

Figure 8: Bit pattern for BSR mode of 8255 PPI

32
Dept. of EEE T.K.M COLLEGE OF ENGINEERING
MICROPROCESSOR LAB MANUAL

Control word format for I/O and BSR mode of operation is illustrated in figure below

Figure 9: Control word format for I/O and BSR mode

For making all ports of 8255 as output port the control word data is obtained as follows

and corresponding program is


MVI A,80H ; Control word in accumulator
OUT 03H ; Control word in control word register
ii) To generate a rectangular wave of duty cycle 60% and frequency 1KHz

Design of delay program


Duty cycle=0.6
𝑻𝑶𝑵
𝒊. 𝒆 = 𝟎. 𝟔
𝑻

33
Dept. of EEE T.K.M COLLEGE OF ENGINEERING
MICROPROCESSOR LAB MANUAL

Frequency= 1KHz

T= 1/f= 1ms

𝑇𝑂𝑁 = 0.6 𝑚𝑠 <DELAY 1>

𝑇𝑂𝐹𝐹 = 0.4 𝑚𝑠 <DELAY 2>


Table 43: Design of delay program
Delay instructions T-states
MVI C, N 7
REPEAT: DCR C 4N
JNZ REPEAT 10(N-1)+7
RET 10

Time delay= 7 + 4𝑁 + 10 𝑁 − 1 + 7 + 10 =
=(14N+14) T States

DELAY ON DELAY OFF


TON =0.6ms TOFF =0.4ms
=𝟎. 𝟔 × 𝟏𝟎−𝟑 =𝟎. 𝟒 × 𝟏𝟎−𝟑
= 𝟏𝟒𝑵 + 𝟏𝟒 𝟑𝟐𝟎 × 𝟏𝟎−𝟗 = 𝟏𝟒𝑵 + 𝟏𝟒 𝟑𝟐𝟎 × 𝟏𝟎−𝟗
= 𝟏𝟑𝟑𝟏𝟎 = 𝟖𝟓𝑯 = 𝟖𝟖𝟏𝟎 = 𝟓𝟖𝑯

34
Dept. of EEE T.K.M COLLEGE OF ENGINEERING
MICROPROCESSOR LAB MANUAL

Table 44: Program for generation of square wave with 60% duty cycle

Memory Machine Code Label Mnemonics Comments


Address
MVI A,80H
OUT 33H
LOOP: MVI A, FF
OUT 30H
CALL DELAY ON
MVI A,00H
OUT 30H
CALL DELAY OFF
JMP LOOP
HLT

DELAY ON: MVI D,85H


REPEAT: DCR D
JNZ REPEAT
RET

DELAY OFF: MVI D,58H


REPEAT: DCR D
JNZ REPEAT
RET

Results:
Studied the functioning of 8255 PPI and a square wave of duty cycle 60% and frequency
1KHZ was generated.

35
Dept. of EEE T.K.M COLLEGE OF ENGINEERING
MICROPROCESSOR LAB MANUAL

Date: EXPT NO: 8


INTERFACING OF ADC
AIM :

To study ADC0809 and to interface it with 8085.

ADC-0809 A/D Card DESCRIPTION


ADC-0809 A/D Card is an 8-bit analog to digital converter with 8 Channel
Multiplexer and microprocessor compatible control logic.
The heart of the card is ADC-0809 monolithic C-MOS device. Its conversion time is
100 u-sec. It eliminates the need for external zero and full scale adjustment. The card selects
one of the eight uni polar inputs by using the address decoder. ADC-0809 uses successive
approximation as conversion techniques. Input is latched to the deodar on the low to high
transition of the address latch enable signal. The conversion starts on the falling edge of the
start of conversion signal. During the process end of conversion signal goes low otherwise it
remains high. Digital output can be read from ADC making output enable signal high.
All eight input of 0-5 Volts ADC-0809 along with external clock, external EOC, external SOC
signals are brought to 26-pin connecter C1. All control signals and digital output signals of
ADC-0809 are brought to 26-pin connector C2. One 8255 PPI along with 8085 UP can be
used to get analog to digital conversion data.
A clock input of a specified frequency is required for the operation of ADC-0809. A Counter 74
LS 93 has been used for this purpose. The user can use either internal clock or external clock.
For use of internal clock, connect pins 2&3 through jumper at clock position and also select
one of clock out of four clocks marked by X1, X2, X3, X4 on the card.
For use of external clock, connect pins 1&2 through jumper at clock position and also give
clock pulse at pin No.9 or connector C1.
Similarly Start of Conversion pulse and End of Conversion pulse can be given either by software
or by external signal. Connect pins 1&2 through jumper at SOC to give the software pulse,
otherwise connect pins 1&3 through jumper through jumper at SOC to give external SOC pulse
at pin no.10 of connector C1.
Connect pins 2&3 through jumper at EOC to give software pulse, otherwise connect pins
1&2 through jumper at EOC to give external EOC pulse.
Connect pins 2&3 at O/P ENBL to give software pulse. Otherwise connect pin
1&2 at O/P ENBL to give external pulse.
The card will also display digital data on LED’s. The corresponding LED’s show if the bits are high,
otherwise remain off.
Example: This is a program written for 8085 CPU system having 8255-1 at
address: Port A -30
Port B -31
Port C -32
Control word -33

36
Dept. of EEE T.K.M COLLEGE OF ENGINEERING
MICROPROCESSOR LAB MANUAL

For other CPU’s and PPI, the program has to be modified accordingly. The program written is
for STS 8085 Microprocessor Training Kit and are executed from 2000 Address. The selected
channel at location 2008 input is to be fed at Pin Analog Input CONN. (Pin No.15 for channel
1) and GND. The conversion table is as follows.
00.00V - 00
01.25V - 3F
02.50V - 7F
5.1 - FF
Table 45: Program for interfacing ADC 0809

Memory Machine Code Label Mnemonics Comments


Address
2000 31 FF 20 LXI SP, 20FF

2003 3E 98 MVI A,98 ; Initialize 8255 port


2005 D3 33 OUT33

2007 3E 07 LOOP 1: MVI A, 07 ; Select Channel No.

2009 D3 31 OUT 31
200B 3E 00 MVI A, 00

200D D3 32 OUT 32

200F 3E 03 MVI A, 03 ; ALE & Start of conversion pulse

2011 D3 32 OUT 32

2013 3E 00 MVI A, 00

2015 D3 32 OUT 32

2017 DB 32 LOOP 2: IN 32

2019 E6 10 ANI 10 ; Check EOC

201B CA 17 20 JZ LOOP 2
201E 3E 04 MVI A, 04 ; Output enable

2020 D3 32 OUT 32

2022 DB 30 IN 30 ; Read ADC data

2024 32 F6 27 STA 27F6

2027 CD 47 03 CALL CLEAR ; Clear display

202A 11 00 00 LXI D 0000 ; Call delay


202D CD BC 03 CALL DELAY

2030 CD FA 06 CALL MODDOT ; Display data

2033 11 00 00 LXI D 0000 ; Call delay


2036 CD BC 03 CALL DELAY

2039 C3 07 20 JMP LOOP 1 ; Select none sample

60
Dept. of EEE T.K.M COLLEGE OF ENGINEERING
MICROPROCESSOR LAB MANUAL

Data:- Output:-
GND [27F6]=00

+5V [27F6]=FF

RESULT:-

ADC 0809 was interfaced with microprocessor 8085 and the digital output
corresponding to analog input was obtained.
MICROPROCESSOR LAB MANUAL

Date: EXPT NO: 9


INTERFACING OF DAC
AIM :
To study DAC 0800 and to generate a triangular wave of frequency 1 KHZ.

DAC 0800 is a monolithic, high speed, current output digital to analog converter. IC
74LS138 forms the address decoding logic. Address lines 𝐴3, 𝐴4 & 𝐴5are tied to pins 1,2
and 3 of 74LS138. 𝐴6 and 𝐴7 are NAND together and connected to pin 5. 𝐴6 and
𝐴7 are NAND together and 𝐼 𝑂 𝑀 and 𝐼 𝑂 𝑅 connected to pin 6.pin 4 is grounded.
The latch74LS138 is selected when the address is 11001000=C8H.The data latched
by 74LS138 is the input to DAC. DAC converts 8 bit complementary current output. The
current to voltage converter designed using 741 converts the current output of DAC into
equivalent analog voltage.

Design of triangular wave


Frequency=1 KHZ

Table 46: Design of delay program for generating ramp wave


Therefore, T= 1/f=1ms
Delay instructions T-states
MVI A,00H 7
L1: OUT C8 10N
INR A 4N
CPI N 7N
JNZ L1 10(N-1)+7
Total t states (31N+4)T
(31N+4)320ns=0.5ms

N=50b=32H

Figure 11: Triangular wave


MICROPROCESSOR LAB MANUAL

Program for interfacing DAC Module with 8085 microprocessor

Memory Machine Label Opcode OPERAND COMMENTS


Address Code
MVI A,00 ; (A)← 00
OUT C8 ;(A) → (C8)
INR A ;*A+ ←**A++1+
CPI 32 ;[A] -32
JNZ 𝐿1 ;if no zero, go to 𝐿1
OUT C8 ;(A) → (C8)
DCR A ;*A+ ←*A+-1
CPI 00 ;[A] -00
JNZ 𝐿3 ; if no zero, go to 𝐿3
JMP LOOP ;JUMP TO LOOP

RESULT:-

DAC 0800 was interfaced with microprocessor 8085 and a triangular wave of frequency 1KHz was
generated.
MICROPROCESSOR LAB MANUAL

Experiment No. 10(a)


Familiarization of Arduino IDE
Aim:

a) Familiarization of Arduino IDE

Theory: Introduction to Arduino board

Arduino is an open-source prototyping platform based on easy-to-use hardware and software.


Arduino boards are able to read inputs - light on a sensor, a finger on a button, or a Twitter message - and
turn it into an output - activating a motor, turning on an LED, publishing something online. You can tell
your board what to do by sending a set of instructions to the microcontroller on the board. To do so you
use the Arduino programming language (based on Wiring), and the Arduino Software (IDE), based on
Processing.

Arduino Uno

Arduino also simplifies the process of working with microcontrollers, but it offers some advantage for
teachers, students, and interested amateurs over other systems which are inexpensive, cross-platform,
Simple, clear programming environment, Open source and extensible hardware etc.
MICROPROCESSOR LAB MANUAL

Pin Diagram of Arduino Uno


The basic structure of the Arduino programming language is fairly simple and runs in at least two parts.
These two required parts, or functions, enclose blocks of statements. Where setup () is the preparation,
loop () is the execution. Both functions are required for the program to work.

The setup function should follow the declaration of any variables at the very beginning of the program. It
is the first function to run in the program, is run only once, and is used to set pinMode or initialize serial
communication.

The loop function follows next and includes the code to be executed continuously-reading inputs, triggering
outputs etc. This function is the core of all Arduino programs and does the bulk of the work. Curly braces
( {} )define the beginning and the end of function blocks and statement blocks such as the void loop()
function and the for and if statements.
MICROPROCESSOR LAB MANUAL

Programming using Arduino IDE

Step 1 − Download Arduino IDE Software: You can get different versions of Arduino IDE from
the Download page on the Arduino Official website. You must select your software, which is
compatible with your operating system (Windows, IOS, or Linux). After your file download is
complete, unzip the file.
Step 2 − Power up your board: The Arduino Uno automatically draw power from either, the USB
connection to the computer or an external power supply. Connect the Arduino board to your computer
using the USB cable. The green power LED (labeled PWR) should glow.
Step 4 − Launch Arduino IDE
MICROPROCESSOR LAB MANUAL

Step 5 − Open your first project: Once the software starts, you have two options −

• Create a new project.


• Open an existing project example.
To create a new project, select File → New.

To open an existing project example, select File → Example → Basics → Blink.


Here, we are selecting just one of the examples with the name Blink. It turns the LED on and off with
some time delay. You can select any other example from the list.

Step 6 − Select your Arduino board: To avoid any error while uploading your program to the board, you
must select the correct Arduino board name, which matches with the board connected to your computer.
Go to Tools → Board and select your board
Step 7 − Select your serial port: Select the serial device of the Arduino board. Go to Tools → Serial Port
menu. This is likely to be COM3 or higher (COM1 and COM2 are usually reserved for hardware serial
ports). To find out, you can disconnect your Arduino board and re-open the menu, the entry that
disappears should be of the Arduino board. Reconnect the board and select that serial port.
Step 8 − Upload the program to your board: Before explaining how we can upload our program to the
board, we must demonstrate the function of each symbol appearing in the Arduino IDE toolbar. Now,
simply click the "Upload" button in the environment. Wait a few seconds; you will see the RX and TX LEDs
on the board, flashing. If the upload is successful, the message "Done uploading" will appear in the status
bar.
MICROPROCESSOR LAB MANUAL

A − Check if there is any compilation error. B − Upload a program to the Arduino board.
C − Shortcut to create a new sketch. D − Open one of the example sketch.
E − Used to save your sketch. F − Serial monitor for serial data transfer
MICROPROCESSOR LAB MANUAL

Experiment No. 10 (b)

LED control using Arduino


Aim:

a) Blinking inbuilt LED with different on off time delays


b) Blinking externally interfaced LED with different on off time delays

Hardware required:

No. Item Specification Quantity


1 Arduino board Arduino Uno 1
2 LED 1
3 Resistor 220 Ohm 1
4 Bread board and connection wires

Connection Diagram:

Circuit for blinking of Internal LED (No External connection required)

Circuit for blinking of external LED on Pin 1


MICROPROCESSOR LAB MANUAL

Sample Program for external LED blink on Pin-1:

void setup() // run once

pinMode(1, OUTPUT); // sets pin 1 as output

void loop() // run over and over again

digitalWrite(1, HIGH); // turns the LED on

delay(1000); // pauses for 1 second

digitalWrite(1, LOW); // turns the LED off

delay(1000); // pauses for 1 second

Output:

Result:
MICROPROCESSOR LAB MANUAL

Experiment No. 11
DC Motor Speed Control using Arduino

Aim: To control the speed of a DC motor using MOSFET driven by PWM signal from Arduino module

Hardware required:

No. Item Specification Quantity


1 Arduino board Arduino Uno 1
2 MOSFET or MOSFET based motor IRF 510 1
driver board
3 DC Motor 9V 1
4 Bread board and connection wires

Connection Diagram:

Study: To control a load with more than 40ma current requirement using the Arduino, a MOSFET or
transistor could be used to switch higher current loads. Also motor speed control requires voltage
variation, which could be achieved by using the PWM variable voltage signal available from the PWM
enabled digital pins of the Arduino.
MICROPROCESSOR LAB MANUAL

Sample Program for DC motor speed control:

void setup()

pinMode(5, OUTPUT); // sets PWM Pin 5 as output

void loop()

for (int i=0; i<255; i++) // Motor speed increasing

analogWrite(5, i); // turns MOSFET on

delay(250); // pauses 1/4 second

delay(1000); // pauses 1 second

for (int i=255; i>0; i--) // Motor speed decreasing

analogWrite(5, i); // turns MOSFET on

delay(250); // pauses 1/4 second

delay(1000); // pauses 1 second

Output:

Result:
MICROPROCESSOR LAB MANUAL

Experiment No. 12
Voltage Measurement using Arduino

Aim: Arduino based voltage measurement of 12V solar PV module or 12V battery and displaying the
measured value using I2C LCD display.

Hardware required:

No. Item Specification Quantity


1 Arduino board Arduino Uno 1
2 LCD display with I2C adapter 16x2 (1602) Character (5x7 Dot 1
Matrix Character and Cursor)
Green Backlight LCD Display
with attached 4 pin I2C adapter
3 Voltage Source 9V Battery 1
4 Resistor 1K, 2K 1 each
4 Bread board and connection wires 1

Connection Diagram:
MICROPROCESSOR LAB MANUAL

Study:

Arduino can measure only a maximum of 5V on the analog pins, and hence a potential divider arrangement
using resistors is used to reduce the voltage to be measured, and later a multiplication factor is used in
the program to scale the obtained value to actual voltage value.

LCD 16X2: An electronic device that is used to display data and the message is known as LCD 1602. It
includes 16 Columns and 2 Rows so it can display 32 characters (16×2=32) in total. Every character will be
made with 5×8 (40) Pixel Dots and the total pixels within this LCD can be calculated as 32 x 40 or 1280
pixels. The data register inside the display is used to save the date to exhibit on the LCD.

I2C Protocol: The Inter-Integrated Circuit (I2C) Protocol is a protocol intended to allow multiple peripheral
digital integrated circuits to communicate with one or more controller chips. I2C requires only two wires
to communicate in serial mode, but those two wires can support up to 1008 peripheral devices, each
having an address. Each I2C bus consists of two signals: SDA (Serial Data) - the data signal and SCL (Serial
Clock)- the clock signal. The clock signal is always generated by the Master or the current bus controller.

I2C Line Pin in Arduino

SDA A4, SDA

SCL A5, SCL


MICROPROCESSOR LAB MANUAL E5-A ,2019-24 (MMOE)

Sample Program:

#include <Wire.h> // library for I2C


#include <LiquidCrystal_I2C.h> // Arduino library for I2C LCD
displays LiquidCrystal_I2C lcd(0x27,20,4); //Set the LCD
address to 0x27 (default)

void setup()
{
lcd.init(); // Initialize the lcd
lcd.backlight(); // Turn on backlight of lcd
lcd.setCursor(2,0); //Setting display curser position (Col 2, Row
0) lcd.print("VOLTMETER"); // Show on LCD display from
cursor position
}

void loop()

{
lcd.setCursor(0,1); // Set Cursor to (Column 0, Row 1)
lcd.print("VOLT ="); // Display the characters
float mf = 3; // Multiplication factor corresponding to
resistors int x = analogRead(A0); // Read input Voltage from A0
float value = (x*mf*5)/1024; // Convert input to actual voltage
value lcd.setCursor(6,1); //Set Cursor to (Column 6, Row
1)
lcd.print(value); // Display the voltage
delay(500); // Delay 0.5s
}

Output:

Result:

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy