📄 mylcd.c
字号:
#pragma SFR //special function register
#pragma NOP
#pragma DI
#pragma EI
#include "MyDefine.h"
#define s_g_DataPort P8 // data port 这样定义可以吗?是不是Uchar s_g_DataPort = P8?
#define s_g_RS P9.1
#define s_g_RW P9.2
#define s_g_E1 P9.3
#define s_g_E2 P0.0
#define s_g_RST P9.0
#define s_g_LCDLEDCTL P0.1 //set to 0 when initialized
#define s_g_LCDPWRCTL P0.2 //set to 0 when initialized
#define s_g_BusyFlag P8.0
void DisplayStr(Uchar x,Uchar y, Uchar *ptr);
void DispOneChar(Uchar x,Uchar y,Uchar Wdata);
void LocateXY( char posx,char posy);
Uchar BitsReverse(Uchar value); //Bits of value are reversed
void LcdReset();
void Delay100us(); //延时100us,通过实验实现;是否100us合适,也需要实验!未完!!
void Delay100ms();
void WaitForEnableU();
void WaitForEnableD();
void LcdWriteDataU(char dataW); //By invoking the function BitsReverse() firstly, the cmd is reversed.
void LcdWriteDataD(char dataW); //By invoking the function BitsReverse() firstly, the cmd is reversed.
void LcdWriteCommandU( Uchar cmd,Uchar attribBusyFlg ); //By invoking the function BitsReverse() firstly, the cmd is reversed.
void LcdWriteCommandD( Uchar cmd,Uchar attribBusyFlg ); //By invoking the function BitsReverse() firstly, the cmd is reversed.
//extern void Delay100us(); //延时100us,通过实验实现;是否100us合适,也需要实验!未完!!
/*=======================================================
* LCD initial
=======================================================*/
void LcdReset()
{
//初始化时不需检测忙碌标志位????
// LcdWriteCommand( 0x38, 0); // 显示模式设置(不检测忙信号)
// Delay5Ms();
// LcdWriteCommand( 0x38, 0); // 共
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -