?? lcdb_driver.h
字號:
/************************************************************************************
* Copyright (c), 2004-2007,西安銘朗電子科技有限責(zé)任公司
* All rights reserved.
*
* Http: www.mlarm.com
* Email: mlarm@mlarm.com
*
* File name: LCDB.C
* Project : ML-F020ICB
* Processor: C8051F020
* Compiler : Keil C51 Compiler
*
* Author: 李林利
* Version: 1.20
* Date: 2007.6.1
* Email: GavinLi@126.com
*
* Description: 本文件是以SED1335為控制器的LCD顯示驅(qū)動程序頭文件,現(xiàn)支持的液晶為240x160,320x240;
*
* Others: LCD(320x240為例)顯示屏坐標(biāo)定義圖:
* |O(0,0)
* --|----------------------------------------------------------> y 列坐標(biāo)
* | |320
* | 銘朗科技 |
* | |
* | ML-F020ICB |
* | |
* | |
* | |
* | LCD320x240 顯示屏 |
* | |
* | |
* | |
* | |
* 240 |-------------------------------------------------|(240,320)
* |
* \|/
* | x 行坐標(biāo)
*
* Function List:
* 1. void LCDB_WritePara(unsigned char *p, unsigned char len)
* 2. void LCDB_ClearScreen(void)
* 3. void LCDB_Init(unsigned char lcd_type)
* 4. unsigned char LCDB_SetGraphMaps(unsigned char id)
* 5. void LCDB_DrawPixel(unsigned int x, y, bit mode)
* 6. void LCDB_DrawLine(unsigned int x1, y1, x2, y2, bit mode)
* 7. void LCDB_DrawRectangle(unsigned int x1, y1, x2, y2, bit mode)
* 8. void LCDB_DrawFillRectangle(unsigned int x1, y1, x2, y2, bit mode)
* 9. void LCDB_DrawCircle(unsigned int x, y, r, bit mode)
* 10. void LCDB_DrawByte(unsigned int x, y, unsigned char val)
* 11. void LCDB_ShowHZxy(unsigned char x, y, unsigned char line, col, unsigned char *p);
*
* History:
* 1. Author: 李林利
* Version: 1.10
* Date: 2007.3.12
* Modification: none
*
* 2. Author: 李林利
* Version: 1.00
* Date: 2004.11.24
* Modification: 建立文件
*
*************************************************************************************/
/*************************************************************************************
* LCD顯示驅(qū)動程序函數(shù)使用說明
*
* 1. 第1步,必須調(diào)用函數(shù)LCDA_Init(),按函數(shù)說明進行設(shè)置,本函數(shù)只允許調(diào)用1次;
* 2. 第2步,如果客戶需要其它設(shè)置或修改設(shè)置可應(yīng)用LCDB_WriteCmdPara()函數(shù)進行設(shè)置,
* 命令參照SED1335數(shù)據(jù)手冊;
* 3. 第3步,調(diào)用LCDB_SetGraphMaps(),設(shè)定圖形顯示區(qū);
* 4. 第4步,可調(diào)用其它畫圖或顯示漢字的函數(shù);參照坐標(biāo)定義圖可幫助客戶理解函數(shù)參數(shù);
* 5. 其它細(xì)節(jié)詳見具體函數(shù)說明;
*
*************************************************************************************/
/************************************************************************************
// 常量及全局變量定義
*************************************************************************************/
//LCD240160常量定義
#define LCD240160 6
#define LCD240160_X 240
#define LCD240160_Y 160
#define LCD240160_LINE_CHAR 30
#define LCD240160_COLUMN_CHAR 20
//LCD320240常量定義
#define LCD320240 7
#define LCD320240_X 320
#define LCD320240_Y 240
#define LCD320240_LINE_CHAR 40
#define LCD320240_COLUMN_CHAR 30
/*define LCD code */
#define CMD_SYSSET 0x40
#define CMD_SCROLL 0x44
#define CMD_SLEEP 0x53
#define CMD_DISPON 0x59
#define CMD_DISPOFF 0x58
#define CMD_OVLAY 0x5b
#define CMD_HDOTSCR 0x5a
#define CMD_CSRFORM 0x5d
#define CMD_CGRAMADR 0x5c
#define CMD_CSRRGT 0x4c
#define CMD_CSRLFT 0x4d
#define CMD_CSRUP 0x4e
#define CMD_CSRDOWN 0x4f
#define CMD_CSRW 0x46
#define CMD_CSRR 0x47
#define CMD_MWRITE 0x42
#define CMD_MREAD 0x43
#define CMD_AP 30
/*************************************************************************************/
//
// SED1335為控制器的LCD顯示驅(qū)動程序函數(shù)外部引用聲明
//
/*************************************************************************************/
/***********************************************************************************
* Function: LCDB_WriteCmdPara;
*
* Description: 向LCD命令口寫入命令,接下來向LCD數(shù)據(jù)口寫參數(shù);
*
* Input: cmd,LCD控制命令, *para,參數(shù)指針; len,參數(shù)長度;
*
* Output: none;
*
* Return: none;
*
* Note: none;
************************************************************************************/
void LCDB_WriteCmdPara(unsigned char cmd, unsigned char *para, unsigned char len);
/***********************************************************************************
* Function: LCDB_ClearScreen;
*
* Description: LCD清屏函數(shù);
*
* Input: none;
*
* Output: none;
*
* Return: none;
*
* Note: 本函數(shù)只清除所設(shè)定的當(dāng)前顯示區(qū)即當(dāng)前屏幕顯示;
************************************************************************************/
void LCDB_ClearScreen(void);
/***********************************************************************************
* Function: LCDA_Init;
*
* Description: LCD初始化函數(shù);
*
* Input: x, LCD行數(shù); y, LCD列數(shù); 例如:320x240 的LCD, line=240,column=320;
*
* Output: none;
*
* Return: none;
*
* Note: 本函數(shù)完成的設(shè)置:1.光標(biāo)形狀(0xa7):8x8; 2顯示方式: 三屏圖形顯示,
* 以"或"方式合成;3.設(shè)置顯示開關(guān): 圖形顯示/光標(biāo)顯示(閃爍);
* 4.顯示存儲器清零; 5. 設(shè)置圖形顯示區(qū)(編號):0;
************************************************************************************/
void LCDB_Init(unsigned int x, unsigned int y);
/***********************************************************************************
* Function: LCDB_SetGraphMaps;
*
* Description: 設(shè)置圖形顯示區(qū);此函數(shù)可更換不同的圖形顯示;
*
* Input: id, 圖形顯示區(qū)編號, 范圍:0~2;
*
* Output: none;
*
* Return: TRUE,設(shè)置正確; FALSE,設(shè)置失敗;
*
* Note: none;
************************************************************************************/
unsigned char LCDB_SetGraphMaps(unsigned char id);
/***********************************************************************************
* Function: LCDB_DrawPixel;
*
* Description: 畫點(x,y);
*
* Input: x, LCD行坐標(biāo); y, LCD列坐標(biāo); bit類型標(biāo)識mode,1:畫點,0:擦除點;
*
* Output: none;
*
* Return: none;
*
* Note: none;
************************************************************************************/
void LCDB_DrawPixel(unsigned int x, y, bit mode);
/***********************************************************************************
* Function: LCDB_DrawLine;
*
* Description: (x1,y1)--(x2,y2)處劃線;
*
* Input: x1,x2, LCD行坐標(biāo); y1,y2, LCD列坐標(biāo); bit類型標(biāo)識mode,1:畫直線:擦除直線;
*
* Output: none;
*
* Return: none;
*
* Note: none;
************************************************************************************/
void LCDB_DrawLine(unsigned int x1, y1, x2, y2, bit mode);
/***********************************************************************************
* Function: LCDB_DrawRectangle;
*
* Description: 以(x1,y1)和(x2,y2)為對角點畫矩形;
*
* Input: x1,x2, LCD行坐標(biāo); y1,y2, LCD列坐標(biāo); bit類型標(biāo)識mode,1:畫矩形,0:擦除矩形;
*
* Output: none;
*
* Return: none;
*
* Note: none;
************************************************************************************/
void LCDB_DrawRectangle(unsigned int x1, y1, x2, y2, bit mode);
/***********************************************************************************
* Function: LCDB_DrawFillRectangle;
*
* Description: 以(x1,y1)和(x2,y2)為對角點畫矩形實體;
*
* Input: x1,x2, LCD行坐標(biāo); y1,y2, LCD列坐標(biāo); bit類型標(biāo)識mode,1:畫矩形實體,0:擦除矩形實體;
*
* Output: none;
*
* Return: none;
*
* Note: none;
************************************************************************************/
void LCDB_DrawFillRectangle(unsigned int x1, y1, x2, y2, bit mode);
/***********************************************************************************
* Function: LCDB_DrawCircle;
*
* Description: 以(x,y)為圓心, r為半徑畫圓;
*
* Input: x, LCD行坐標(biāo); y, LCD列坐標(biāo); bit類型標(biāo)識mode,1:畫圓,0:擦除圓;
*
* Output: none;
*
* Return: none;
*
* Note: none;
************************************************************************************/
void LCDB_DrawCircle(unsigned int x, y, r, bit mode);
/***********************************************************************************
* Function: LCDB_DrawByte;
*
* Description: 向LCD(x,y)點開始寫一個字節(jié)數(shù)據(jù);
*
* Input: x, LCD行坐標(biāo); y, LCD列坐標(biāo); value,寫入字節(jié)數(shù)據(jù);
*
* Output: none;
*
* Return: none;
*
* Note: 應(yīng)盡量使y(LCD列坐標(biāo))是8的整數(shù)倍,可使顯示速度加快;
************************************************************************************/
void LCDB_DrawByte(unsigned int x, y, unsigned char val);
/***********************************************************************************
* Function: LCDB_ShowHZxy;
*
* Description: 從LCD(x,y)點開始顯示(line*col)的字符;
*
* Input: x, LCD行坐標(biāo); y, LCD列坐標(biāo); line,字符占用行數(shù); col,字符占用列數(shù);
* *p,字符數(shù)據(jù)指針;
*
* Output: none;
*
* Return: none;
*
* Note: 應(yīng)盡量使y(LCD列坐標(biāo))是8的整數(shù)倍,可使顯示速度加快; 本函數(shù)也可作為自定義圖形顯示;
************************************************************************************/
void LCDB_ShowHZxy(unsigned int x, y, unsigned int line, col, unsigned char *p);
/***********************************************************************************
/***********************************************************************************/
// 文件結(jié)束
/***********************************************************************************/
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -