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

📄 s6a0074.h

📁 应用LCD测试
💻 H
字号:
// ------------------------ Head file for s6a0074.c ----------------------------
#ifndef __S6A0074__
#define __S6A0074__

// Connect IE to High '1'
// --------------------------- Interface Definition ----------------------------
#define LCD_RW			P3_0
#define LCD_RS	       	P3_1
#define LCD_E	       	P3_2
#define LCD_DataPort	P1

//#define LCD_8BIT
#define LCD_4BIT
// -----------------------------------------------------------------------------

// ------------------------ Constants Definition -------------------------------
#define iDat	1
#define iCmd	0

#define LCD_HOME	0x02		// LCD Return home
#define LCD_ENTRY 	0x06		// Set LCD Entry Mode
//								   display don't shift,cursor increase
#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	// LCD CGRAM Address as (00 0000)B
#define LCD_CGMAX 	64			// Max CGRAM

#define LCD_L1		0x80		// The start address of LCD Line 1
#define LCD_L2		0x90		// The start address of LCD Line 2

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

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
};
// -----------------------------------------------------------------------------

// --------------------------- Function Prototypes -----------------------------
// Write Data or Command to LCD
void SendByte(bit DatCmd, uint8 dByte);
// Read a byte from DDRAM/CGRAM/SEGRAM
uint8 ReadByte(void);
// Move Cursor or display
void Move(uint8 dir);
// Goto Y char of X Line
void Gotoxy(uint8 Row, uint8 Col);
// Write a string to LCD
void SendStr(uint8 code *ptString);
// Fill CGRAM with array CGRAM[]
void FillCGRAM(void);
// Show all patterns in CGRAM
void ShowCGRAM(void);
// Turn ON/OFF the specific ICONs
void SetICON(uint8 SAddr, uint8 State);
// Call built-in Charactors
void CallBuiltinChar(void);
// Clear LCD Screen
void LCD_CLS(void);
// Wait some time then clear the screen
void WAC(void);
// LCD initialization procedure
void LCD_Initial(void);
// -----------------------------------------------------------------------------

#include "s6a0074.c"
#endif
// -----------------------------------------------------------------------------

⌨️ 快捷键说明

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