?? 1602.c
字號:
#include<absacc.h>
#include <AT89X51.h>
#include <intrins.h>
#define uchar unsigned char
#define uint unsigned int
//uchar code lcd0[]={"welcome!"};
//uchar code lcd1[]={"close!"};
//uchar code lcd5[]={"open! "};
//uchar code lcd6[]={"flash!"};
//uchar code lcd2[]={"^-^ count: "};
uchar code lcd3[]={"0123456789ab.def"};
uchar code lcd4[]={"error!"};
uchar d=0x00,e=0x00,i,j=0x00;
sbit RS=P3^0;
sbit RW=P3^1;
sbit EN=P3^2;
void Delay1ms( int ms)
{
int i;
while(ms--)
{
for(i = 0; i< 250; i++)
{
_nop_();
_nop_();
_nop_();
_nop_();
}
}
}
bit check()
{
bit busy;
RS=0;
RW=1;
EN=1;
_nop_();
_nop_();
_nop_();
_nop_();
EN=0;
return busy;
}
wzhilin(uchar zhi)
{
while(check());
RS=0;
RW=0;
EN=0;
_nop_();
_nop_();
P1=zhi;
_nop_();
_nop_();
_nop_();
_nop_();
EN=1;
_nop_();
_nop_();
_nop_();
_nop_();
EN=0;
}
wshuju(uchar shu)
{
while(check());
RS=1;
RW=0;
EN=0;
_nop_();
_nop_();
P1=shu;
_nop_();
_nop_();
_nop_();
_nop_();
EN=1;
_nop_();
_nop_();
_nop_();
_nop_();
EN=0;
}
chushihua()
{
wzhilin(0x38);
Delay1ms(1);
wzhilin(0x0c);
Delay1ms(1);
wzhilin(0x06);
Delay1ms(1);
wzhilin(0x01);
Delay1ms(1);
}
void weizhi1(uchar x,uchar y,uchar dat)
{
if(x==0)
{
wzhilin(0x80|y);
wshuju(lcd3[dat]);
Delay1ms(2);
}
if (x==1)
{
wzhilin(0xc0|y);
wshuju(lcd3[dat]);
Delay1ms(2);
}
}
void printf (uchar *p)
{
//wzhilin(0x80|4);
while(*p!='\0')
wshuju(*p++);
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -