/********************************************************************/
#define LcdDataPort PioPortB
#define LcdCtrlPort PioPortC
/* Bit Address Assignment*/
#define LcdRegPin 0x01 /* bit 0 of the port */
#define LcdRWPin 0x02 /* bit 1 of the port */
#define LcdEnablePin 0x04 /* bit 2 of the port */
#define LcdCS1Pin 0x08 /* bit 3 of the port */
#define LcdCS2Pin 0x10 /* bit 4 of the port */
#define LcdELPin 0x20 /* bit 5 of the port */
/* for Lcd System */
unsigned char lcd_row, lcd_column;
unsigned char lcd_hrow,lcd_hcolumn,lcd_ascii;
unsigned char lcd_x;
bit lcd_color;
char TranDec[4];
code char Bit_table[]={0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80};
code char Hex_table[]={'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};
code char Char_Bit[][6]={
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* */
{ 0x00, 0x00, 0x4F, 0x00, 0x00, 0x00}, /* ! */
{ 0x00, 0x04, 0x03, 0x04, 0x03, 0x00}, /* " */
{ 0x14, 0x7F, 0x14, 0x7F, 0x14, 0x00}, /* # */
{ 0x24, 0x2A, 0x7F, 0x2A, 0x12, 0x00}, /* $ */
{ 0x23, 0x13, 0x08, 0x64, 0x62, 0x00}, /* % */
{ 0x36, 0x49, 0x56, 0x20, 0x58, 0x00}, /* & */
{ 0x00, 0x00, 0x05, 0x03, 0x00, 0x00}, /* ' */
{ 0x00, 0x1C, 0x22, 0x41, 0x00, 0x00}, /* ( */
{ 0x00, 0x41, 0x22, 0x1C, 0x00, 0x00}, /* ) */
{ 0x22, 0x14, 0x7F, 0x14, 0x22, 0x00}, /* * */
{ 0x08, 0x08, 0x3E, 0x08, 0x08, 0x00}, /* + */
{ 0x00, 0x00, 0x28, 0x18, 0x00, 0x00}, /* , */
{ 0x08, 0x08, 0x08, 0x08, 0x08, 0x00}, /* - */
{ 0x00, 0x00, 0x60, 0x60, 0x00, 0x00}, /* . */
{ 0x20, 0x10, 0x08, 0x04, 0x02, 0x00}, /* / */
{ 0x3e, 0x51, 0x49, 0x45, 0x3e, 0x00}, /* 0 */
{ 0x00, 0x42, 0x7f, 0x40, 0x00, 0x00}, /* 1 */
{ 0x42, 0x61, 0x51, 0x49, 0x46, 0x00}, /* 2 */
{ 0x21, 0x41, 0x45, 0x4B, 0x31, 0x00}, /* 3 */
{ 0x18, 0x14, 0x12, 0x7F, 0x10, 0x00}, /* 4 */
{ 0x27, 0x45, 0x45, 0x45, 0x39, 0x00}, /* 5 */
{ 0x3C, 0x4A, 0x49, 0x49, 0x30, 0x00}, /* 6 */
{ 0x01, 0x01, 0x71, 0x0D, 0x03, 0x00}, /* 7 */
{ 0x36, 0x49, 0x49, 0x49, 0x36, 0x00}, /* 8 */
{ 0x06, 0x49, 0x49, 0x29, 0x1E, 0x00}, /* 9 */
{ 0x00, 0x00, 0x36, 0x36, 0x00, 0x00}, /* : */
{ 0x00, 0x00, 0x56, 0x36, 0x00, 0x00}, /* ; */
{ 0x00, 0x08, 0x14, 0x22, 0x41, 0x00}, /* < */
{ 0x00, 0x14, 0x14, 0x14, 0x14, 0x00}, /* = */
{ 0x00, 0x41, 0x22, 0x14, 0x08, 0x00}, /* > */
{ 0x02, 0x01, 0x51, 0x09, 0x06, 0x00}, /* ? */
{ 0x3E, 0x41, 0x5D, 0x55, 0x3E, 0x00}, /* @ */
{ 0x7C, 0x12, 0x11, 0x12, 0x7C, 0x00}, /* A */
{ 0x7F, 0x49, 0x49, 0x49, 0x36, 0x00}, /* B */
{ 0x3E, 0x41, 0x41, 0x41, 0x22, 0x00}, /* C */
{ 0x7F, 0x41, 0x41, 0x22, 0x1C, 0x00}, /* D */
{ 0x7F, 0x49, 0x49, 0x49, 0x41, 0x00}, /* E */
{ 0x7F, 0x09, 0x09, 0x09, 0x01, 0x00}, /* F */
{ 0x3E, 0x41, 0x49, 0x49, 0x7A, 0x00}, /* G */
{ 0x7F, 0x08, 0x08, 0x08, 0x7F, 0x00}, /* H */
{ 0x00, 0x41, 0x7f, 0x41, 0x00, 0x00}, /* I */
{ 0x20, 0x40, 0x41, 0x3F, 0x01, 0x00}, /* J */
{ 0x7F, 0x08, 0x14, 0x22, 0x41, 0x00}, /* K */
{ 0x7F, 0x40, 0x40, 0x40, 0x40, 0x00}, /* L */
{ 0x7F, 0x02, 0x0C, 0x02, 0x7F, 0x00}, /* M */
{ 0x7F, 0x04, 0x08, 0x10, 0x7F, 0x00}, /* N */
{ 0x3E, 0x41, 0x41, 0x41, 0x3E, 0x00}, /* O */
{ 0x7F, 0x09, 0x09, 0x09, 0x06, 0x00}, /* P */
{ 0x3E, 0x41, 0x51, 0x21, 0x5E, 0x00}, /* Q */
{ 0x7F, 0x09, 0x19, 0x29, 0x46, 0x00}, /* R */
{ 0x26, 0x49, 0x49, 0x49, 0x32, 0x00}, /* S */
{ 0x01, 0x01, 0x7f, 0x01, 0x01, 0x00}, /* T */
{ 0x3F, 0x40, 0x40, 0x40, 0x3F, 0x00}, /* U */
{ 0x1F, 0x20, 0x40, 0x20, 0x1F, 0x00}, /* V */
{ 0x3F, 0x40, 0x38, 0x40, 0x3F, 0x00}, /* W */
{ 0x63, 0x14, 0x08, 0x14, 0x63, 0x00}, /* X */
{ 0x03, 0x04, 0x78, 0x04, 0x03, 0x00}, /* Y */
{ 0x61, 0x51, 0x49, 0x45, 0x43, 0x00}, /* Z */
{ 0x00, 0x7F, 0x41, 0x41, 0x00, 0x00}, /* [ */
{ 0x02, 0x04, 0x08, 0x10, 0x20, 0x00}, /* \ */
{ 0x00, 0x41, 0x41, 0x7F, 0x00, 0x00}, /* ] */
{ 0x10, 0x08, 0x04, 0x08, 0x10, 0x00}, /* ^ */
{ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00}}; /* _ */
/*汉字点阵*/
code Hchar_Bit[][32]={{0x00,0x08,0x24,0xa2,0xff,0xa1,0x20,0x00,0x40,0x5e,
0x52,0xd2,0x52,0x5e,0x40,0x00,0x00,0x04,0x02,0x01,
0x1f,0x01,0x02,0x00,0x12,0x12,0x12,0x1f,0x12,0x12,
0x12,0x00},{0x00,0x00,0xfb,0x04,0x54,0x54,0x54,0x57,0xff,0x54,0x54,0x54,0xf2,0x44,0x44,0x00,
0x00,0x00,0xff,0x00,0x79,0x29,0x29,0x29,0x2f,0x29,0x29,0x29,0x79,0x00,0x00,0x00},
{0x00,0xf0,0x00,0xfe,0x20,0x10,0x48,0x48,0x48,0xff,0x48,0x48,0x48,0x48,0x08,0x00,
0x00,0x40,0x38,0x07,0x04,0x08,0x12,0x02,0x02,0x7f,0x02,0x02,0x22,0x22,0x1e,0x00},
{0x00,0x40,0x20,0x98,0x8e,0x8a,0x88,0x88,0xf8,0x88,0x88,0x88,0x88,0x08,0x00,0x00,
0x00,0x08,0x08,0x0f,0x08,0x08,0x08,0x08,0xff,0x08,0x08,0x08,0x08,0x08,0x08,0x00},
{0x00,0x10,0x08,0x84,0x42,0x20,0x00,0x40,0x44,0x44,0x44,0x44,0xc4,0x44,0x44,0x40,
0x00,0x02,0x01,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0xc0,0xff,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfc,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x00,
0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x7f,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00},
{0x00,0x84,0x84,0xfc,0x84,0x84,0xf0,0x00,0xfe,0x00,0x00,0x84,0xfc,0x84,0x84,0x04,
0x00,0x20,0x30,0x1f,0x10,0x10,0x61,0x10,0x0f,0x20,0x20,0x20,0x3f,0x20,0x20,0x20},
{0x00,0x02,0x02,0x02,0x02,0x02,0x02,0xfe,0x12,0x22,0x42,0x82,0x02,0x02,0x02,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
{0x00,0x40,0x42,0xcc,0x00,0x00,0x00,0xfe,0x22,0x22,0x22,0x22,0x22,0x7e,0x00,0x00,
0x00,0x20,0x10,0x1f,0x10,0x24,0x22,0x21,0x20,0x20,0x21,0x22,0x24,0x28,0x20,0x00},
{0x00,0x62,0x52,0x4a,0xc6,0x42,0x52,0x62,0x80,0x00,0xfc,0x00,0x00,0xff,0x00,0x00,
0x00,0x22,0x12,0x12,0x1f,0x12,0x12,0x12,0x00,0x00,0x07,0x20,0x20,0x3f,0x00,0x00}
};
void LcdDelay(void); /* 延时 */
void LcdDelay()
{
data char i;
for (i=0;i<10;i++);
}
void LcdBacklight(bit); /* 背光 */
void LcdBacklight(bit on)
{
if (on)
LcdCtrlPort = LcdCtrlPort | LcdELPin;
else
LcdCtrlPort = LcdCtrlPort & (LcdELPin^0xff);
}
void LcdCmd(char); /* LCD命令 */
void LcdCmd(char c)
{
PioCon = 0x0c|0x02|0x00;
/* Input Output
Port A = 0x00 0x01
Port B = 0x00 0x02
Port C = 0x00 0x0c
Counter = Disable
*/
LcdDataPort = c;
LcdCtrlPort = LcdCtrlPort & (LcdRegPin^0xff);
LcdCtrlPort = LcdCtrlPort & (LcdRWPin^0xff);
LcdCtrlPort = LcdCtrlPort | LcdCS1Pin;
LcdCtrlPort = LcdCtrlPort | LcdCS2Pin;
LcdCtrlPort = LcdCtrlPort | LcdEnablePin;
LcdDelay();
LcdCtrlPort = LcdCtrlPort & (LcdEnablePin^0xff);
LcdDelay();
}
void LcdData(char); /* 赋LCD数据 */
void LcdData(char c)
{
PioCon = 0x0c|0x02|0x00;
/* Input Output
Port A = 0x00 0x01
Port B = 0x00 0x02
Port C = 0x00 0x0c
Counter = Disable
*/
LcdDataPort = c;
LcdCtrlPort = LcdCtrlPort | LcdRegPin;
LcdCtrlPort = LcdCtrlPort & (LcdRWPin^0xff);
LcdCtrlPort = LcdCtrlPort | LcdCS1Pin;
LcdCtrlPort = LcdCtrlPort | LcdCS2Pin;
LcdCtrlPort = LcdCtrlPort | LcdEnablePin;
LcdDelay();
LcdCtrlPort = LcdCtrlPort & (LcdEnablePin^0xff);
LcdDelay();
}
void LcdData1(char); /* Photo type of routine */
void LcdData1(char c)
{
PioCon = 0x0c|0x02|0x00;
/* Input Output
Port A = 0x00 0x01
Port B = 0x00 0x02
Port C = 0x00 0x0c
Counter = Disable
*/
LcdDataPort = c;
LcdCtrlPort = LcdCtrlPort | LcdRegPin;
LcdCtrlPort = LcdCtrlPort & (LcdRWPin^0xff);
LcdCtrlPort = LcdCtrlPort | LcdCS1Pin;
LcdCtrlPort = LcdCtrlPort & (LcdCS2Pin^0xff);
LcdCtrlPort = LcdCtrlPort | LcdEnablePin;
LcdDelay();
LcdCtrlPort = LcdCtrlPort & (LcdEnablePin^0xff);
LcdDelay();
}
void LcdData2(char); /* Photo type of routine */
void LcdData2(char c)
{
PioCon = 0x0c|0x02|0x00;
/* Input Output
Port A = 0x00 0x01
Port B = 0x00 0x02
Port C = 0x00 0x0c
Counter = Disable
*/
LcdDataPort = c;
LcdCtrlPort = LcdCtrlPort | LcdRegPin;
LcdCtrlPort = LcdCtrlPort & (LcdRWPin^0xff);
LcdCtrlPort = LcdCtrlPort & (LcdCS1Pin^0xff);
LcdCtrlPor
图形LCD显示函数程序.rar_C51函数_lcd图形显示
版权申诉
169 浏览量
2022-09-14
14:20:23
上传
评论
收藏 3KB RAR 举报
朱moyimi
- 粉丝: 64
- 资源: 1万+
最新资源
- RAG技术知识图谱概览
- VMware Workstation功能强大的桌面虚拟计算机软件
- 中文命名实体识别,采用bilstm+crf模型基于Pytorch实现
- PowerGREP V5.3.3 Retail
- 美赛数学建模算法-使用Matlab实现灰色系统建模GreySystem-国赛-题解.zip
- 基于albert-bilstm-crf架构利用keras框架实现NER
- RegexMagic V2.13.1 Retail
- python-3.6.5-macosx 安装包
- 美赛数学建模算法-使用Matlab实现图论GraphTheory-包括求最短路径-国赛-题解.zip
- RegexBuddy v4.14.1 Retail
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
评论0