#include
#include
#include
xdata volatile unsigned char rs _at_ 0xFE01;
xdata volatile unsigned char lcd _at_ 0xFE00;
void main()
{
init_lcd();
printlcd(" Ei Labz ");
while(1);
}
/*********************************************************
Function to initialize lcd
*********************************************************/
void init_lcd()
{
writecommand(0x38); //Two lines 5x7 matrix
writecommand(0x01); //Clear Display screen
writecommand(0x06); //Increment Cursor
writecommand(0x0c); //Display on cursor off
}
/*********************************************************/
/*********************************************************
Function to write COMMAND into lcd
*********************************************************/
void writecommand(unsigned char data1)
{
lcd=data1;
_nop_();
_nop_();
delay();
}
/*********************************************************/
/*********************************************************
Function to print a string data into lcd
*********************************************************/
void printlcd(unsigned char *str)
{
unsigned char len,i;
len=strlen(str);
for(i=0;i<=len-1;i++)
{
writedata(*str);
str++;
}
}
/*********************************************************/
void writedata(unsigned char data2)
{
rs=data2;
_nop_();
_nop_();
delay();
}
/*********************************************************
Function which causes some delay
*********************************************************/
void delay()
{
int k;
for(k=0;k<=9000;k++);
}
#include
#include
#define ch1 0xE8;
#define ch2 0xE9;
#define ch3 0xEA;
#define ch4 0xEB;
#define ch5 0xEC;
#define ch6 0xED;
#define ch7 0xEE;
#define ch8 0xEF;
xdata volatile unsigned char CONTROL _at_ 0xFC00;
sbit b=P3^2;
void Send(unsigned char x)
{
SBUF=x;
while(!TI);
TI=0;
}
void Send_String(char* string, unsigned char no_of_bytes)
{
int i, stringlength = no_of_bytes;
for(i=1; i<=stringlength; i++)
{
Send(*string++);
}
}
void hex2ascii(unsigned char i)
{
unsigned char tmp;
unsigned char ASCII[2];
tmp = i>>4;
if(tmp <= 0x09)
ASCII[0] = tmp+0x30;
else
{
ASCII[0] = tmp-0x9;
ASCII[0] += 0x40;
}
tmp = (i & 0x0f);
if(tmp <= 0x09)
ASCII[1] = tmp+0x30;
else
{
ASCII[1] = tmp-0x9;
ASCII[1] += 0x40;
}
Send_String(ASCII,2);
}
unsigned char Read_ADC(unsigned char x)
{
b=1;
if(x=='1')
{
CONTROL=ch1;
while(!b);
return CONTROL;
}
if(x=='2')
{
CONTROL=ch2;
while(!b);
b = 0;
return CONTROL;
}
if(x=='3')
{
CONTROL=ch3;
while(!b);
return CONTROL;
}
if(x=='4')
{
CONTROL=ch4;
while(!b);
return CONTROL;
}
if(x=='5')
{
CONTROL=ch5;
while(!b);
return CONTROL;
}
if(x=='6')
{
CONTROL=ch6;
while(!b);
return CONTROL;
}
if(x=='7')
{
CONTROL=ch7;
while(!b);
return CONTROL;
}
if(x=='8')
{
CONTROL=ch8;
while(!b);
return CONTROL;
}
}
void delay(void)
{
unsigned int k;
for (k=0;k<0xfffe;k++)
{
_nop_();_nop_();_nop_();_nop_();_nop_();
_nop_();_nop_();_nop_();_nop_();_nop_();
_nop_();_nop_();_nop_();_nop_();_nop_();
}
}
void main(void)
{
SCON = 0x50;
TMOD = 0x21;
TH1 = 0xfd;
TL1 = 0xfd;
TCON = 0x45;
TR1=1;
while(1)
{
hex2ascii(Read_ADC('1'));
delay();
}
}
A mechanic was removing the cylinder heads from the motor of a car when
he spotted the famous heart surgeon in his shop, who was standing off to
the side, waiting for the service manager to come to take a look at his
car.
The mechanic shouted across the garage," Hello Doctor!! Please come over
here for a minute."
The famous surgeon, a bit surprised, walked over to the mechanic.
The mechanic straightened up, wiped his hands on a rag and asked
argumentatively, "So doctor, look at this. I also open hearts, take
valves out, grind 'em, put in new
parts, and when I finish this will
work as a new one... So how come you get the big money, when you and me
is doing basically the same work? "
The doctor leaned over and whispered to the mechanic.... .
.
.
.
.
.
.
.
...
..
..
Doctor said : " Try to do it when the Engine is RUNNING "
--
Many times in life, whether a thing is worth doing or not, really depends on how u look at it.
Take up all your courage and do something your heart tells you to do so that you may not regret not doing it later in your life........