#include<reg52.h>
#define adc_input P2
#define lcd_data P1
void delay (int);
void lcdcmd (char);
void lcddata (char);
void lcd_init(void);
sbit r = P3^1;
sbit w = P3^2;
sbit rs = P3^7;
sbit rw = P3^6;
sbit e = P3^5;
sbit intr = P3^3;
void main()
{
signed char x, a, b, c;
while (1)
{
r = 1;
w = 0;
delay (1);
w = 1;
while (intr == 1);
r = 0;
lcd_init();
lcddata ('t');
lcddata ('e');
lcddata ('m');
lcddata ('p');
lcddata (':');
x = adc_input / 10;
a = x / 10;
b = x % 10;
c = adc_input % 10;
lcddata ( a + 0x30 );
lcddata ( b + 0x30 );
lcddata ( c + 0x30 );
}
}
void delay( int a )
{
int i,j ;
for(i=0;i<a;i++)
for(j=0; j<1275; j++);
}
void lcdcmd (char value)
{
rs=0;
lcd_data = value;
rw=0;
e=1;
delay (1);
e=0;
}
void lcd_init(void)
{
lcdcmd(0x38);
lcdcmd(0x0c);
lcdcmd(0x06);
lcdcmd(0x80);
}
void lcddata (char value)
{
rs=1;
lcd_data = value;
rw=0;
e=1;
delay (1);
e=0;
}