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

CS3691 Embedded Lab Record

The document describes experiments performed using the Keil IDE to implement basic arithmetic operations in assembly language and C on an 8051 microcontroller. It includes procedures to create and build projects in Keil, as well as assembly and C code examples to perform addition, subtraction, multiplication and division of 8-bit numbers by accessing registers and memory locations. The aim is to familiarize students with programming the 8051 microcontroller's ALU using both assembly language and C.

Uploaded by

ragapriya750
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views

CS3691 Embedded Lab Record

The document describes experiments performed using the Keil IDE to implement basic arithmetic operations in assembly language and C on an 8051 microcontroller. It includes procedures to create and build projects in Keil, as well as assembly and C code examples to perform addition, subtraction, multiplication and division of 8-bit numbers by accessing registers and memory locations. The aim is to familiarize students with programming the 8051 microcontroller's ALU using both assembly language and C.

Uploaded by

ragapriya750
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

HOLYCROSS ENGINEERING COLLEGE

VAGAIKULAM

Department of Electronics and Communication Engineering

CS3691 EMBEDDED SYSTEMS AND IOT LAB


EX.NO:01 8051 Assembly Language Experiments Using Keil Software
DATE:

AIM:
To perform the following arithmetic operations using assembly language in KEIL IDE.
➢ Addition of two 8 bit numbers.

➢ Subtraction of two 8 bit numbers.

➢ Multiplication of two 8 bit numbers.

➢ Division of two 8 bit numbers.

SOFTWARE REQUIREMENTS
➢ Keil µvision 5

SOFTWARE HANDLING

PROCEDURE:

STEP1: Double click on µvision5 icon in the desktop.


STEP2: Select “New µvision Project”from project in the menu bar.

STEP3: Browse and create a new project in the required location.


STEP4: Select the target device (AT89C51from Microchip) from the list or type the exact name of
the device. Press OK.

STEP5: Copy start upto Project folder and add to project file”-Press NO.
STEP6: In the project window right click on source and select Add new item to group “source
group 1”

STEP7: Select an ASM file and Press "ADD."


STEP8: Open a new text editor window and type the program in the editor space and save.

STEP 9: If no error, select 'Build' icon from the toolbar or from the menu bar."
STEP10: Start the debug session from Menu bar.

STEP11: Press OK

STEP 12: Press function key F11 or select 'step' option under Debug menu for single-step execution
and verify the output in register window / Memory window / xPSR.
1. ADDITION OF TWO 8 BIT NUMBERS
ALGORITHM:

➢ Take two number and store in accumulator and register.

➢ Add accumulator content with register content.

➢ Store the result in register.

➢ View the result.

ASSEMBLY LANGUAGE PROGRAM:

ORG 0000H
MOV R1, #00H
MOV A, #05H
MOV R0, #06H
ADD A, @R0
MOV R1, A
END

2. SUBTRACTION OF TWO 8 BIT NUMBERS

ORG 0000H
MOV R1, #00H
MOV A, #05H
MOV R0, #06H
SUBB A, @R0
MOV R1, A
END
3. MULTIPLICATION OF TWO 8 BIT NUMBER

ORG 0000H
MOV A, #05H
MOV B, #06H
MUL AB
END

4. DIVISION OF TWO 8 BIT NUMBER

ORG 0000H
MOV A, #05H
MOV B, #06H
CLR C
DIV AB
MOV R1, A
MOV C,B
END
EX.NO:02
DATA TRANSFER BETWEEN REGISTERS AND MEMORY
DATE:

AIM:
In this program explain about how to test data transfer between registers and memory

SOFTWAREREQUIREMENTS
Keil µvision 5

PROCEDURE:

STEP 1: Double-click on µVision4 icon on the desktop.

STEP 2: Select 'New µVision Project' from project in the menu bar.

STEP 3: Browse and create a new project in the required location.

STEP 4: Select the target device (AT89C51from Microchip) from the list or type the
exact name of the device. Press OK.

STEP 5: Copy startup to Project folder and add to project file - Press NO.

STEP 6: In the project window, right-click on source and select Add new item to
group 'source group 1.'

STEP 7: Select ASM file and give the name of the file with .asm extension and press ADD.

