www.pudn.com > FLUX-SENSOR-GSM-WITH-VOICE.rar > lcd.c, change:2012-03-04,size:1015b


#include <REGX51.H> 
#include"lcd.h" 
#include"serial.h" 
void lcd_init() 
{ 
	cmd(0x38); // initialiation 
	cmd(0x0c);//cursor control 
	cmd(0x01);//diplay clear 
	cmd(0x80); //address of lcd 
} 
 
void cmd(unsigned char h) 
{ 
	P2=h; 
	rs=0; 
	rw=0; 
	en=1; 
	delay(5); 
	en=0; 
 
} 
void write(unsigned char *p) 
{ 
	while(*p!='\0') 
	{ 
		lcd_write(*p); 
		 
		p++; 
	} 
} 
 
 
void lcd_write(unsigned char l) 
{ 
	P2=l; 
	rs=1; 
	rw=0; 
	en=1; 
	delay(5); 
	en=0; 
 
}  
 
void delay(unsigned int msec) 
{ 
	int i,j ; 
	for(i=0;i<msec;i++) 
	for(j=0;j<1275;j++);  
} 
/*void conv(unsigned char z) 
{ 
	unsigned char i,j,k; 
	cmd(0x83); 
	i=z/100; 
	lcd_write(0x30+i); 
	 send(0x30+i); 
	j=(z%100)/10; 
	lcd_write(0x30+j); 
	send(0x30+j); 
	k=z%10; 
	lcd_write(0x30+k); 
	send(0x30+k); 
} 
void conv1(unsigned char z) 
{ 
	unsigned char i,j,k; 
	cmd(0x8c); 
	i=z/100; 
	lcd_write(0x30+i); 
	 send(0x30+i); 
	j=(z%100)/10; 
	lcd_write(0x30+j); 
	send(0x30+j); 
	k=z%10; 
	lcd_write(0x30+k); 
	send(0x30+k); 
} */