Professional Documents
Culture Documents
(18EC2205)
LABORATORY MANUAL
2019-2020
Course Coordinator
Dr. N.Prabakaran, Associate Professor
Course Instructors
Mr.Nagesh Mantravadi, Associate Dean
Mr.Venkata Suman, Assistant Professor
Mrs. K.V.Sowmya, Assistant Professor
Mrs.V.Teju, Assistant Professor
Mr. Khanal Madhav Prasad, Assistant Professor
Mr.K.T.P.S.kumar, Assistant Professor
Step 1: Give a double click on μvision4 icon on the desktop, it will generate a window as shown below:
Step 9: A target is created and startup file is added to your project target and is shown below.
Step 10: To write your project code select a new file from FILE menu bar.
Step 11: It will display some text editor, to save that file select SAVE option from FILE menu bar.
Step 13: Write the code of your project and save it.
Step 14: To add c file to target, give a right click on Source Group, choose “ADD files to Group” option.
Step 15: It will displays some window there select the file you have to add and click on ADD option.
Step 16: The file will be added to target and it is shown in the project window.
Step 17: Now give a right click on target in the project window and select “Options for Target”.
Step 18: It will show some window, in that go to output option and choose Create Hex file option by
selecting that box.
Step 19: In the same window go to Linker option and choose use memory layout from target dialog by
selecting the box, and Click OK.
Step 20: Now to compile your project Select build target option or press F7.
Step 21: In the build OUTPUT window, you can see the errors and warnings of the code. Project HEX file
will be created.
ALM 1:
Program:-
#include<reg51.h>
#define LED P2
void main(void)
P1=0;
LED=0;
for(;;)
P1++;
MSDelay(2000);
LED=~P1;
MSDelay(2000);
for(i=0;i<itime;i++)
for(j=0;j<1275;j++);
}
Result:
Program:
#include<reg51.h>
#define LED P2
void T1M2Delay(void);
void main(void)
while(1)
MYBIT=~MYBIT;
T1M2Delay();
void T1M2Delay(void)
TMOD=0x20;
TH1=0x00;
TR1=1;
while(TF1==0);
TR1=0;
TF1=0;
}
To see the waveform
Result:
Square wave form generated by using Timer1 mode 2,
ALM 3:
Aim: To Transfer Data through Serial Port
Program:-
#include <reg51.h>
void main(void)
TMOD=0x20;
TH1=0xFA;
SCON=0x50;
TR1=1;
while(1)
SBUF='P';
while(TI==0);
TI=0;
SBUF='&';
while(TI==0);
TI=0;
SBUF='C';
while(TI==0);
TI=0;
Program:-
#include <reg51.h>
sbit SW = P1^7;
sbit IND=P1^0;
#define LED P2
LED=~LED;
void main()
SW=1;
TMOD = 0x02;
TH0=0xA4;
IE = 0x82;
TR0=1;
while (1)
IND=SW;
Result: Blink the LED’s which are connected in PORT2 using Timer0 Internal Interrupt