📄 lcda.h
字号:
/************************************************************************************
* Copyright (c), 2004-2007,西安铭朗电子科技有限责任公司
* All rights reserved.
*
* Http: www.mlarm.com
* Email: mlarm@mlarm.com
*
* File name: LCDA.h
* Project : ML-F020ICB
* Processor: C8051F020
* Compiler : Keil C51 Compiler
*
* Author: 李林利
* Version: 1.20
* Date: 2007.6.1
* Email: GavinLi@126.com
*
* Description: 本文件是以T6963为控制器的LCD显示驱动程序头文件,现支持的液晶为128x64,160x128,
* 240x64,240x128;
*
* Others: LCD(240x128为例)显示屏坐标图:
* |O(0,0)
* --|----------------------------------------------------------> y 列坐标
* | |240
* | |
* | 铭朗科技 |
* | |
* | ML-F020ICB |
* | |
* | |
* | LCD240x128 显示屏 |
* | |
* | |
* | |
* | |
* 128 |-------------------------------------------------|(128,240)
* |
* \|/
* | x 行坐标
*
* Function List:
* 1. void LCDA_WriteData(unsigned char val)
* 2. unsigned char LCDA_ReadData(void)
* 3. unsigned char LCDA_ReadStatus(void)
* 4. void LCDA_WriteCmd1(unsigned char cmd)
* 5. void LCDA_WriteCmd2(unsigned char val, unsigned char cmd)
* 6. void LCDA_WriteCmd3(unsigned char val1, unsigned char val2, unsigned char cmd)
* 7. void LCDA_ClearScreen(void)
* 8. void LCDA_ClearTextScreen(void)
* 9. void LCDA_Init(unsigned char lcd_type)
* 10. unsigned char LCDA_SetTextMaps(unsigned char id)
* 11. unsigned char LCDA_SetGraphMaps(unsigned char id)
* 12. void LCDA_DrawPixel(unsigned char x, y, bit mode)
* 13. void LCDA_DrawLine(unsigned char x1, y1, x2, y2, bit mode)
* 14. void LCDA_DrawRectangle(unsigned char x1, y1, x2, y2, bit mode)
* 15. void LCDA_DrawFillRectangle(unsigned char x1, y1, x2, y2, bit mode)
* 16. void LCDA_DrawCircle(unsigned char x, y, r, bit mode)
* 17. void LCDA_DrawByte(unsigned char x, y, unsigned char val)
* 18. void LCDA_ShowHZxy(unsigned char x, y, unsigned char line, col, unsigned char *p)
* 19. void LCDA_ShowChar(unsigned char x, y, unsigned char *p, unsigned char len)
*
* History:
* 1. Author: 李林利
* Version: 1.10
* Date: 2007.3.12
* Modification: none
*
* 2. Author: 李林利
* Version: 1.00
* Date: 2004.11.24
* Modification: 建立文件
*
*************************************************************************************/
/*************************************************************************************
* LCD显示驱动程序函数使用说明
*
* 1. 第1步,必须调用函数LCDA_Init(),按函数说明进行设置,本函数只允许调用1次;
* 2. 第2步,如果客户需要其它设置或修改设置可应用LCDA_WriteCmd1(),LCDA_WriteCmd1(),
* LCDA_WriteCmd1()和其它函数进行设置,具体命令参照T6963数据手册;
* 3. 第3步,调用LCDB_SetGraphMaps()和LCDB_SetTextMaps(),设定图形/字符显示区;
* 4. 第4步,可调用其它画图或显示汉字的函数;参照坐标定义图可帮助客户理解函数参数;
* 4. 其它细节详见具体函数说明;
*
*************************************************************************************/
/************************************************************************************
// 常量及全局变量定义
*************************************************************************************/
/*
//LCD12864常量定义
#define LCD12864 2
#define LCD12864_X 64
#define LCD12864_Y 128
#define LCD12864_LINE_CHAR 16
#define LCD24064_COLUMN_CHAR 8
//LCD160128常量定义
#define LCD160128 3
#define LCD160128_X 128
#define LCD160128_Y 160
#define LCD160128_LINE_CHAR 20
#define LCD24064_COLUMN_CHAR 16
//LCD24064常量定义
#define LCD24064 4
#define LCD24064_X 64
#define LCD24064_Y 240
#define LCD24064_LINE_CHAR 30
#define LCD24064_COLUMN_CHAR 8
//LCD240128常量定义
#define LCD240128 5
#define LCD240128_X 128
#define LCD240128_Y 240
#define LCD240128_LINE_CHAR 30
#define LCD240128_COLUMN_CHAR 16
*/
//字体定义, 不可修改
#define FS5x8 5 // 5x8 字体
#define FS6x8 6 // 6x8 字体
#define FS7x8 7 // 7x8 字体
#define FS8x8 8 // 8x8 字体
// T6963 常用用命令定义
#define CMD_XY_POINT 0x21
#define CMD_CGRAM_ADDR 0x22
#define CMD_ADDR_POINT 0x24
#define CMD_TEXT_ADDR 0x40
#define CMD_TEXT_WIDTH 0x41
#define CMD_PIC_ADDR 0x42
#define CMD_PIC_WIDTH 0x43
#define CMD_ROM_OR_MODE 0x80
#define CMD_ROM_XOR_MODE 0x81
#define CMD_ROM_AND_MODE 0x82
#define CMD_ROM_TEXT_MODE 0x83
#define CMD_RAM_OR_MODE 0x88
#define CMD_RAM_XOR_MODE 0x89
#define CMD_RAM_AND_MODE 0x8A
#define CMD_RAM_TEXT_MODE 0x8B
#define CMD_DISP_OFF_MOD 0x90
#define CMD_RAM_XOR_MODE 0x89
#define CMD_RAM_AND_MODE 0x8A
#define CMD_RAM_TEXT_MODE 0x8B
#define CMD_CGRAM_AUTO_WRITE 0xB0 // 自动写设置
#define CMD_CGRAM_AUTO_READ 0xB1 // 自动读设置
#define CMD_CGRAM_AUTO_END 0xB2 // 自动读/写结束
#define CMD_DATA_WRITE_UP 0xC0 // 数据写,地址加1
#define CMD_DATA_READ_UP 0xC1 // 数据读,地址加1
#define CMD_DATA_WRITE_DOWN 0xC2 // 数据写,地址减1
#define CMD_DATA_READ_DOWN 0xC3 // 数据读,地址减1
#define CMD_DATA_WRITE_UN 0xC4 // 数据写,地址不变
#define CMD_DATA_READ_UN 0xC5 // 数据读,地址不变
#define CMD_BIT_CLR 0xF0 // 将显示缓冲区某单元的某一位清零
#define CMD_BIT_SET 0xF8 // 将显示缓冲区某单元的某一位置1
/*************************************************************************************/
//
// T6963为控制器的LCD显示驱动程序函数外部引用声明
//
/*************************************************************************************/
/***********************************************************************************
* Function: LCDA_WriteData;
*
* Description: 向LCD数据口写数据;
*
* Input: val,要写的数据;
*
* Output: none;
*
* Return: none;
*
* Note: none;
************************************************************************************/
void LCDA_WriteData(unsigned char val);
/***********************************************************************************
* Function: LCDA_ReadData;
*
* Description: 从LCD数据口读数据;
*
* Input: none;
*
* Output: none;
*
* Return: 读到的数据;
*
* Note: none;
************************************************************************************/
unsigned char LCDA_ReadData(void);
/***********************************************************************************
* Function: LCDA_ReadStatus;
*
* Description: 读取LCD状态;
*
* Input: none;
*
* Output: none;
*
* Return: 返回LCD状态数据;
*
* Note: none;
************************************************************************************/
unsigned char LCDA_ReadStatus(void);
/***********************************************************************************
* Function: LCDA_WriteCmd1;
*
* Description: 向LCD写有1个参数命令;
*
* Input: cmd,LCD操作命令;
*
* Output: none;
*
* Return: none;
*
* Note: none;
************************************************************************************/
void LCDA_WriteCmd1(unsigned char cmd);
/***********************************************************************************
* Function: LCDA_WriteCmd2;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -