Mupi Lab Manual Part 1
Mupi Lab Manual Part 1
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.
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.
• 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.
• 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.
PIN Description
Address Bus
• 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
̅̅̅̅
𝐑𝐃
HOLD
• This indicates if any other device is requesting the use of address and data bus.
HLDA
INTR
INTA
• When the microprocessor receives interrupt signal, it has to be acknowledged.
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
• 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.
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
PROGRAMS
Data: - Output: -
[C] [FFH] [2050H] = FFH
Data: - Output: -
[2050H] = FFH [2051H] = FFH
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
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
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
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
Data: - Output: -
[2250H] = 01H [A] = 01H
Data: - Output: -
1st No FFB0H [2350] =B0H [2350] =A0H
[2351] =F1H [2351] =FFH
2nd No FFB0H [2360] =A0H [2360] =B0H
[2361] =FFH [2361] =F1H
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
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
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.
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.
B. PROGRAMS
HLT ; Stop
Data: - Output: -
[XX50] = [XXXX] =
[XX51] = [XXXX] =
[XX52] =
[XX53] =
[XX54] =
[XX55] =
….
Data: - Output: -
[XX80] =B0H [XX84] = H
First No FFB0H
[XX81] =FFH
[XX82] =A0H [XX85] = H
2nd No FFB0H
[XX83] =FFH
RESULTS
The various arithmetic group of instructions are studied and various programs were written, executed and
obtained the required results
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.
b) PROGRAMS
(i) Find largest number in the array
Memory Machine Code Label Mnemonics Comments
Address
Data: - Output: -
[X500] =05 [X550] =0A
[X501] =07
[X502] =04
[X503] =08
[X504] =09
[X505] =0A
Data: - Output: -
[X600] =05 [X550] =04
[X601] =07
[X602] =04
[X603] =08
[X604] =09
[X605] =0A
Data: - Output: -
[X700] =05 [X750] =
[X701] =07 [X751] =
[X702] =04 [X752] =
[X703] =08 [X753] =
[X704] =09 [X754] =
[X705] =0A
Data: - Output: -
[X850] =05 [X851] =
Data: - Output: -
[X800] = [X800] =
[X801] = [X801] =
[X802] = [X802] =
[X803] = [X803] =
[X804] = [X804] =
[X805] = [X805] =
[X806] = [X806] =
[X807] = [X807] =
[X808] = [X808] =
[X809] = [X809] =
[X80A] = [X80A] =
Data: - Output: -
[X800] = [X800] =
[X801] = [X801] =
[X802] = [X802] =
[X803] = [X803] =
[X804] = [X804] =
[X805] = [X805] =
[X806] = [X806] =
[X807] = [X807] =
[X808] = [X808] =
[X809] = [X809] =
[X80A] = [X80A] =
Data: [4600] → FF
Output: [4601] → 05 [4602] → 05 [4603] → 02
i.e BCD is 255
Program
Table 32: BCD to binary conversion
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
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
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]
PROGRAMS
Subroutine
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
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
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.
𝑾𝑹- 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
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
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.
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.
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
For making all ports of 8255 as output port the control word data is obtained as follows
33
Dept. of EEE T.K.M COLLEGE OF ENGINEERING
MICROPROCESSOR LAB MANUAL
Frequency= 1KHz
T= 1/f= 1ms
Time delay= 7 + 4𝑁 + 10 𝑁 − 1 + 7 + 10 =
=(14N+14) T States
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
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
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
2009 D3 31 OUT 31
200B 3E 00 MVI A, 00
200D D3 32 OUT 32
2011 D3 32 OUT 32
2013 3E 00 MVI A, 00
2015 D3 32 OUT 32
2017 DB 32 LOOP 2: IN 32
201B CA 17 20 JZ LOOP 2
201E 3E 04 MVI A, 04 ; Output enable
2020 D3 32 OUT 32
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
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.
N=50b=32H
RESULT:-
DAC 0800 was interfaced with microprocessor 8085 and a triangular wave of frequency 1KHz was
generated.
MICROPROCESSOR LAB MANUAL
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
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
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 −
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
Hardware required:
Connection Diagram:
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:
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
void setup()
void loop()
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:
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.
Sample Program:
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: