MPMC LAB Manual R20
MPMC LAB Manual R20
L T P C
III Year - II Semester
0 0 3 1.5
MICROPROCESSORS AND MICROCONTROLLERS LAB (R20)
LIST OF EXPERIMENTS
ENDP:
In assembly language programming, the subroutines are called procedures. Thus,
procedures may be Independent program modules which return particular results or values to
the calling programs. The ENDP Directive is used to indicate an end of procedures. A
procedure is usually assigned a name, i.e. label. To mark the end of a particular procedure,
the name of the procedure, i.e label appear as a prefix with the directive ENDP.
ENDS:
This directive marks the end of a logical segment. The logical segments are assigned
with names, using the ASSUME directive. The names appear with the ENDS directive as
prefixes to mark the end of those particular segments.
LABEL:
This is used to assign a name to the current content of the location counter. At the start
of the assembly process, the assembler initializes a location counter to keep track of memory
Locations assigned to the program. As the program assembly proceeds, the contents of the
Location counter are updated.
LENGTH:
This is used to refer the length of a data array or string.
OFFSET:
When the assembler comes across the offset operator along with a label, it first
computes the 16-bit displacement of the particular label, and replaces the string „offset label‟
by the computed displacement.
SEGMENT:
This marks the staring of a logical segment .The started segment is also assigned a
name i.e., label by this statement. The SEGMENT and ENDS directive must bracket each
logical Segment of a program.
Apparatus:
1. Hard ware-computer
2. Software- TASM
Procedure:
Input: A : 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
Output: 55H
Result: Thus, the Addition of n-BCD numbers is performed using TASM software.
Apparatus:
1. Hard ware-computer
2. Software- TASM
Procedure:
Result: Thus multiplication and division performed on two 16 bit numbers using 8086 ALP.
Aim: To write an 8086 ALP for Ascending order and Descending order
Apparatus:
1. Hard ware-computer
2. Software- TASM
Procedure:
DATA SEGMENT
STRING1 DB 99H, 12H, 56H, 45H, 36H
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE, DS:DATA
START: MOV AX, DATA
MOV DS, AX
MOV CH, 04H
UP2: MOV CL, 04H
LEA SI, STRING1
UP1: MOV AL, [SI]
MOV BL, [SI+1]
CMP AL, BL
JC DOWN
MOV DL, [SI+1]
XCHG [SI], DL
MOV [SI+1], DL
DOWN: INC SI
DEC CL
JNZ UP1
DEC CH
JNZ UP2
INT 3
CODE ENDS
END START
DATA SEGMENT
STRING1 DB 99H, 12H, 56H, 45H, 36H
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE, DS:DATA
START: MOV AX, DATA
MOV DS, AX
MOV CH, 04H
UP2: MOV CL, 04H
LEA SI, STRING1
UP1: MOV AL, [SI]
MOV BL, [SI+1]
CMP AL, BL
JNC DOWN
MOV DL, [SI+1]
XCHG [SI], DL
MOV [SI+1], DL
DOWN: INC SI
DEC CL
JNZ UP1
DEC CH
JNZ UP2
INT 3
CODE ENDS
END START
Result:
Thus, the Ascending order and Descending order performed using 8086 ALP.
Apparatus:
1. Hard ware-computer
2. Software- TASM
Procedure:
Input: A : 07H
Output: 13B0H
Result: Thus, the Addition Factorial of given number is performed using TASM software.
Apparatus:
1. 8086 Trainer.
5. FRC connector.
Procedure:
1. Connect the 26 core FRC connector to the 8086 trainer at connector no CN4 and the
interface module.
2. Connect the power mate connector to the interface module and the other side of the
connector to the power supply. The connections to the power supply are given below.
Connections: (power supply)
3. 5- Way power mate is wired to the motor. This power mate is to be inserted into the male
socket provided on the interface. Care should be taken such that, below given code for
the particular colored wire coincides with the code on the interface.
4. After the completion of the program and connections enter the program as given in the
listing below.
LABEL MNEMONIC
MOV AL, 90
MOV DX, 0FFC6
OUT DX
MOV AL, 07
To write an assembly language program to generate sine wave by using 8255 interfacing with
8086 microprocessor.
Apparatus:
Theory:
The parallel input-output port chip 8255 is also called as Programmable peripheral input-
output Port. The Intel‟s 8255 are designed for use with Intel‟s 8 -bit, 16-bit and higher
capability microprocessors. It has 24 input/output lines which may be individually
programmed in 2-groups of 12 lines each, or 3 groups of 8 lines .The two groups of I/O pins
are named as GROUP A and GROUP B. Each of these two groups contain a sub group of 8
I/O lines called as 8-bit Port and other sub group of 4 I/O lines are a 4-bit port. Thus GROUP
A Contains an 8-bit port A along with a 4-bit port, C upper. Port lines are identified by
symbols PAO-PA7, While the port C lines are identified as PC4-PC7 .Similarly group B
contains an 8-bit port B, containing lines PB0-PB7 and a 4-bit port C with lower bits PC0-
PC3 .The port C upper and port C lower can be used in recombination as an 8-bit port-C
.Both the port Cs are assigned the same address. Thus one may have either Three 8-bit I/O
ports are two 8-bit and two 4-bit I/O ports from 8255.All of these ports can function
independently either as input or as output ports. This can be achieved by programming the
bits of an internal register of 8255 called as Control word register (CWR).
Result: Thus, the generation of sine wave by using 8255 interfacing with 8086
microprocessor is performed.
1. ESA 51e operates on single +5v power supply either in standalone mode using PC keyboard
and LCD or with host PC through its RS-232C interface in serial mode implemented using the
On-chip serial port of Microcontroller.
2. Stand alone and serial monitor programs support the entry of user programs editing and
debugging facilities like single stepping and full speed execution of user programs.
3. Total On-board memory is 128bytes of which 80 bytes RAM has back-up provision.
5. INTERRUPTS:
EXTERNAL: INT is used for implementing single stepping and user‟s break switching is
available to user.
INTERNAL: Internal timer and serial interrupts are used by the system monitor.
COMMANDS:
A Assembler:
ESA 5E provides the powerful, PROM resident one-line assembler to enhance
development work. This assembler supports the entire standard mnemonics and addressing modes of
Intel /5 microcontrollers.
FUNCTION: The assembler generates the actual machine and stores them in the memory
locations defined by the program. Also, the system will display the codes generated as well as the
source statements. Any error detected is also displayed on the screen.
C Compare a block of memory with destination block
Function: Compare command can be used to compare the contents of one memory block with
the content of another memory block.
F Fill memory
Fill a block of memory with a constant or search a string of data in program memory, external data
memory and internal data memory.
Aim: To write a program to Finding number of 1‟s and number of 0‟s in a given 8-bit number
using Keil software.
Apparatus:
1. Keil software
2. Personal computer
Procedure:
2. Press project on toolbar and then click the New micro version project give the project
name and save.
3. Select the device for target and then press Intel data base of 80C51SL then press ok.
4. Click new text document and enter the program and then save the program.
No of ones = R2 = 02
Result:
The program for Finding number of 1‟s and number of 0‟s is done in 8051 microcontroller by
using Keil s/w.
AVERAGE OF N-NUMBERS
Apparatus:
1. Keil software
2. Personal computer
Procedure:
INPUT OUTPUT
Result:
The program for Average of n-numbers is done in 8051 microcontroller by using Keil s/w.
APPARATUS REQUIRED:
1. Personal Computer,
2. Keil μVision 5.
Procedure:
2. Press project on toolbar and then click the New micro version project give the project
name and save.
3. Select the device for target and then press Intel data base of 80C51SL then press ok.
4. Click new text document and enter the program and then save the program.
ORG 0000H
MOV TMOD, #00H
MOV TH0, #0FFH
MOV TL0, #01H
HERE: SETB TR0
AGAIN: JNB TF0, AGAIN
CLR TR0
CLR TF0
SJMP HERE
END
Result:
Thus programming for timer /counter in 8051 using Keil has been verified successfully
Apparatus:
1.8051 Kit
3. Connecting wires
Theory:
The interface simulates the control and operation of traffic lights at a junction of four roads.
The interface provides a set of 6 LED indicators at each of the four corners. Each of these
LEDs can be controlled by a port line.
Thus the interface allows the user to simulate a variety of traffic situations using appropriate
software routines. The sample programs provided in section 4 of this manual simulate some
interesting traffic movement sequences.
Kit diagram:
8047 1C DEC R4
8048 BC 00 F6 CJNE R4, #00, LOOP2
804B 1A DEC R2
804C BA 00 F0 CJNE R2, #00, LOOP3
804F 22 RET
Result:
The interfacing of Traffic Light Controller is done in 8051 microcontroller.
AIM:
To write an ALP to perform the operation of UART in 8051
APPARATUS REQUIRED:
3. Personal Computer,
4. Keil μVision 5.
Procedure:
2. Press project on toolbar and then click the New micro version project give the project
name and save.
3. Select the device for target and then press Intel data base of 80C51SL then press ok.
4. Click new text document and enter the program and then save the program.
ORG 0000H
START: MOV TMOD, #20H
MOV TH1, #0FDH
MOV TL1, #OFDH
MOV SCON, #50H
SETB TR1
MOV SBUF, #‟A‟
LOOP: JNB TI, LOOP
CLR TI
MOV SBUF, #‟B‟
LOOP1: JNB TI, LOOP1
CLR TI
MOV SBUF, #‟C‟
LOOP2: JNB TI, LOOP2
CLR TI
END
INPUT : ABC
OUTPUT : Received ABC serially
Result:
Thus the program for UART in 8051 has been verified successfully.
AIM:
To write an ALP to interface LCD display with 8051.
APPARATUS REQUIRED:
1. Personal Computer,
2. Keil μVision 5.
Procedure:
2. Press project on toolbar and then click the New micro version project give the project
name and save.
3. Select the device for target and then press Intel data base of 80C51SL then press ok.
4. Click new text document and enter the program and then save the program.
#include<reg51.h>
sbit rs = p1^0;
sbit rw = p1^1;
sbit en = p1^2;
void lcdcmd(unsigned char);
void lcddat(unsigned char);
void delay();
void main()
{
P2=0x00; // output declaration
While(1)
{
lcdcmd(0x38); //5x7 matrix crystal
delay();
lcdcmd(0x01); //clear screen
delay();
lcdcmd(0x10); // cursor blinking
delay();
lcdcmd(0x0C); // display on
delay();
lcdcmd(0x81); // force cursor first line first position
delay();
lcddat(„E‟);
delay();
lcddat(„M‟);
delay();
lcddat(„B‟);
delay();
}
}
Result:
Thus the LCD display was interfaced with 8051 and verified successfully.
AIM:
To write an assembly program to multiply 2 16- bit numbers using ARM Instructions.
APPARATUS REQUIRED:
1. Personal Computer,
2. Keil μVision 5.
Procedure:
2. Press project on toolbar and then click the New micro version project give the project
name and save.
3. Select the device for target and then press Intel data base of 80C51SL then press ok.
4. Click new text document and enter the program and then save the program.
Result:
Thus the 16-bit multiplication using ARM CORTEX- M3 has been successfully
verified
AIM:
To write an assembly language program to toggle a LED using timer interrupt.
APPARATUS REQUIRED:
1. Personal Computer,
2. Keil μVision 5.
Procedure:
2. Press project on toolbar and then click the New micro version project give the project
name and save.
3. Select the device for target and then press Intel data base of 80C51SL then press ok.
4. Click new text document and enter the program and then save the program.
INPUT : 1, 2, 3, 4, 5, 6, 7, 8, 9, A
OUTPUT : 37H
Result:
Thus the program of sum of first 10 integer numbers using ARM CORTEX-M3 has
been executed successfully
AIM:
To write an assembly language program for sum of first 10 integer numbers using ARM
CORTEX-M3 instructions.
APPARATUS REQUIRED:
1. Personal Computer,
2. Keil μVision 5.
Procedure:
2. Press project on toolbar and then click the New micro version project give the project
name and save.
3. Select the device for target and then press Intel data base of 80C51SL then press ok.
4. Click new text document and enter the program and then save the program.
PROGRAM :
#include “config.h”
Result:
Thus the LED blinking using timer has been verified with ARM CORTEX M3
program successfully.