EMBEDDED LAB Record
EMBEDDED LAB Record
EMBEDDED LAB Record
AIM:
To Write 8051 Assembly Language experiments using simulator.
SOFTWARE REQUIRED:
1. EDSIM51
2.PC
PROCEDURE:
1. Open EDSIM51 Software and set the clock frequency default by 12 MHZ.
2. Type and Save the Program with Extension asm
3. Assemble the Source code
4. Run the Program and getting the results.
PROGRAM:
ADDITION:
MOV A,#50H
MOV R1,#30H
ADD A,R1
EXIT:SJMP EXIT
OUTPUT:
SUBRACTION:
OUTPUT:
MULTIPLICATION:
ORG 0x00 ; Start the program at address 0x00
MOV A, #0Ah ; Load accumulator with the first operand (0Ah)
MOV B, #05h ; Load B register with the second operand (05h)
MUL AB ; Multiply A by B, result stored in A: register A will contain the result of A * B
; At this point, A will contain the result of 0Ah * 05h
END ; End of the program
OUTPUT:
DIVISION:
ORG 0x00 ; Start the program at address 0x00
MOV A, #50h ; Load accumulator with the dividend (50h)
MOV B, #10h ; Load B register with the divisor (10h)
DIV AB ; Divide the accumulator by B, quotient in A, remainder in B
; At this point, A will contain the quotient of 50h / 10h
; B will contain the remainder
END ; End of the program
OUTPUT:
LOGICAL OR OPERATION:
OUTPUT:
OUTPUT:
LOGICAL XOR OPERATION:
OUTPUT:
OUTPUT:
RESULT:
MASKING BITS IN AN 8-BIT NUMBER
AIM:
To Write 8051 Assembly Language experiments using simulator.
SOFTWARE REQUIRED:
1. EDSIM51
2.PC
PROCEDURE:
1. Open EDSIM51 Software and set the clock frequency default by 12 MHZ.
2. Type and Save the Program with Extension asm
3. Assemble the Source code
4. Run the Program and getting the results.
Program:
MOVA,#87
ANLA,#7E
MOVDPTR,#4500
MOVX@DPTR,A
SJMP
OUTPUT:
RESULT:
GENERATION OF SQUARE WAVEFORM USING
8051
AIM:
To Write 8051 Assembly Language experiments using simulator.
SOFTWARE REQUIRED:
1. EDSIM51
2.PC
PROCEDURE:
1. Open EDSIM51 Software and set the clock frequency default by 12 MHZ.
2. Type and Save the Program with Extension asm
3. Assemble the Source code
4. Run the Program and getting the results.
Program:
OUTPUT:
RESULT:
PROGRAMMING USING ON – CHIP PORTS IN
8051
AIM:
To Write 8051 Assembly Language experiments using simulator.
SOFTWARE REQUIRED:
1. EDSIM51
2.PC
PROCEDURE:
1. Open EDSIM51 Software and set the clock frequency default by 12 MHZ.
2. Type and Save the Program with Extension asm
3. Assemble the Source code
4. Run the Program and getting the results.
Program:
MOVA,#0FFH
MOVP1, A
MOVA,PI
MOVR7, A
ACALL DELAY
MOVA, P1
MOVR6, A
ACALLDELAY
MOVA, P1
MOVR5, A
OUTPUT:
RESULT:
PROGRAMMING USING SERIAL PORTS IN 8051
AIM:
To Write 8051 Assembly Language experiments using simulator.
SOFTWARE REQUIRED:
1. EDSIM51
2.PC
PROCEDURE:
1. Open EDSIM51 Software and set the clock frequency default by 12 MHZ.
2. Type and Save the Program with Extension asm
3. Assemble the Source code
4. Run the Program and getting the results.
Program:
MOV TMOD, #20M
MOV TH1, #-3
MOVSCON, #50H
SETBTR1
AGAIN:MOV A, #"Y"
ACALLTRANS
MOVA, # "E"
ACALLTRANS
MOV A, # "S" ;transfer "S"
ACALL TRANS
SJMPAGAIN
serial data transfer subroutine
TRANS: MOV SBUF, A ;load SBUF
HERE:JNB TI,HERE ;wait for last bit to transfer
CLR TI ;get ready for next byte
RET
OUTPUT:
RESULT:
EXPERIMENTS USING ARM
BLINKING OF LEDS
AIM:
To write and execute the program for LED &Flashing Led’s with ARM7(LPC2148)
processor.
HARDWARE&SOFTWARETOOLSREQUIRED:
3 LED Module 1
PROCEDURE
1. Create a New project, Go to “Project” and close the current project “Close Project”.
2. Next Go to the Project New μvision Project Create New Project Select Device for Target.
3. SelectthedatabaseNXPLPC2148.
4. Add Startup file and Next go to “File” and click “New”.
5. Write a program on the editor window and save as “Main.c”.
6.Add this source file to Groupandclickon“BuildTarget”orF7.
6. Create a Hex file from “Project” menu and click on “Rebuild all target Files”..
7. Next browse the path of hex file and select the file.
9. After selecting ISP mode on the Hardware Kit and click on start then device will start to
program
10. Finally can be see the finished indication and values in SPJ Terminal and Reset the device
into running mode.
LED INTERFACING:
CIRCUIT DAIGRAM:
PROGRAM
#include <LPC214X.H>
void DELAY(unsigned long VALUE);
unsigned char A = 0x01;
int main()
{
IO0DIR = 0x000000FF; /* Port0 00-07 as output*/
while(1) /* Infinite loop*/
{
IO0SET |= A; /* Port0 00-07 High*/
DELAY(1000000);
IO0CLR |= A; /* Port0 00-07 High*/
A <<=1;
if(A==0x00) A=0x01;
DELAY(1000000);
}
}
void DELAY(unsigned long VALUE)
{
while(VALUE>0)
{
VALUE--;
}
}
OUTPUT:
RESULT:
INTERFACING ADC
AIM:
To write and execute the program for ADC with ARM7(LPC2148)processor.
HARDWARE&SOFTWARETOOLS REQUIRED:
3 LCD Module 1
7 ADC Module 1
PROCEDURE:
1. Create a New project, Go to “Project” and close the current project “Close Project”.
2. Next Go to the Project New μvision Project Create New Project Select Device for Target.
3. SelectthedatabaseNXPLPC2148.
4. Add Startup file and Next go to “File” and click “New”.
5. Write a program on the editor window and save as “Main.c”.
6.Add this source file to Groupandclickon“BuildTarget”orF7.
6. Create a Hex file from “Project” menu and click on “Rebuild all target Files”..
7. Next browse the path of hex file and select the file.
9. After selecting ISP mode on the Hardware Kit and click on start then device will start to
program
10. Finally can be see the finished indication and values in SPJ Terminal and Reset the device into
running mode.
CIRCUIT DIAGRAM:
PROGRAM:
#include <LPC214x.H>
#include <STRING.H>
void DELAY(unsigned int);
void INIT_GPIO(void);
void LCDSTR(unsigned char ADDRESS,char *MSG);
void LCD_DATA(unsigned char);
void LCD_CMD(unsigned int);
void LCD_INIT(void);
void SETTIME(void);
unsignedint E = 0x00000800; // P1.21 ENABLE LCD
unsignedint RW = 0x00000400; // P1.22 READ/WRITE LCD
unsignedint RS = 0x00000200; // P1.23 REGISTER SELECT LCD
void SETTIME(void)
{
CCR = 0x02;
HOUR = 0;
MIN = 0;
SEC = 0;
CCR = 0x11;
}
int main()
{
SETTIME();
INIT_GPIO();
LCD_INIT();
LCDSTR(0x00000080,"REAL TIME CLOCK ");
LCDSTR(0x000000C0," ");
while(1)
{
LCD_CMD (0x000000C3);
LCD_DATA(HOUR/10 + '0');
LCD_DATA(HOUR%10 + '0');
LCD_DATA(':') ;
LCD_DATA(MIN/10 + '0');
LCD_DATA(MIN%10 + '0');
LCD_DATA(':') ;
LCD_DATA(SEC/10 + '0');
LCD_DATA(SEC%10 + '0');
}
}
OUTPUT:
RESULT:
INTERFACING DAC
AIM:
To write and execute the program for DAC withARM7(LPC2148)processor.
3 DAC Module 1
6 CRO(Or)DSO 1
PROCEDURE:
1. Create a New project, Go to “Project” and close the current project “Close Project”.
2. Next Go to the Project New μvision Project Create New Project Select Device for Target.
3. SelectthedatabaseNXPLPC2148.
4. Add Startup file and Next go to “File” and click “New”.
5. Write a program on the editor window and save as “Main.c”.
6.Add this source file to Groupandclickon“BuildTarget”orF7.
6. Create a Hex file from “Project” menu and click on “Rebuild all target Files”..
7. Next browse the path of hex file and select the file.
9. After selecting ISP mode on the Hardware Kit and click on start then device will start to
program
10. Finally can be see the finished indication and values in SPJ Terminal and Reset the device into
running mode.
DIGITAL TO ANALOG
CONVERTOR:CIRCUITDIAGRAM:
PROGRAM: (DIGITAL TO ANALOG)
PROGRAM:(SINE WAVE)
#include<lpc214x.h>
#include"math.h"
Unsigned int t;
int main()
{
int value=0x3ff;
PINSEL1 = 0X00080000;
while(1)
{
value = 512+400*sin(t*0.01745);
DACR = value<<6;
if(++t==360)t=0;
}
}
#include<lpc214x.h>
#include"math.h"
unsignedint t;
int main()
{
int value=0x3ff;
PINSEL1 = 0X00080000;
while(1)
{
DACR = value<<6;
Delay(1000);
DACR = 0;
Delay(1000);
}
}
PROGRAM: (TRAINGLE WAVE)
#include<lpc214x.h>
unsignedint J=0;
int main()
{
PINSEL1 = 0X00080000;
while(1)
{
for (J=0;J<512;J++)
{
//Delay (2);
DACR = J<<6;
}
for (J=512;J>0;J--)
{
//Delay (2);
DACR = J<<6;
}
}
}
OUTPUT:
RESULT:
INTERFACING OF LCD
AIM:
To write and execute the program for LCD with ARM7(LPC2148)processor.
HARDWARE&SOFTWARETOOLSREQUIRED:
3 LED Module 1
PROCEDURE
1. Create a New project, Go to “Project” and close the current project “Close Project”.
2. Next Go to the Project New μvision Project Create New Project Select Device for Target.
3. SelectthedatabaseNXPLPC2148.
7.Create a Hex file from “Project” menu and click on “Rebuild all target Files”..
8.Next browse the path of hex file and select the file.
9. After selecting ISP mode on the Hardware Kit and click on start then device will start to
program
10. Finally can be see the finished indication and values in SPJ Terminal and Reset the device
into running mode.
INTERFACINGLCD
CIRCUITDIAGRAM:
PROGRAM:
#include<lpc214x.h>
#define bit(x) (1<<x)
#define delay for(i=0;i<1000;i++);
unsigned int i;
void lcd_int();
void dat(unsigned char);
void cmd(unsigned char);
void string(unsigned char *);
void main()
{
IO0DIR|=0XFFF;
lcd_int();
cmd(0x8a);
string("RPSIT ECE ");
while(1) {
cmd(0x18);
delay;
}
}
void lcd_int()
{
cmd(0x30);
cmd(0x0c);
cmd(0x06);
cmd(0x01);
cmd(0x80);
}
void cmd(unsigned char a)
{
IO0PIN&=0x00;
IO0PIN|=(a<<0);
IO0CLR|=bit(8); //rs=0
IO0CLR|=bit(9); //rw=0
IO0SET|=bit(10); //en=1
delay;
IO0CLR|=bit(10); //en=0
}
void dat(unsigned char b)
{
IO0PIN&=0x00;
IO0PIN|=(b<<0);
IO0SET|=bit(8); //rs=1
IO0CLR|=bit(9); //rw=0
IO0SET|=bit(10); //en=1
delay;
IO0CLR|=bit(10); //en=0
}
void string(unsigned char *p)
{
while(*p!='\0') {
dat(*p++);
}
}
OUTPUT:
RESULT:
INTERFACING OF STEPPERMOTOR
AIM:
To write an Embedded ‘C’ program to interface the Stepper Motor with LPC2148
trainer kit.
APPARATUS REQUIRED:
S. No Description Quantity
1 LPC2148kit 1
2 Adapter 1
3 USB cable 1
4 Personal Computer 1
PROCEDURE:
1. Connect the 12v adaptor to the ARM LPC2148 board.
2. Keep the switch in ON (left side) position.
3. Connect ARM LPC 2148 board to pc using USB cable.
4. Open “Keil version 4” create the project and enter the program
save the program.
5. Set options and build the project.
6. Downloading switch sw11 is left position.
7. Open flash magic software and follow the steps 1, 2, 3 to chose
respective .hex and step 5 to start.
8. The Flash magic page indicate that completed,
9. Switch of the kit remove USB cable and connect stepper motor after that
switch on the kit.
CIRCUIT DIAGRAM:
PROGRAM CODE:
#include <LPC214X.H>
void delay(void);
int main(void)
{
PINSEL0 = 00; // select the pin function as GPIO
IODIR0 = (0xF<<4); // Set the port direction P0.4-P0.7 port pins output)
while(1)
{
IOCLR0 = 0xC0;
IOSET0 = 0x30; // 0011
delay();
IOCLR0 = 0x90;
IOSET0 = 0x60; // 0110
delay();
IOCLR0 = 0x30;
IOSET0 = 0xC0; // 1100
delay();
IOCLR0 = 0x60;
IOSET0 = 0x90; // 1001
delay();
}
}
void delay(void)
{
int s;
for(s = 0;s<=100000;s++)
{};
}
OUTPUT:
RESULT: