#define LCD_CTRL PORTD 论文网http://www.751com.cn/
#define LCD_CTRL_DDR DDRD
#define LCD_RS PD2
#define LCD_WR PD3
#define LCD_RD PD4
#define LCD_CS PD0
#define LCD_REST PD1
#define RS_0 (LCD_CTRL &= ~(1 << LCD_RS))
#define RS_1 (LCD_CTRL |= (1 << LCD_RS))
#define WR_0 (LCD_CTRL &= ~(1 << LCD_WR))
#define WR_1 (LCD_CTRL |= (1 << LCD_WR))
#define RD_0 (LCD_CTRL &= ~(1 << LCD_RD))
#define RD_1 (LCD_CTRL |= (1 << LCD_RD))
#define CS_0 (LCD_CTRL &= ~(1 << LCD_CS))
#define CS_1 (LCD_CTRL |= (1 << LCD_CS))
#define REST_0 (LCD_CTRL &= ~(1 << LCD_REST))
#define REST_1 (LCD_CTRL |= (1 << LCD_REST))
#define Key_Pin_Port DDRB
根据上面时序图的说明很容易得到如下基本操作彩屏函数
1 写总线命令操作函数如下:
void LCD_WrCmd(U16 cmd)
{
CS_0;
RS_0;
LCD_DataPORT_H =(cmd>>8); //写高8位
WR_0;
WR_1;
LCD_DataPORT_L =(cmd&0xff); //写低8位
WR_0;
WR_1;论文网http://www.751com.cn/
CS_1;
}
2 写总线数据操作函数为:
void LCD_WrDat(U16 dat)
{
CS_0;
RS_1;
LCD_DataPORT_H =(dat>>8); //写高8位
WR_0;
WR_1;原文请加辣;文^论,文'网QQ752018766
LCD_DataPORT_L=(dat&0xff); //写低8位
WR_0;
WR_1;
CS_1;
}
3 对彩屏区域操作:由于彩屏说涉及的显存很大,在内部可以设置一定的区域,每次操作彩屏的时候就只针对该区域读写即可,通过一定的扫描方向可以很快响应所要操作的区域。
void LCD_SetWindows(U16 HSA, U16 VSA,U16 HEA, U16 VEA)
上一页 [1] [2] [3] [4] [5] [6] [7] 下一页