STEP 8: Type the program in the editor space and save.

STEP 9: If no error, select 'Build' icon from the toolbar or from the menu bar.

STEP 10: Check for errors and warnings in the bottom window.

STEP 11: Start the debug session from the Menu bar.

STEP 12: Press OK.

STEP 13: Press Run or select 'step' option under Debug menu for single
step execution and verify the output in register window / Memory window .
PROGRAM:

MOV R0, #30H

MOV R1, #40H

MOV R2, #05H

L1:MOV A,@R0

MOV @R1,A

INC R0

INC R1

DJNZ R2,L1

END
EX.NO:03
PERFORM ALU OPERATIONS
DATE:

AIM:
To perform the addition, subtraction, multiplication of two 8-bit numbers and
to perform logical operations AND, OR, XOR on two eight bit numbers using Keil
IDE.

SOFTWARE REQUIREMENTS:
➢ Keil µvision 5

PROCEDURE:

STEP 1: Double click on µVision 5 icon in the desktop.


STEP 2: Select “New µvision Project” from project in the menu bar.
STEP 3: Browse and create a new project in the required location.
STEP 4: Select the target device () from the list or type the exact name of the device.
Press OK.

STEP 5: Copy startup to Project folder and add to project file”- Press NO.
STEP 6: In the project window, right click on source and select Add new item to
group “source group1”.

STEP 7: Select Asm file and give name of the file with .asm extension and press
ADD.

STEP 8: Type the program in the text editor and save.


STEP 9: If no error, Select “Build” icon from toolbar or from menu bar.
STEP 10: Start the debug session from Menu bar.
STEP 11: Press OK.
STEP 12: Press Run or select “step” option under Debug menu for single
step execution and verify the output in register window Memory
window.
PREFORM ALU OPERATION

ADDITION
MOV A, #00H
MOV B, #05H
ADD A, B
MOV 40H, A
SUBTRACTION

MOV A, #00H
SUBB A, B
MOV 41H, A

MULTIPLICATION

MOV A, #00H
MUL AB
MOV 42H, A
MOV 42H, A

DIVISION

MOV A, #25H
MOV B, #12H
DIV AB
MOV 44H, A
MOV 45H, B

AND
MOV A, #25H
MOV B, #12H
ANL A,B
MOV 46H, A

OR
MOV A, #25H
MOV B, #12H
ORL A, B
MOV 47H, A
END
EX.NO:04(A)
BASIC ARITHMETIC PROGRAMS USING EMBEDDED C
DATE:
AIM:
To write a program in basic arithmetic operations using embedded C.

SOFTWARE REQUIREMENTS:
➢ Keil µvision 5

PROCEDURE:

STEP 1: Double click on µVision 5 icon in the desktop.


STEP 2: Select “New µvision Project” from project in the menu bar.
STEP 3: Browse and create a new project in the required location.
STEP 4: Select the target device (AT89C51from Microchip) from the list or
type the exact name of the device. Press OK.

STEP 5: Copy startup to Project folder and add to project file”- Press NO.
STEP 6: In the project window, right click on source and select Add new item
to group “source group1”.

STEP 7: Select C file and give name of the file with .c extension and press
ADD.
STEP 8: Type the program in the text editor and save.
STEP 9: If no error, Select “Build” icon from toolbar or from menu bar.
STEP 10: Check for errors and warnings in the bottom window.
STEP 11: Start the debug session from Menu bar.
STEP 12: Press OK.
STEP 13: Press Run or select “step” option under Debug menu for
single step execution and verify the output in register Memory window.
PROGRAM:

ADDITION AND MULTIPLICATION

#include<reg51.h>
void main(void)
{
unsigned char p,q,r;
unsigned int s;
P1=0x00;
P2=0x00;
p=0x06;
q=0x02;
r=p+q;
P1=r;
s=p*q;
P2=s;
}
SUBTRACTION AND DIVISION
#include<reg51.h>
void main(void)
{
unsigned char p,q,r;
unsigned int s;
P1=0x00;
P2=0x00;
p=0x06;
q=0x02;
r=p-q;
P1=r;
s=p/q;
P2=s;
}

You might also like