#include<reg52.h>
#include <intrins.h>
#define uchar unsigned char
#define uint unsigned int
sbit ST=P3^0;
sbit OE=P3^2;
sbit EOC=P3^1;
sbit ADA=P0^2;
sbit ADB=P0^1;
sbit ADC=P0^0;
sbit pot0=P0^6;
sbit pot1=P0^7;
sbit key0=P3^3;sbit key1=P3^4;sbit key2=P3^5;sbit key3=P3^7;//sbit didian=P3^7;
uchar aa,bb,temp1,temp2,shuju0,shuju1,t=1,t1=1,t2=1,n=0,a=0,b,c,q,w,a1,c1,fwj,yj,getdate0,getdate1;
bit d=0,moshi=0,pp;
uint ml,mh,ml1,mh1;
char j0,j1,k0,k1,k2,k3;
////液晶定义//////////
sbit LCD_CS =P0^4; //LCD片选端
sbit LCD_SID=P0^3; //LCD串行数据输入/输出端
sbit LCD_CLK=P0^5; //LCD串行同步时钟,上升沿时读写SID数据.
//函数声明:
void LCD_SEND(unsigned char send_data);
unsigned char LCD_RECEIVE();
unsigned char LCD_READ_BF();
void LCD_WRITE_IR(unsigned char LCD_COMMAND);
void LCD_WRITE_DR(unsigned char LCD_DATA);
void WriteStrAt(const uchar *str, uchar x, uchar y);
void WriteStr(unsigned char code *s);
void GotoXY(uchar x, uchar y);
void clrram(void);
void delay(uchar z);
void LCD_INIT()
{
LCD_WRITE_IR(0x01);
LCD_WRITE_IR(0x38);
LCD_WRITE_IR(0x0c);
LCD_WRITE_IR(0x06);
LCD_WRITE_IR(0x80);
LCD_WRITE_IR(0x0f);LCD_WRITE_IR(0x0c);
}
void delay2(unsigned int t)
{ unsigned int i,j;
for(i=0;i<t;i++)
for(j=0;j<1000;j++);
}
/**********************************************************
*写指令到LCD函数
*名称:LCD_WRITE_IR
*入口参数:LCD_COMMAND (字符型--8位数据)
**********************************************************/
void LCD_WRITE_IR(unsigned char LCD_COMMAND)
{
unsigned char temp_data;
LCD_CS = 0; //拉低片选终止所有数据传送
while(LCD_READ_BF()&0x80==1);//判忙
LCD_CS = 1; //拉高片选准备传送数据