- This topic has 1 reply, 2 voices, and was last updated 8 years, 6 months ago by .
Viewing 2 posts - 1 through 2 (of 2 total)
Viewing 2 posts - 1 through 2 (of 2 total)
- You must be logged in to reply to this topic.
|
Microcontroller › 8051 › Please convert code to flowchart…Now I am confused
#include <reg51.h>
sbit rs=P3^0;
sbit e=P3^2;
void delay(int x);
void init_LCD();
void write(unsigned char dat, add);
void enable();
void main()
{char num[10]={'0','1','2','3','4','5','6','7','8','9'};
char text[9]={'O','U','R',' ','C','L','O','C','K'};
int hour,minit,i;
init_LCD();
while(1)
{ for(i=0;i<9;i++)
write(text,0x84+i);
for(hour=0;hour<24;hour++)
for(minit=0;minit<60;minit++)
{ write(num[hour/10],0xC6);
write(num[hour%10],0xC7);
write(':',0xC8);
write(num[minit/10],0xC9);
write(num[minit%10],0xCA);
}
}
}
void delay(int x)
{for(x=x;x>0;x–);
}
void enable()
{ e=1;
delay(500);
e=0;
delay(500);
}
void init_LCD()
{ //LCD 16*2
delay(20000);
rs=0;
P2=0x38;
enable();
//clear
rs=0;
P2=0x01;
enable();
//Cursor shift right
rs=0;
P2=0x06;
enable();
// Display LCD
rs=0;
P2=0x0C;
enable();
}
void write(unsigned char dat, add)
{ //add locate
rs=0;
P2=add;
enable();
//write data to LCD
rs=1;
P2=dat;
enable();
}
……Thank you
ok . provide ur email id to send flow chart of this prgm. bcoz, i didn't know how to post image in this.