Free online courses with Free Certificate
Keil c51:
DevC++ compiler(or IDE)
Download link: Click here
step-1: right click on "Keil uvision" and click on "run as administrator"
step-2: now go to project >> new project >> "project_name.uvproj"
step-3: select "at89c51" as shown below
step-3: now file >> new file
step-4: click on save as then save with "file_name.c" i.e. with ".c" extension
step-5: now copy code given below and paste and save it, as shown below
step-6: to the left side of window right click on "Source group 1" and then click on "add existing file to source group 1"
step-7: now click on project >> build target to compile this code i.e. to check if any error in code
step-8: to generate "hex file" of this code right click on "target 1" tab to the left side of your window and then click on "options for target 'target 1'... " as shown below
step-9: now change frequency to "11.0592MHz" and tick to "use on-chip ROM" as shown below
step-10: now in same window options click on output >> tick to "create hex file" as shown below
step-11: click again on "build target" to create "hex file" as shown below
Embedded C code :
Code without comments (for simplicity)
#include<reg51.h>
sbit rs=P1^0;
sbit rw=P1^1;
sbit en=P1^2;
void lcdcmd(unsigned char);
void lcddat(unsigned char);
void delay();
void main()
{
P2=0x00; //output i.e. d0-d7 connection
while(1)
{
lcdcmd(0x38); //for 5x7 matrix
delay();
lcdcmd(0x01); //clearing screen
delay();
lcdcmd(0x01); //cursor blinking
delay();
lcdcmd(0x0c); //display ON
//delay();
lcddat('E');
//delay();
lcddat('M');
//delay();
lcddat('B');
//delay();
lcddat('E');
//delay();
lcddat('D');
//delay();
lcddat('D');
//delay();
lcddat('E');
//delay();
lcddat('D');
//delay();
lcddat(' ');
//delay();
lcddat('S');
//delay();
lcddat('Y');
//delay();
lcddat('S');
//delay();
lcddat('T');
//delay();
lcddat('E');
//delay();
lcddat('M');
//delay();
}
}
void lcdcmd(unsigned char val)
{
P2=val;
rs=0;
rw=0;
en=1;
delay();
en=0;
}
void lcddat(unsigned char val)
{
P2=val;
rs=1;
rw=0;
en=1;
delay();
en=0;
}
void delay()
{
unsigned int i;
for(i=0;i<12000;i++);
}
Free online courses with Free Certificate
Free online courses with Free Certificate
Free online courses with Free Certificate
Proteus:
Download link: Click here !
step-1: right click on "Proteus 8 professional"(whichever version available) and "run as administrator"
step-2: now go to project >> new project >> "New Project.pdsprj"
step-2: click on "P" and open window for "pick devices" as shown below
step-3: now type "at89c51" and select microcontroller then press ok
step-4: now type "16x2 LCD display" and select "LM016L" as shown below
step-5: now draw circuit as shown below
step-6: click on "terminal" icon to left side window and then select "power" label and connect to 7 segment display as shown below
step-7: now double click on microcontroller symbol then "edit component" window will open. then click on "folder symbol" to select ".hex" file and change frequency to 11.0592MHz as shown below
Note- make sure you know path of ".hex" file generated through Keil c51 as shown below
e.g. - ..\..\..\Keil_v5\C51\Examples\my project\Objects\7segment 8051.hex
step-8: click on "play button" and check output as shown below
Check actual simulation in GIF format as shown below
If you found any difficulty or any suggestions please comment below or contact me on "pangfreelearner@gmail.com".
And also visit my YouTube channel for "Free online courses with Free certificate" on below link.
Free online courses with Free Certificate
Join Facebook group for Free online courses with Free certificate
Thank you.
PANG.
No comments:
Post a Comment