CS3691 Embedded Lab Record
CS3691 Embedded Lab Record
VAGAIKULAM
AIM:
To perform the following arithmetic operations using assembly language in KEIL IDE.
➢ Addition of two 8 bit numbers.
SOFTWARE REQUIREMENTS
➢ Keil µvision 5
SOFTWARE HANDLING
PROCEDURE:
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”
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:
ORG 0000H
MOV R1, #00H
MOV A, #05H
MOV R0, #06H
ADD A, @R0
MOV R1, A
END
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
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 2: Select 'New µVision Project' from project in the menu bar.
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 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 13: Press Run or select 'step' option under Debug menu for single
step execution and verify the output in register window / Memory window .
PROGRAM:
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 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.
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 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:
#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;
}