⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lcd.h

📁 LCD320*240驱动程序
💻 H
字号:
#ifndef	__LCD__H
#define	__LCD__H

/*SED1335 320*240 LCD C语言驱动
LCD引脚定义
1、2---GND 
3---Vcc
4---Vadj
5---Vee
6---/WR
7---/RD
8---/CE
9---A0
10---NC
11---/RST
12到19 D0-D7
20--NC*/

/*  常量定义  */
#define  SYSTEM_SET  0x40
#define  SLEEP_IN    0x53

#define  DISP_ON     0x59
#define  DISP_OFF    0x58
#define  SCROLL      0x44
#define  CSRFORM     0x5D
#define  CGRAM_ADR   0x50
#define  CSRDIR1     0x4C
#define  CSRDIR2     0x4D
#define  CSRDIR3     0x4E
#define  CSRDIR4     0x4D
#define  HDOT_SCR    0x5A
#define  OVLAY       0x5B

#define  CSRW        0x46
#define  CSRR        0x47

#define  MWRITE      0x42
#define  MREAD       0x43

/* 定义LCM像素数宏 */
#define  GUI_LCM_XMAX	 320	//   定义液晶x轴的像素数 *
#define  GUI_LCM_YMAX	 240	//   定义液晶y轴的像素数 *

#define  XTAL 7372800

//定义MCU与LCD的接口
#define  DATAOUT     PORTA
#define  DATABUS     DDRA
#define  DATAIN      PINA

#define  LCD_CS_DDR      DDRC
#define  LCD_CS_PORT     PORTC
#define  LCD_CS_BIT      (1<<PC7)
#define  LCD_A0_DDR      DDRC
#define  LCD_A0_PORT     PORTC
#define  LCD_A0_BIT      (1<<PC6)
#define  LCD_RD_DDR      DDRC
#define  LCD_RD_PORT     PORTC
#define  LCD_RD_BIT      (1<<PC4)
#define  LCD_WR_DDR      DDRC
#define  LCD_WR_PORT     PORTC
#define  LCD_WR_BIT      (1<<PC5)
#define  LCD_RES_DDR     DDRC
#define  LCD_RES_PORT    PORTC
#define  LCD_RES_BIT     (1<<PC3)

#define  DATAINIT  DATABUS=0xFF
#define  CS_H      LCD_CS_PORT |= LCD_CS_BIT     //
#define  CS_L      LCD_CS_PORT &= ~LCD_CS_BIT    //
#define  A0_H      LCD_A0_PORT |= LCD_A0_BIT     //
#define  A0_L      LCD_A0_PORT &= ~LCD_A0_BIT    //
#define  RD_H      LCD_RD_PORT |= LCD_RD_BIT     //
#define  RD_L      LCD_RD_PORT &= ~LCD_RD_BIT    //读模式
#define  WR_H      LCD_WR_PORT |= LCD_WR_BIT     //
#define  WR_L      LCD_WR_PORT &= ~LCD_WR_BIT    //写模式
#define  RES_H     LCD_RES_PORT |= LCD_RES_BIT   //
#define  RES_L     LCD_RES_PORT &= ~LCD_RES_BIT  //


void LCDWriteCmd(unsigned char byte);
void LCDWriteData(unsigned char byte);
unsigned char LCDReadData(void);
void LCD_Init(void);
void ClrSCR(void);

void GotoXY(unsigned char, unsigned char);
void LCDWriteString(unsigned char addr_l,unsigned char addr_h,char *ptr);
void LCDWriteConstString(unsigned char addr_l,unsigned char addr_h,const char *ptr);
void Cursor(unsigned char cursor);
void LCDDisplay_bmp(int x,unsigned char y,unsigned char length,const unsigned char *dat);

void GClrSCR(void);
void GClrPART(int x1, int y1, int x2, int y2);
void GFullPART(int x1, int y1, int x2, int y2);
void GPix(int x, int y, unsigned char stat);
void GBox(int x1, int y1, int x2, int y2,int stat);
void TextBox(int x, int y, int length,int stat);
void GLine(int x1, int y1, int x2, int y2);

//全局变量声明
//extern const unsigned char turnf[8];

#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -