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

📄 pcf2119.h

📁 应用于测试LCD driver
💻 H
字号:
// ------------------------- Header file for pcf2113.c -------------------------

#ifndef __PCF2113__
#define __PCF2113__

#define LCD_FUNCTION_SET		(0x20 + 0x14)	// LCD Mode
	// D4: DL(Data Length) 0: 4bit, 1: 8bit
	// D3: Keep 0
	// D2: M(No impact if SL = 1) 0: 1*24, 1: 2*12
	// D1: SL(MUX) 0: 1:18(2*12 or 1*24 chars), 1: 1:9(1*12 chars)
	// D0: H(Extended function Enable) 0: Disable, 1: Enable
// -----------------------------------------------------------------------------

// ---------------------- Constant Definition ----------------------------------
#define LCD_HOME	0x02		// LCD Return home
#define LCD_C2L		0x10		// Move Cursor to the left
#define LCD_C2R		0x14		// Move Cursor to the right
#define LCD_D2L		0x18		// Move display to the left
#define LCD_D2R		0x1C		// Move display to the right

#define LCD_ON		0x0C		// Turn on LCD and Cursor
#define LCD_OFF		0x08		// Turn off LCD

#define LCD_CGRAM_ADDR	0x40	// Start address of LCD CGRAM
#define LCD_CGMAX 	128			// Max CGRAM bytes

#define LCD_COL 	16
#define LCD_ROW 	2
#define LCD_CHAR	(LCD_COL*LCD_ROW)

// Line Address of 1604
#define LCD_L1		0x80
#define LCD_L2		0xC0
//#define LCD_L3		0x90
//#define LCD_L4		0xD0
/*
// Line Address of 2004
#define LCD_L1		0x80
#define LCD_L2		0xC0
//#define LCD_L3		0x94
//#define LCD_L4		0xD4
*/
uint8 code CGRAM[LCD_CGMAX] =
{
	// Make eight patterns of 8*5 font
	0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,		// 1.Dsiplay All
	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,		// 2.White Board
	0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,		// 3.Virtical 1
	0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,		// 4.Virtical 2
	0xFF,0x00,0xFF,0x00,0xFF,0x00,0xFF,0x00,		// 5.Horizon 1
	0x00,0xFF,0x00,0xFF,0x00,0xFF,0x00,0xFF,		// 6.Horizon 2	
	0x55,0xAA,0x55,0xAA,0x55,0xAA,0x55,0xAA,		// 7.Stars
	0xFF,0x11,0x11,0x11,0x11,0x11,0x11,0xFF,		// 8.Rectangle
	
	0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,		// 1.Dsiplay All
	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,		// 2.White Board
	0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,		// 3.Virtical 1
	0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,		// 4.Virtical 2
	0xFF,0x00,0xFF,0x00,0xFF,0x00,0xFF,0x00,		// 5.Horizon 1
	0x00,0xFF,0x00,0xFF,0x00,0xFF,0x00,0xFF,		// 6.Horizon 2	
	0x55,0xAA,0x55,0xAA,0x55,0xAA,0x55,0xAA,		// 7.Stars
	0xFF,0x11,0x11,0x11,0x11,0x11,0x11,0xFF,		// 8.Rectangle
};
// -----------------------------------------------------------------------------

// --------------------------- Function Prototypes -----------------------------
// Write a string to LCD
void SendStr(uint8 code *ptString);
// Move Cursor or display
void Move(uint8 dir);
// Goto specific location
void Gotoxy(uint8 Row, uint8 Col);
// Clear LCD Screen
void LCD_CLS(void);
// Wait some time and clear screen
void wait_and_clear(void);
// Fill CGRAM with array CGRAM[]
void FillCGRAM(void);
// Show all patterns in CGRAM
void ShowCGRAM(void);
// Tile screen with one data
void Tile(uint8 tData);
// Show the built-in Charactors
void CallBultinChar(void);
// LCD initialization procedure
void LCD_Init(void);
// -----------------------------------------------------------------------------
#include "pcf2119.c"
#endif

⌨️ 快捷键说明

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