📄 shishi.c
字号:
#include <reg51.h> /*液晶屏中央显示 e 的程序*/
#include <math.h>
#include <absacc.h>
#include <string.h>
#define uint unsigned int
#define uchar unsigned char
#define send XBYTE[0xdfff] /*地址定义*/
TABLE1[5]={0x33,0x49,0x00,0x24,0x41};
TABLE2[4]={0x1e,0x11,0x15,0x2e};
sbit ACC_0=ACC^0; /*定义标准位*/
sbit ACC_1=ACC^1;
sbit ACC_2=ACC^2;
sbit ACC_3=ACC^3;
sbit ACC_5=ACC^5;
sbit P1_4=P1^4;
uint com,dat1,dat2; /*定义变量*/
void sta01() /*状态位写指令和写数据的准备判断*/
{
P1_4=1;
do
{
ACC=send;
}
while(ACC_0==0||ACC_1==0||ACC_5==0);
}
void sta3() /*自动写数据的状态位判断*/
{
P1_4=1;
do
{
ACC=send;
}
while(ACC_3==0||ACC_5==0);
}
void write1() /*无参数指令写入*/
{
sta01();
send=com;
P1_4=1;
}
void write2() /*单字节参数指令写入*/
{
sta01();
P1_4=0;
send=dat2;
write1();
}
void write3() /*双字节参数指令写入*/
{
sta01();
P1_4=0;
send=dat1;
write2();
}
void chushihua() /*初始化*/
{
dat1=0x00; /*设文本显示区域首地址*/
dat2=0x00;
com=0x40;
write3();
dat1=0x28; /*设文本显示区域宽度*/
dat2=0x00;
com=0x41;
write3();
dat1=0x00; /*设图形显示区域宽度*/
dat2=0x08;
com=0x42;
write3();
dat1=0x28; /*设图形显示区域宽度*/
dat2=0x00;
com=0x43;
write3();
com=0x80; /*显示方式设置*/
write1();
com=0x9c; /*显示开关设置*/
write1();
}
void clear() /*清显示屏*/
{
uint i;
dat1=0x00;
dat2=0x00;
com=0x24; /*设置显示地址*/
write3();
com=0xb0; /*设置自动写方式*/
write1();
for(i=0;i<8200;i++) /*清屏8200个点阵字符*/
{
sta3();
P1_4=0;
send=0x00;
}
com=0xb2; /*结束自动写方式*/
write1();
}
void display33() /*定义显示函数*/
{
dat1=0x8C;
dat2=0x00;
com=0x24; /*设置显示位置*/
write3();
dat2=0x45;
com=0xc0; /*写数据*/
write2();
}
void main() /*主函数*/
{
chushihua();
clear();
display33();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -