sbit CS1=P1^0; sbit SCL=P1^3; sbit SI=P1^4; sbit RES=P1^1; sbit A0=P1^2; void delay(unsigned int time) {while(time--); } void s_out(unsigned char cd) {int i; i=0x80; CS1=0; while(i) { SCL=0; SI=cd&i; i>>=1; SCL=1; } CS1=1; } void wc(unsigned char c) {A0=0; s_out(c); } void wd(unsigned char d) {A0=1; s_out(d); } void lcd_init()//液晶初始化 {RES=0; delay(1); RES=1;//复位 delay(1); wc(0xa2);//lcd bias select 1/9 BIAS wc(0xa0);//ADC select,NORMAL 0-->127 wc(0xc8);//com select,REVERSE 63-->0 wc(255);//B00STER RATIO SET wc(37);//RESISTOR RATIO wc(0x81);//ELECTRONIC VOLUME mode setting 100B 对比度命令 wc(0);//Set reference voltagel register 59 对比度数值 wc(0x2c);//power control wc(0x2e);//power control wc(0x2f);//power control wc(0xae);//set display on wc(0xf8);//set display on wc(0);//set display on } void cswc(unsigned char s)//clean the screen with a char "s" {int i,j; unsigned char page; page=0xb0; wc(page); wc(0x10); wc(0x00); for(i=0;i<8;i++) {for(j=0;j<135;j++) {wd(s); } page++; wc(page); wc(0x10); wc(0x00); } wc(0xaf); } void disp(unsigned char x,unsigned char y,unsigned char *p)//显示核心函数 { int i,j; int hight,width; hight=16; width=8; wc(0xaf); for(j=0;j<(hight/8);j++) { wc(0xb0+j+y); wc((0x0f&(x>>4))|0x10); wc(0x0f&x); for(i=0;i