Académique Documents
Professionnel Documents
Culture Documents
PROCEDURE:
1. Go to start- all programs- IAR systems--IAR embedded workbench.
2. Close the IAR information file.
3. Create a project.
4. Select the asm option and click ok
5. Enter the file name &save
6. Delete the basic asm file that is copied and it is shown in below
7. Write the program
8. Save the program. Click on the project name and right click on the project name. Click on
“options” tab.
9. Select general “options tab” under category. Select IC options under “device” tab. Click on the
correct MSP430 IC.
10. After selecting the correct IC click “ok” as shown.
11. In the same above window click “debugger” under category. Select “FET debugger &click
“ok” as shown
12. In the same above window click FET debugger under category. Select Texas instrument USB
–IF under”conections”tab as shown.
13. save the program &click on “Make” icon as shown.
14. Give the file name &save the window as shown
15. Click the messages and it should be display the zero errors for proper error free program
compilation.
16. Click on download and debug icon
17. After downloading the program click ok on the stack warning messages.
18. Click go icon ->->-> as shown.
EMBEDDED SYSTEM LAB Page 2
19. Observe the LED flashing (output varies for the corresponding experiments)in the MSP 430
kit.
PROGRAM:
#include “msp430x14x.h" ; Header file
;-------------------------------------------;
ORG 0E100h ; Progam Start
;-------------------------------------------;
RESET mov.w #01500h,SP ; Initialize 'F161x stackpointer
StopWDT mov.w #WDTPW+WDTHOLD,&WDTCTL ; Stop Watchdog Timer
;-------------------------------------------;
RESULT:
Thus an ASM program to flash LED using MSP430 has been written and the output is
verified.
PROCEDURE:
1.Go to start- all programs- IAR systems--IAR embedded workbench.
2.Close the IAR information file
3.Create a project
4.Select the asm option and click ok
5.Enter the file name &save
6.Delete the basic asm file that is copied and it is shown in below
7.Write the program
8.Save the program.Click on the project name and right click on the project name. Click on
“options” tab.
9. Select general “options tab” under category.Select IC options under “device” tab.Click on the
correct MSP430 IC.
10.After selecting the correct IC click “ok” as shown.
11.In the same above window click”debugger” under category.Select “FET debugger &click
“ok” as shown
12.In the same above window click FET debugger under category.Select texas instrument USB –
IF under”conections”tab as shown.
13.Save the program &click on “Make” icon as shown.
14.Give the file name &save the window as shown
;-------------------------------------------;
; Select & Stabilize XT2
;-------------------------------------------;
SetupBC bic.b #XT2OFF,&BCSCTL1 ; XT2 = on
SetupOsc bic.b #OFIFG,&IFG1 ; Clear OSC fault flag
mov.w #0FFh,R15 ; R15 = Delay
SetupOsc1 dec.w R15 ; Additional delay to ensure start
jnz SetupOsc1 ;
bit.b #OFIFG,&IFG1 ; OSC fault flag set?
jnz SetupOsc ; OSC Fault, clear flag again
;-------------------------------------------;
; Interrupt Vectors Used MSP430x161x
;-------------------------------------------;
ORG 0FFFEh ; MSP430 RESET Vector
DW RESET ;
RESULT:
Thus an ASM program to generate square wave for variable frequencies using MSP430
has been written and the output is verified.
SOFTWARE REQUIRED:
IAR Software
HARDWARE REQUIRED:
PROCEDURE:
;-------------------------------------------;
; Port2 Interrupt service routine
;-------------------------------------------;
PORT2_ISR call #DELAY_500ms ; Power on Delay
mov.b &P2IFG,&P1OUT ; Copy P2IFG value to glow LED
CALL #DELAY_500ms ; Delay
CLR.B &P1OUT ; Clear P1OUT
CLR.B &P2IFG ; Clear P2IFG
reti
;-------------------------------------------;
; Delay subroutine
;-------------------------------------------;
RESULT:
Thus an an ASM program to generate interrupt using MSP 430 has been written and the
output is verified.
AIM:
To write an ASM program to transfer the data from MSP 430 to PC.
SOFTWARE REQUIRED:
IAR Software
HARDWARE REQUIRED:
PROCEDURE:
1. Go to start- all programs- IAR systems--IAR embedded workbench.
2. Close the IAR information file.
3. Create a project.
4. Select the asm option and click ok
5. Enter the file name &save
6. Delete the basic asm file that is copied and it is shown in below
7. Write the program
8. Save the program. Click on the project name and right click on the project name. Click on
“options” tab.
9. Select general “options tab” under category. Select IC options under “device” tab. Click on the
correct MSP430 IC.
10. After selecting the correct IC click “ok” as shown.
11. In the same above window click “debugger” under category. Select “FET debugger &click
“ok” as shown
12. In the same above window click FET debugger under category. Select Texas instrument USB
–IF under”conections”tab as shown.
13. save the program &click on “Make” icon as shown.
RESULT:
Thus an ASM program to transfer the data from MSP 430 to PC has been written and the
output is verified.
AIM :
To write an Embedded C Program to Flash LED using 8051.
SOFTWARE REQUIRED :
Keil Microvision4.
Flash Magic.
HARDWARE REQUIRED:
PROCEDURE :
1. Create a folder in D Drive .
2. Select Keil Microvision4.
3. Select project select new Microvision4 project.
4. Select the folder which already created in create new project optionssave the file name.
5. Select device for Target ‘Target 1’ dialog box appearselect NXP Founded by Philips.
6. Select P89V51RD2.
7. Copy startup to project folder and add file to project dialog box appearselect yes.
8. File startup A51 already exists overwrite dialog box appear select yes.
9. Then Target 1 will appear below project option select target 1 select new then text 1
screen will appear there type the program.
10. Save the program by selecting save options then save as dialog box will appear in that
select the folder already created in the save option.
11. Give the file name with the extension .c in the ‘filename option’.
12. maximize target 1, right click source group 1 ‘Add existing files’
13. Right click options for Target Target 1 will appear.
14. Type the frequency 1100592 in XTAL(MHZ) option.
15. Select output OK.
16. Select Build.
17. SelectRebuild.
18. My computer right clickpropertiesHardwareDevice manager USB serial
port COM PORT.
19. FlashMagic P89V51RD2.
20. Enable erase all flash.
21. Select Hex file.
22. Enable verify after programming.
#include <reg51.h>
typedef unsigned char U8; // 8 bit
typedef unsigned int U32; // 32 bit
void _delay_ms(U32 ms);
void USART_Transmit(U8 tx_data);
U8 USART_Receive();
void uart_setup();
void main(void)
{
U8 rx_data;
uart_setup(); // calling the UART setup function
while(1)
{
rx_data= USART_Receive();
USART_Transmit(rx_data) ;
}
}
void uart_setup()
{
TMOD = 0x20; // configure timer1 for Mode 2 operation for the correct baud rate
TH1 = 0xFD; // 9600 bps for 11.0592 MHz clock
SCON = 0x50; // Set Serial IO to receive and normal mode
TR1=1;
}
unsigned char USART_Receive()
{
while(!RI);
RI = 0;
return SBUF ;
}
void USART_Transmit(U8 tx_data)
{
SBUF = tx_data;
while(!TI);
TI = 0;
}
RESULT:
Thus an Embedded C Program to Flash LED using 8051 has been written and the output is
verified.
Experiment No: 6 BUZZER
Date:
AIM :
SOFTWARE REQUIRED :
Keil Microvision4.
Flash Magic.
HARDWARE REQUIRED:
PROCEDURE :
1. Create a folder in D Drive .
2. Select Keil Microvision4.
3. Select project select new Microvision4 project.
4. Select the folder which already created in create new project optionssave the file name.
5. Select device for Target ‘Target 1’ dialog box appearselect NXP Founded by Philips.
6. Select P89V51RD2.
7. Copy startup to project folder and add file to project dialog box appearselect yes.
8. File startup A51 already exists overwrite dialog box appear select yes.
9. Then Target 1 will appear below project option select target 1 select new then text 1
screen will appear there type the program.
10. Save the program by selecting save options then save as dialog box will appear in that
select the folder already created in the save option.
11. Give the file name with the extension .c in the ‘filename option’.
12. maximize target 1, right click source group 1 ‘Add existing files’
13. Right click options for Target Target 1 will appear.
14. Type the frequency 1100592 in XTAL(MHZ) option.
15. Select output OK.
16. Select Build.
17. SelectRebuild.
18. My computer right clickpropertiesHardwareDevice manager USB serial
port COM PORT.
19. FlashMagic P89V51RD2.
20. Enable erase all flash.
21. Select Hex file.
22. Enable verify after programming.
PROGRAM:
EMBEDDED SYSTEM LAB Page 15
#include<reg51.h>
typedef unsigned char U8; // 8 bit
typedef unsigned int U32; // 32 bit
void _delay_ms(U32 ms);
sbit BUZZER = P2^0;
void main()
{
BUZZER = 1; // BUZZER on
_delay_ms(250); // delay 250 ms*/
BUZZER = 0; // BUZZER off
_delay_ms(250); // delay 250 ms
}
void _delay_ms(U32 ms)
{
unsigned int i,j;
for(i=0;i<ms;i++)
for(j=0;j<1275;j++);
}
RESULT:
Thus an Embedded C Program to make LED ON and OFF using 8051 has been written
and the output is verified.
Experiment No: 7 SERIAL COMMUNICATION
Date :
AIM :
To write an Embedded C Program to transfer data from 8051 to Pc.
SOFTWARE REQUIRED :
PROCEDURE :
1. Create a folder in D Drive .
2. Select Keil Microvision4.
3. Select project select new Microvision4 project.
4. Select the folder which already created in create new project optionssave the file name.
5. Select device for Target ‘Target 1’ dialog box appearselect NXP Founded by Philips.
6. Select P89V51RD2.
7. Copy startup to project folder and add file to project dialog box appearselect yes.
8. File startup A51 already exists overwrite dialog box appear select yes.
9. Then Target 1 will appear below project option select target 1 select new then text 1
screen will appear there type the program.
10. Save the program by selecting save options then save as dialog box will appear in that
select the folder already created in the save option.
11. Give the file name with the extension .c in the ‘filename option’.
12. maximize target 1, right click source group 1 ‘Add existing files’
13. Right click options for Target Target 1 will appear.
14. Type the frequency 1100592 in XTAL(MHZ) option.
15. Select output OK.
16. Select Build.
17. SelectRebuild.
18. My computer right clickpropertiesHardwareDevice manager USB serial
port COM PORT.
19. FlashMagic P89V51RD2.
20. Enable erase all flash.
21. Select Hex file.
22. Enable verify after programming.
PROGRAM:
#include <reg51.h>
typedef unsigned char U8; // 8 bit
typedef unsigned int U32; // 32 bit
void _delay_ms(U32 ms);
void USART_Transmit(U8 tx_data);
RESULT:
Thus an Embedded C Program to transfer the data from 8051 to PC has been written and
the output is verified.
SOFTWARE REQUIRED :
PROCEDURE :
1. Create a folder in D Drive .
2. Select Keil Microvision4.
3. Select project select new Microvision4 project.
4. Select the folder which already created in create new project optionssave the file name.
5. Select device for Target ‘Target 1’ dialog box appearselect NXP Founded by Philips.
6. Select P89V51RD2.
7. Copy startup to project folder and add file to project dialog box appearselect yes.
8. File startup A51 already exists overwrite dialog box appear select yes.
9. Then Target 1 will appear below project option select target 1 select new then text 1
screen will appear there type the program.
10. Save the program by selecting save options then save as dialog box will appear in that
select the folder already created in the save option.
11. Give the file name with the extension .c in the ‘filename option’.
12. maximize target 1, right click source group 1 ‘Add existing files’
13. Right click options for Target Target 1 will appear.
14. Type the frequency 1100592 in XTAL(MHZ) option.
15. Select output OK.
16. Select Build.
17. SelectRebuild.
18. My computer right clickpropertiesHardwareDevice manager USB serial
port COM PORT.
19. FlashMagic P89V51RD2.
20. Enable erase all flash.
21. Select Hex file.
22. Enable verify after programming.
PROGRAM:
#include<reg51.h>
typedef unsigned char U8; // 8 bit
typedef unsigned int U32; // 32 bit
void _delay_ms(U32 ms);
void lcd_init()
{
lcd_cmd(0x38); // For using 8-bit 2 row LCD
_delay_ms(5);
lcd_cmd(0x0e); // For display on cursor blinking
_delay_ms(5);
lcd_cmd(0x01); // Clear display
_delay_ms(5);
lcd_cmd(0x06); // Increment the cursor
_delay_ms(5);
lcd_cmd(0x80); // Set the cursor on first position of
LCD
_delay_ms(5);
}
RESULT:
Thus an Embedded C Program to display the word in LCD using 8051 has been written and
the output is verified.
SOFTWARE REQUIRED :
EMBEDDED SYSTEM LAB Page 21
Keil Microvision4.
Flash Magic.
HARDWARE REQUIRED:
PROCEDURE :
1. Create a folder in D Drive .
2. Select Keil Microvision4.
3. Select project select new Microvision4 project.
4. Select the folder which already created in create new project optionssave the file name.
5. Select device for Target ‘Target 1’ dialog box appearselect NXP Founded by Philips.
6. Select P89V51RD2.
7. Copy startup to project folder and add file to project dialog box appearselect yes.
8. File startup A51 already exists overwrite dialog box appear select yes.
9. Then Target 1 will appear below project option select target 1 select new then text 1
screen will appear there type the program.
10. Save the program by selecting save options then save as dialog box will appear in that
select the folder already created in the save option.
11. Give the file name with the extension .c in the ‘filename option’.
12. maximize target 1, right click source group 1 ‘Add existing files’
13. Right click options for Target Target 1 will appear.
14. Type the frequency 1100592 in XTAL(MHZ) option.
15. Select output OK.
16. Select Build.
17. SelectRebuild.
18. My computer right clickpropertiesHardwareDevice manager USB serial
port COM PORT.
19. FlashMagic P89V51RD2.
20. Enable erase all flash.
21. Select Hex file.
22. Enable verify after programming.
PROGRAM:
#include<reg51.h>
typedef unsigned char U8; // 8 bit
typedef unsigned int U32; // 32 bit
void_delay_ms(U32ms);
EMBEDDED SYSTEM LAB Page 22
sbit I1=P2^0;
sbit I2=P2^1;
sbit I3=P2^2;
void main( )
{
EN=1;
While(1)
{
I1=1;
I2=0;
_delay_ms(500);
I1=1;
I2=1;
_delay_ms(500);
I1=0;
I2=1;
_delay_ms(500);
I1=1;
I2=1;
_delay_ms(500);
}
}
Void_delay_ms(U32ms);
{
Unsigned int i,j;
for(i=0;i<ms;i++)
for(j=0;j<ms;j++)
}
RESULT:
Thus an Embedded C Program to rotate the DC Motor in clockwise and Anti-clockwise
direction using 8051 has been written and the output is verified.
HARDWARE REQUIRED:
S.No Apparatus Required Quantity
1 8051 Kit 1
2 USB-Emulator-8051 1
3 USB Cable 1
4 Power Adapter 1
5 Connecting Wires As required
PROCEDURE :
1. Create a folder in D Drive .
2. Select Keil Microvision4.
3. Select project select new Microvision4 project.
4. Select the folder which already created in create new project optionssave the file name.
5. Select device for Target ‘Target 1’ dialog box appearselect NXP Founded by Philips.
6. Select P89V51RD2.
7. Copy startup to project folder and add file to project dialog box appearselect yes.
8. File startup A51 already exists overwrite dialog box appear select yes.
9. Then Target 1 will appear below project option select target 1 select new then text 1
screen will appear there type the program.
10. Save the program by selecting save options then save as dialog box will appear in that
select the folder already created in the save option.
11. Give the file name with the extension .c in the ‘filename option’.
12. maximize target 1, right click source group 1 ‘Add existing files’
13. Right click options for Target Target 1 will appear.
14. Type the frequency 1100592 in XTAL(MHZ) option.
15. Select output OK.
16. Select Build.
17. SelectRebuild.
18. My computer right clickpropertiesHardwareDevice manager USB serial
port COM PORT.
19. FlashMagic P89V51RD2.
20. Enable erase all flash.
PROGRAM:
#include<reg51.h>
void T0Delay(void);
void main(void)
{
while(1)
{
P0=0x55;
T0Delay();
P0=0xAA;
T0Delay();
}
}
void T0Delay()
{
TMOD=0x01;
TL0=0x00;
TH0=0x35;
TR0=1;
while(TF0==0);
TR0=0;
TF0=0;
}
RESULT:
Thus an Embedded C Program to generate square wave for variable frequencies using 8051
has been written and the output is verified.
SOFTWARE REQUIRED:
MATLAB R2009b
Personal computer
ALGORITHM:
1. Find the order and cutoff frequency of the Butterworth low pass filter
2. Find the transfer function of the Butterworth low pass filter
3. Find the frequency response of the corresponding filter
4. Plot the magnitude response for normalized frequency vs. gain
5. Plot the phase response for the normalized frequency vs. phase
6. Stop
PROGRAM:
clc;
clear all;
close all;
rp=input('enter the passband ripple');
rs=input('enter the stopband ripple');
wp=input('enter the passband frequency');
ws=input('enter the stopband frequency');
fs=input('enter the sampling frequency');
w1=2*(wp/fs);
w2=2*(ws/fs);
[n,wn]=cheb1ord(w1,w2,rp,rs);
[b,a]=choby1(n,rp,wn,'highpass');
w=0:0.01:pi;
[h,om]=freq(b,a,w);
m=20*log10(abs(h));
an=angle(h);
subplot(2,1,1);plot(om/pi,m);
EMBEDDED SYSTEM LAB Page 26
OUTPUT:
RESULT:
The MATLAB program for design of butter worth low pass digital filter has been verified.
PROGRAM:
clc;
clear all;
close all;
format long;
rp=input('enter the passband ripple');
rs=input('enter the stopband ripple');
wp=input ('enter the passband frequency');
ws=input('enter the stopband frequency');
fs=input('enter the sampling frequency');
w1=2*wp/fs;
w2=2*ws/fs;
[n,wn]=buttord(w1,w2,rp,rs);
[b,a]=butter(n,wn);
w=0:0.01:pi;
[h,om]=freqz(b,a,w);
m=20*log10(abs(h));
an=angle(h);
subplot (2,1,1);plot(om/pi,m);
ylabel('gain in db----->');
xlabel('normlized frequency---->');
subplot(2,1,2);plot(om.pi,an);
ylabel('phase in radians------>');
xlabel('normalized frequency---->');
LOGIC DIAGRAM:
RESULT:
Thus the half adder and full adder has been simulated and verified using verilog coding.
Flip-flop or latch is a circuit that has two stable states and can be used to store state information. A
flip-flop is a bistable multivibrator. The circuit can be made to change state by signals applied to one or
more control inputs and will have one or two outputs. It is the basic storage element in sequential logic.
Flip-flops and latches are a fundamental building block of digital electronics systems used in
computers, communications, and many other types of systems.
D-FLIP FLOP
The D flip-flop is widely used. It is also known as a "data" or "delay" flip-flop.The D flip-
flop captures the value of the D-input at a definite portion of the clock cycle (such as the rising
edge of the clock). That captured value becomes the Q output. At other times, the output Q
does not change.
TRUTH TABLE:
D Qn+1
0 0
1 1
PIPO:
In this case there is simultaneously entry of all data bits and the bits appear on parallel output
simultaneously.
SISO
module SISO(d,clk,rst,q);
input d,clk,rst;
output q;
wire w1,w2,w3;
dff1 a1(d,clk,rst,w1);
EMBEDDED SYSTEM LAB Page 35
dff1 a2(w1,clk,rst,w2);
dff1 a3(w2,clk,rst,w3);
dff1 a4(w3,clk,rst,q);
end module
PIPO
module PIPO(d,clk,rst,q);
input clk,rst;
input [3:0]d;
output [3:0]q;
dff1 a1(d[0],clk,rst,q[0]);
dff1 a2(d[1],clk,rst,q[1]);
dff1 a3(d[2],clk,rst,q[2]);
dff1 a4(d[3],clk,rst,q[3]);
end module
RESULT:
SOFTWARE REQUIRED :
Keil Microvision4.
Flash Magic.
HARDWARE REQUIRED:
S.No Apparatus Required Quantity
1 8051 Kit 1
2 USB-Emulator-8051 1
3 USB Cable 1
4 Power Adapter 1
5 Connecting Wires As required
PROCEDURE :
1. Create a folder in D Drive .
2. Select Keil Microvision4.
3. Select project select new Microvision4 project.
4. Select the folder which already created in create new project optionssave the file name.
5. Select device for Target ‘Target 1’ dialog box appearselect NXP Founded by Philips.
6. Select P89V51RD2.
7. Copy startup to project folder and add file to project dialog box appearselect yes.
8. File startup A51 already exists overwrite dialog box appear select yes.
9. Then Target 1 will appear below project option select target 1 select new then text 1
screen will appear there type the program.
10. Save the program by selecting save options then save as dialog box will appear in that
select the folder already created in the save option.
11. Give the file name with the extension .c in the ‘filename option’.
12. maximize target 1, right click source group 1 ‘Add existing files’
13. Right click options for Target Target 1 will appear.
14. Type the frequency 1100592 in XTAL(MHZ) option.
15. Select output OK.
16. Select Build.
17. SelectRebuild.
18. My computer right clickpropertiesHardwareDevice manager USB serial
port COM PORT.
19. FlashMagic P89V51RD2.
20. Enable erase all flash.
21. Select Hex file.
PROGRAM:
#include<reg51.h>
typedef unsigned char U8; // 8 bit
typedef unsigned int U32; // 32 bit
void _delay_ms(U32 ms);
void lcd_init();
void lcd_cmd(U8 DATA);
void lcd_data(U8 DATA);
void bcd_ascii(U8 i);
#define dataport P0 // Data port for LCD
#define adc_data P1 // Data port for ADC
sbit rs = P2^0;
sbit rw = P2^1;
sbit en = P2^2;
void main()
{
U8 adc_data_aqu;
lcd_init(); // Initialising LCD
adc_data=0xff; // Making p1(adc_data) as input port
while(1)
{
adc_data_aqu=adc_data;
lcd_cmd(0x80);
lcd_data('A'); //" Displaying Embedded market "
lcd_data('D');
lcd_data('C');
lcd_data(' ');
lcd_data('D');
lcd_data('a');
lcd_data('t');
lcd_data('a');
lcd_data(' ');
bcd_ascii(adc_data_aqu);
}
RESULT
Thus an Embedded C Program to generate ADC using 8051 has been written and the output
is verified.
Experiment .No : SWITCH
Date:
SOFTWARE REQUIRED :
Keil Microvision4.
Flash Magic.
HARDWARE REQUIRED:
PROCEDURE :
1. Create a folder in D Drive .
2. Select Keil Microvision4.
3. Select project select new Microvision4 project.
4. Select the folder which already created in create new project optionssave the file name.
5. Select device for Target ‘Target 1’ dialog box appearselect NXP Founded by Philips.
6. Select P89V51RD2.
7. Copy startup to project folder and add file to project dialog box appearselect yes.
8. File startup A51 already exists overwrite dialog box appear select yes.
9. Then Target 1 will appear below project option select target 1 select new then text 1
screen will appear there type the program.
10. Save the program by selecting save options then save as dialog box will appear in that
select the folder already created in the save option.
11. Give the file name with the extension .c in the ‘filename option’.
12. maximize target 1, right click source group 1 ‘Add existing files’
13. Right click options for Target Target 1 will appear.
14. Type the frequency 1100592 in XTAL(MHZ) option.
15. Select output OK.
16. Select Build.
17. SelectRebuild.
18. My computer right clickpropertiesHardwareDevice manager USB serial
port COM PORT.
19. FlashMagic P89V51RD2.
20. Enable erase all flash.
21. Select Hex file.
22. Enable verify after programming.