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

📄 tl0324.h

📁 西红柿的驱动
💻 H
字号:
// --------------------- Head file for tl0324.c ------------------------------

#ifndef	__TL0324__
#define	__TL0324__

// Interface Definition
#define LCD_8BIT	// 8-bit Parallel
//#define LCD_4BIT	// 4-bit Parallel
//#define LCD_4SPI	// 4-bit SPI

// --------------------------- Pins Definition ---------------------------------
#ifdef LCD_8BIT
	// 8-bit Parallel
	#define E		P3_4	// Enable R/W (High Effective)
	#define RW      P3_3	// Read/Write
	#define A0	    P3_2	// Data/Command Register Selection
	#define RST    	P3_1	// Reset (Low Effective)
	#define CS	    P3_0	// Chip Selection (Low Effective)
	#define LCD_DataPort	P1
#elif defined(LCD_4SPI)
	// 4-bit SPI
	#define SID		P3_4	// Serial Instructions and data
	#define SCK		P3_3	// Serial Clock
	#define A0		P3_2	// Data/Command Register Selection
	#define RST		P3_1	// Reset (Low Effectuve)
	#define CS		P3_0	// Chip Selection (Low Effective)
#endif
// -----------------------------------------------------------------------------

// -------------------------- Constants definition -----------------------------
#define iDat	1		// Data
#define iCmd	0		// Command

#define LCD_ON	0xAF	// Display Enable
#define LCD_OFF	0xAE	// Display Disable

#define LCD_L0	0x40	// The address of line 0
#define LCD_P0	0xB0	// The address of page 0

#define LCD_CMAX 	128	// Maximal Column of LCD
#define LCD_PMAX	4	// Maximal Page of LCD
#define LCD_LMAX	32	// Maximal Line of LCD

#define IC_CMAX		132	// Maximal Colume of IC
#define IC_PMAX		9	// Maximal Page of IC (include ICON Page)
#define IC_LMAX		65	// Maximal Line of IC

#define LCD_DATN	0xA6	// Normal Display 'H'on
#define LCD_DATR	0xA7	// Reverse Display 'L'on

#define LCD_ADC		0xA0	// Normal Segment Dir
//#define LCD_ADC		0xA1	// Reverse Segment Dir
#define LCD_SHL		0xC0	// Normal Common Dir
//#define LCD_SHL	0xC8	// Reverse Common Dir

#define LCD_ALLON	0xA5	// All Pixels on
#define LCD_BACK	0xA4	// Turn back to normal display

#define LCD_BIAS	0xA2	// LCD Bias
#define LCD_REG		0x20	// LCD Regulator Registor Ratio

#define StaRMW		0xE0	// Start Read-Modify-Write Mode
#define EndRMW		0xEE	// End Read-Modify-Write Mode

#define LCD_RST		0xE2	// LCD Software Reset
#define LCD_PWR		0x2F	// LCD Power Control

//#define LCD_ICOMAX	22		// Maximal Icons of LCD
#ifdef LCD_ICOMAX
	uint8 code ICONS[LCD_ICOMAX] = 
	{
		// Column Address of Icons
		0,3,14,22,35,47,56,93,
		102,105,110,111,112,113,117,119,
		120,122,123,125,130,131
	};
#endif

uint8 code TestData[][2] =
{
	// Standard graphics for LCD Testing
	{0xFF,0xFF},	// 1. All
	{0x00,0x00},	// 2. None	
	{0xFF,0x00},	// 3. Virtical 1
	{0x00,0xFF},	// 4. Virtical 2
	{0xAA,0xAA},	// 5. Horizontal 1
	{0x55,0x55},	// 6. Horizontal 2
	{0xAA,0x55},	// 7. Stars 2
	{0x55,0xAA},	// 8. Stars 2
};
// -----------------------------------------------------------------------------

// --------------------------- Functions Declaration ---------------------------
// Send a data or command to LCD
void SendByte(bit DatCmd, uint8 dByte);
// Set column address
void SetCA(uint8 CAddr);
// Set page address
void SetPA(uint8 PAddr);
// Read a data from LCD DDRAM
uint8 ReadData(uint8 PAddr, uint8 CAddr);
// Set LCD Contrast
void SetContrast(uint8 CValue);
#ifdef LCD_ICOMAX
	// Set LCD specific Icon ON/OFF
	void SetIcon(uint8 State, uint8 index);
	// Turn On/Off all icons
	void Allicons(bit State);
	// Display Icons and then hide them
	void ICON_Test(void);
#endif
// Initialize LCD
void LCD_Initial(void);
// Tile the LCD screen with two datas
void Tile(uint8 fst, uint8 snd);
// Clear the LCD Screen
void Clear(void);
// Display LCD Test Graphics
void LCD_Test(void);
// -----------------------------------------------------------------------------

#include "tl0324.c"

#endif

⌨️ 快捷键说明

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