EE8681 MPMC Lab
EE8681 MPMC Lab
EE8681 MPMC Lab
OBJECTIVES:
SYLLABUS:
1
S.NO DATE LIST OF EXPERIMENTS PAGE NO
2
Ex. No: 1 SIMPLE ARITHMETIC OPERATION
AIM:
To write an assembly language program to add, subtract, multiply and divide the given
data stored at two consecutive locations using 8085 microprocessor.
8 – BIT ADDITION
FLOW CHART:
START
A = A+B
STORE RESULT
STOP
ALGORITHM:
Initialize the pointer to the memory for data and result.
Load the data into A B.
Add the two data of A and B registers.
Store the result into Memory from A registers.
3
INPUT:
OUTPUT:
8502 27H.
PROGRAM:
Accumulator
into B register
Accumulator
Accumulator
Accumulator into
DISPLAY)
4
8 -BIT SUBTRACTION
FLOW CHART:
START
STOP
ALGORITHM:
Initialize the pointer to the memory for data and result.
Load the data into A B.
Subtract the two data of A and B registers.
Store the result into Memory from A registers.
5
INPUT:
OUTPUT:
8502 32H.
PROGRAM:
Accumulator
A register
DISPLAY)
6
8 BIT MULTIPLICATION
FLOWCHART: START
NO Is the YES
multiplier
is zero?
NO
Is the multiplier
is zero?
YES
STOP
7
ALGORITHM:
Initialize the pointer to the memory for data and result.
Load the data into A and B register
Multiplication the two data of A and B registers.
Store the result into Memory from A registers.
INPUT:
OUTPUT:
8502 0CH.
PROGRAM:
FLOW CHART:
START
YES
If dividend is <
divisor
2 to quotient register
YE
NO S
If dividend is <
divisor
ALGORITHM:
OUTPUT:
8502 05H (Quotient). 850300H (Reminder).
PROGRAM:
RESULT:
Thus the addition, subtraction, multiplication and division of two numbers was
performed using the 8085 microprocessor.
Ex. No: 2 SORTING OF AN ARRAY
AIM:
To write an assembly language program to arrange an array of data in ascending and
descending order and to find the smallest and largest data among the array.
A. ASCENDING ORDER
FLOW CHART:
START
NO
If the temp.reg
Is the count is
zero?
NO
START YES
NO
STOP
ALGORITHM:
Initialize the pointer to the memory for data and result.
Load the data into M and C register
Store the result into Memory from A registers.
INPUT:
OUTPUT:
PROGRAM:
START: MVI
8100 06 00 B,00 Initialize 00 into B register
FLOW CHART:
START
NO If the temp.reg
YES
Is the count is
START
zero?
NO
YES
YES
Is the swap flag is
START
zero?
NO
STOP
ALGORITHM:
Initialize the pointer to the memory for data and result.
Load the data into M and C register
Store the result into Memory from A registers.
INPUT:
OUTPUT:
PROGRAM:
START: MVI
8100 06 00 B,00 Initialize 00 into B register
ALGORITHM:
1. Place all the elements of an array in the consecutive memory locations.
2. Fetch the first element from the memory location and load it in the accumulator.
3. Initialize a counter (register) with the total number of elements in an array.
4. Decrement the counter by 1.
5. Increment the memory pointer to point to the next element.
6. Compare the accumulator content with the memory content (next
element).
7. If the accumulator content is smaller, then move the memory content
(largest element) to the accumulator. Else continue.
8. Decrement the counter by 1.
9. Repeat steps 5 to 8 until the counter reaches zero
10. Store the result (accumulator content) in the specified memory location.
D.SMALLEST ELEMENT IN AN ARRAY
ALGORITHM:
1. Place all the elements of an array in the consecutive memory locations.
2. Fetch the first element from the memory location and load it in the accumulator.
3. Initialize a counter (register) with the total number of elements in an array.
4. Decrement the counter by 1.
5. Increment the memory pointer to point to the next element.
6. Compare the accumulator content with the memory content (next
element).
7. If the accumulator content is smaller, then move the memory content
(largest element) to the accumulator. Else continue.
8. Decrement the counter by 1.
9. Repeat steps 5 to 8 until the counter reaches zero
10. Store the result (accumulator content) in the specified memory location.
STOP
RESULT:
Thus the sorting operations of arranging an array in ascending, descending order and
the largest and smallest element were found using the 8085 microprocessor.
Ex. No: 3 CODE CONVERSIONS
FLOW CHART:
START
NO
Is multiplication
complete?
YES
Add B value with Accumulator
STOP
ALGORITHM:
Initialize the pointer to the memory for data and result.
BCD to Binary values the two data of A and B registers.
Store the result into Memory from A registers.
INPUT:
OUTPUT:
8510 0FH
PROGRAM:
8100 Load8100valueinto
3A 00 85 LDA 8500 Accumulator
810B 0F RRC
810C 0F RRC
810D 0F RRC
FLOW CHART:
START
NO
If the
value > 9
YES
Add ‘07’
Add ‘30’
NO
If the
YES
Add ‘07’
Add ‘30’
STOP
ALGORITHM:
Initialize the pointer to the memory for data and result.
Load the data into D and E register
ASCII to Hex code conversion the two data of M and B registers.
Store the result into Memory from 8100H
INPUT:
8500 A1H
OUTPUT:
8501 41H
8502 31H
PROGRAM:
8107 0F RRC
8108 0F RRC
8109 0F RRC
Now convert the lower nibble to
810A CD 15 81 CALL LOOP ASCII
LOOP: ANI
8115 E6 0F 0F Mask the higher nibble
DA1E
8119 81 JC LOOP2 If A not > 9 then simply add 30
RESULT:
Thus the assembly language programs for various code conversions are executed using
8085 microprocessor
EX.No:4 4(a) INTERFACING A/D AND D/A CONVERTER WITH 8085
AIM:
PROBLEM STATEMENT:
To program starts from memory location 4100H. The program is executed for various
values of analog voltage which are set with the help of a potentiometer. The LED display is
verified with the digital value that is stored in the memory location 4150H.
THEORY
An ADC usually has two additional control lines: the SOC input to tell the ADC when
to start the conversion and the EOC output to announce when the conversion is complete. The
following program initiates the conversion process, checks the EOC pin of ADC 0419 as to
whether the conversion is over and then inputs the data to the processor. It also instructs the
processor to store the converted digital data at RAM 4200H.
ALGORITHM:
PROGRAM:
9102 D3 33 OUT 33
9106 D3 31 OUT 31
910E D3 31 OUT 31
9112 D3 31 OUT 31
9114 E6 01 ANI 01
9116 CA 10 91 JZ LOOP
911B D3 31 OUT 31
9120 DB 30 IN 30
9122 CF RST 1
912B 05 DCR B
912F C9 RET
PROCEDURE:
Connect a 20 Pin FRC cable between s J4 port (first port) or J1 port (second port) and
the ADC Interface card.
Place jumper JP2 of ADC Interface Card in ‘I’ position.
Connect USB/PS2 keyboard on 8085 Microprocessor. Type and execute the
program.
Vary the analog input (Trim pot) and view the corresponding digital value in the LED
(D0 –D7) and the corresponding hex value will be displayed in Trainer Kits LCD.
4(b) DAC INTERFACING WITH 8085
APPARATUS REQUIRED:
S
OFTWARE EXAMPLES
The following examples illustrate how to control the DAC using 8085 and generate
sine
wave, saw tooth wave by means of software.
(a) SQUARE WAVE GENERATION:
The basic idea behind the generation of waveforms is the continuous generation of
Analog output of DAC. With 00(HEX) as input to DAC2, the analog output is -5V.
Similarly, with FF (Hex) as input, the output is +5V. Outputting digital data 00 and FF at
regular intervals, to DAC2, results in a square wave of amplitude I5 Volts
ALGORITHM:
1. Load the initial value (00) to Accumulator and move it to DAC.
2. Call the delay program
3. Load the final value (FF) to accumulator and move it to DAC.
4. Call the delay program.
5. Repeat steps 2 to 5.
PROGRAM:
9102 D3 33 OUT 33
9106 D3 30 OUT 30
910D D3 30 OUT 30
911D 05 DCR B
9121 C9 RET
AIM
PROGRAM:
9102 D3 33 OUT 33
9108 3C INR A
PROCEDURE:
Connect a 20 Pin FRC Cable between 8085 Microprocessor J4 port (first port) or J1
port(second port) and the DAC interface card.
Connect a 15v DC adapter with DAC interfacing board.
Connect the jumper J2 in down position.
Verify the sawtooth wave output using CRO. The CRO Probe must be connected
between BI polar (positive) and GND pin of J3 Header
Result:
Thus the conversion of an analog signal into a digital signal and a digital signal into an
analog signal was done using interfacing of ADC and DAC respectively with 8085.
EX.No:5 TRAFFIC LIGHT CONTROLLERS WITH 8085
AIM
To write an assembly language program to simulate the traffic light at an intersection
using a traffic light interface.
APPARATUS REQUIRED:
ALGORITHM:
1. Initialize the ports.
2. Initialize the memory content, with some address to the data.
3. Read data for each sequence from the memory and display it through the ports.
4. After completing all the sequences, repeat from step2.
PROCEDURE:
Connect a 20pin FRC cable between 8085 Trainers J4 port (First port) or J1 port
(second port) and the Traffic light controller.
Program can be tested with GPIO-II(8255) J4 or with GPIO I(8255) J1.
Type the Program by using USB/ PS2 Key board.
Execute the Program. Now Traffic Light Led’s are blinking
PROGRAM:
9103 0E 08 MVI C, 08
9105 7E MOV A, M
9106 D3 33 OUT 33
9108 23 INX H
910A D3 30 OUT 30
910C 23 INX H
910E D3 31 OUT 31
9113 23 INX H
9114 0D DCR C
9115 C2 09 91 JNZ LOOP1
9123 B3 ORA E
9127 0D DCR C
912B C1 POP B
912C C9 RET
ORG 9200H
9200 80 DB 80H
END
RESULT:
Thus an assembly language program to simulate the traffic light at an intersection using a
traffic light interfaces was written and implemented.
PROGRAM:
9100 3E 90 MVI A, 90
9106 DB 20 IN 20
AIM:
To write a program to initiate 8251 and to check the transmission and reception of
character.
PROCEDURE:
Place a jumper in J3 between middle and PCLK in 8251 And 8253 interface
card.
Take two And Two 8251 & 8253 interface card. .
Connect a 50Pin FRC Cable between 8085 and 8251 &8253 interface card.
Connect a RS232 FEMALE to FEMALE (cross cable) between two 8251 & 8253
interface card.
Enter the program,First Execute Receiver program
Then Execute the transmitter program.
Press the reset switch on both the .
The received characters are stored at the memory location 9200.
PROGRAM IN TRANSMITTER
9105 D3 23 OUT 23
9109 D3 22 OUT 22
910D D3 22 OUT 22
9111 D3 01 OUT 01
9113 D3 01 OUT 01
9115 D3 01 OUT 01
9119 D3 01 OUT 01
911D D3 01 OUT 01
911F 3E 05 MVI A,05
9121 D3 01 OUT 01
9126 D3 00 OUT 00
912B 23 INX H
912C 0D DCR C
9130 76 HLT
9139 05 DCR B
913D C9 RET
INPUT:
ADDRESS:
PROGRAM IN RECEIVER:
ADDRESS OPCODE LABEL MNEMONICS
9102 D3 23 OUT 23
9106 D3 22 OUT 22
910A D3 22 OUT 22
910E D3 01 OUT 01
9110 D3 01 OUT 01
9112 D3 01 OUT 01
9116 D3 01 OUT 01
911A D3 01 OUT 01
911E D3 01 OUT 01
9128 DB 00 IN 00
912B 23 INX H
912F DB 01 WAIT IN 01
9131 E6 02 ANI 02
9133 FE 02 CPI 02
9138 C9 RET
OUTPUT:
ADDRESS:
RESULT:
Thus an input/ output port/serial communication program to transfer the data for using 8051
interfaces was written and implemented.
AIM:
To interface 8279 Programable display controller to 8085 microprocessor.
APPARATUS REQUIRED:
AIM
To read a key and store the key code in memory location 9200. This code will
be entered into the FIFO whenever a key is pressed. Stored 9200 location (4x4Matrix
method)
PROCEDURE:
Connect a 50 Pin FRC Cable between 8051 Trainer Kit and the 8279
Keyboard/Display Interface card.
Connect USB/PS2 Keyboard on 8085 MicroprocessorJP1 port.
Type and Execute the Program by using USB/PS2 Keyboard.
Now press any key on 8279 keyboard/ display interface card the equal key value read
and stored in 9200H memory location in 4x4 matrix method.
PROGRAM:
9100 DB 62 LOOP: IN 62
9102 E6 07 ANI 07
9104 CA 00 91 JZ LOOP
9109 D3 62 OUT 62
910B DB 60 IN 60
910D E6 0F ANI 0F
9112 76 HLT
ROLLING DISPLAY
AIM:
To display the rolling message “HELLO “in the display.
PROCEDURE:
Connect a 50 Pin FRC Cable between 8051 Trainer Kit and the 8279
Keyboard/Display Interface card.
Connect USB/PS2 Keyboard on 8085 Microprocessor JP1 port.
Type and Execute the Program by using USB/PS2 Keyboard.
Now the Rolling Message “HELLO” would be display on 8279 keyboard/ display
interface card.
PROGRAM:
9107 D3 62 OUT 62
910B D3 62 OUT 62
910F D3 62 OUT 62
9112 D3 60 OUT 60
9117 23 INX H
9118 15 DCR D
912B C9 RET
ORG 9200H
9200 FF FF FF FF DB 0FFH,0FFH,0FFH,0FFH
9204 FF FF FF FF DB 0FFH,0FFH,0FFH,0FFH
9208 98 68 7C 7C DB 98H,68H,7CH,7CH
920C 0C FF FF FF DB 0CH,0FFH,0FFH,0FFH
END
RESULT:
thus 8279 controller was interfaced with 8085 and program for rolling display was
executed successfully.
MICROCONTROLLER
AIM:
To write an assembly language program to add, subtract, multiply and divide the given
data stored at two consecutive locations using 8051 microcontroller.
8- BIT ADDITION
ALGORITHM:
PROGRAM:
8- BIT SUBTRACTION
ALGORITHM:
Initialize the pointer to the memory for data and result.
The SUBB instruction writes the result in the accumulator.
Store the result into Memory from A registers.
INPUT:
MOV A,# 20
SUBB A,#10
OUTPUT:
8600 10H
PROGRAM:
ADDRESS OPCODES MNEMONICS COMMENDS
8500 74 20 MOV A,#20 Give 8 bit first data in A register
8-BIT MULTIPLICATIONS
THEORY:
Using the accumulator, Multiplication is performed and the result is stored.
Immediate addressing is employed.
The MUL instruction writes the result in the accumulator
INPUT:
MOV A,# 06H
MOV F0,#02H
OUTPUT:
8600 0CH
PROGRAM:
ADDRESS OPCODES MNEMONICS COMMENDS
8500 74 06 MOV A,#06
8502 75 F0 02 MOV F0,#02
8505 A4 MUL AB
8506 90 86 00 MOV DPTR,#8600
8509 F0 MOVX @DPTR,A
850A A3 INC DPTR
850B E5 F0 MOV A,F0
850D F0 MOVX @DPTR,A
850E 80 FE HERE: SJMP HERE
8-BIT DIVISION
THEORY:
Using the accumulator, Division is performed and the result is stored.
Immediate addressing is employed.
The div instruction writes the result in the accumulator
INPUT:
MOV A,# 08H
MOV F0,#02H
OUTPUT:
8600 04H
8601 00H
PROGRAM:
RESULT:
Thus the addition, subtraction, multiplication and division of two numbers was
performed using the 8051 microcontroller.
RESULT:
The sum of elements in an array is calculated.
ALGORITHM:
1. Start
2. Move the data to DPTR
3. Move the data to accumulator
4. Call check function whether given number is odd or even
5. Increment DPTR
6. Resultant value stored in DPTR-4201
7. Halt Check Function
8. Rotate right through carry
9. If carry copy 00 to B reg (odd number)
10. Else copy EE to B reg (even number)
11. return
PROGRAM:
Label Program Comments
MOV DPTR, #4200 Load 4200 to DPTR, get a number
MOVX A, @DPTR Copy value to A
CALL CHECK_EV_OD Call check function whether given number is
odd or even
INC DPTR
MOV A,B
HERE MOVX @DPTR, A Resultant value stored in DPTR-4201
SJMP HERE
OBSERVATION:
INPUT OUTPUT
4200 4201
RESULT:
Thus the given number is either even or odd has been found using 8051
microcontroller.
PROBLEM STATEMENT:
To program starts from memory location 4100H. The program is executed for
various values of analog voltage which are set with the help of a potentiometer. The LED
display is verified with the digital value that is stored in the memory location 4150H.
THEORY:
An ADC usually has two additional control lines: the SOC input to tell the ADC
when to start the conversion and the EOC output to announce when the conversion is
complete. The following program initiates the conversion process, checks the EOC pin of
ADC 0419 as to whether the conversion is over and then inputs the data to the processor. It
also instructs the processor to store the converted digital data at RAM 4200H.
ALGORITHM:
1. Select the channel and latch the address.
2. Send the start conversion pulse.
3. Read EOC signal.
4. If EOC =1 continue else go to step (3)
5. Read the digital output.
Store it in a memory location.
PROGRAM:
ADC- CIRCUIT:
APPARATUS REQUIRED:
THEORY:
SOFTWARE EXAMPLES
After going through the software examples you can learn how to control the
DAC using 8051 and generate sine wave, saw tooth wave etc by means of software.
ALGORITHM:
DAC - CIRCUIT:
WAVEFORMS:
PROGRAM:
The basic idea behind the generation of waveforms is the continuous generation of
Analog output of DAC.
With 00(HEX) as input to DAC2, the analog output is -5V. Similarly, with FF
(Hex) as input, the output is +5V. Outputting digital data 00 and FF at regular intervals, to
DAC2, results in a square wave of amplitude I5 Volts.
PROGRAM:
The following program will generate a triangular wave at DAC2 output. The
program is self explanatory.
Result:
Thus the square, triangular and saw tooth wave form were generated by interfacing
DAC with 8051 trainer kit.
Ex.No:10 STEPPER MOTOR INTERFACING WITH 8051
AIM:
THEORY:
A motor in which the rotor is able to assume only discrete stationary angular position is
a stepper motor. The rotary motion occurs in a step-wise manner from one equilibrium position
to the next. Stepper Motors are used very wisely in position control systems like printers, disk
drives, process control machine tools, etc.
The basic two-phase stepper motor consists of two pairs of stator poles. Each of the
four poles has its own winding. The excitation of any one winding generates a North Pole. A
South Pole gets induced at the diametrically opposite side. The rotor magnetic system has two
end faces. It is a permanent magnet with one face as South Pole and the other as North Pole.
The Stepper Motor windings A1, A2, B1, B2 are cyclically excited with a DC current
to run the motor in clockwise direction. By reversing the phase sequence as A1, B2, A2, B1,
anticlockwise stepping can be obtained.
2-PHASE SWITCHING SCHEME:
In this scheme, any two adjacent stator windings are energized. The switching scheme
is shown in the table given below. This scheme produces more torque.
9102 D3 33 OUT 33
START: LXI
9104 21 00 92
H,9200
REPET : MOV
9109 7E
A,M
910A D3 30 OUT 30
9110 1B DCX D
9112 B2 ORA D
9116 23 INX H
9117 05 DCR B
ORG 9200H
END
PROCEDURE:
1. Enter the above program starting from location 4100.and execute the same.
2. The stepper motor rotates.
3. Varying the count at R4 and R5 can vary the speed.
4. Entering the data in the look-up TABLE in the reverse order can vary direction of
rotation.
Result:
Thus a stepper motor was interfaced with 8051 and run in forward and reverse
directions at various speeds.