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

📄 lcdiof.h

📁 一个测试LCD的应用程序
💻 H
字号:
// ------------------------ Header file for lcdiof.c ---------------------------
// ----------------------- Common I/O functions for LCD ------------------------
#ifndef __LCD_DATA__IO__
#define __LCD_DATA__IO__

// ------------------------ Interface Selection --------------------------------
//#define MCU_6800		// 6800 MCU 8-bit Parallel
#define MCU_8080		// 8080 MCU 8-bit Parallel
//#define LCD_4SPI		// 4-wire SPI(A-Type)(S8)
//#define LCD_3SPI		// 3-wire SPI(S9)
//#define LCD_I2C		// I2C Interface

// --------------------------- Pins Definition ---------------------------------
// Common Pins for all interface(IC Specific!)
//#define __PORT_CONFIG__
#ifdef __PORT_CONFIG__
	#define LCD_C86		P3_5	// MCU Type(1: 6800; 0: 8080)
	#define LCD_PS		P3_6	// P/S Select(1: Parallel; 0: Serial)
#endif

#define LCD_DataPort	P1

// Special Pins for the specific interface
#ifdef MCU_6800
	// 6800 MCU 8-bit Parallel
	#define LCD_CS	    	P3_3	// Chip Selection (low Effective)
	#define LCD_RST    		P3_4	// Reset (Low Effective)
	#define LCD_A0	    	P3_2	// Data/Command Register Selection
	#define LCD_RW      	P3_1	// Read/Write
	#define LCD_E			P3_0	// Enable R/W (High Effective)	
#elif defined(MCU_8080)
	// 8080 MCU 8-bit Parallel
	#define LCD_CS	    	P3_3	// Chip Selection (low Effective)
	#define LCD_RST    		P3_4	// Reset (Low Effective)
	#define LCD_A0	    	P3_2	// Data/Command Register Selection
	#define LCD_WR      	P3_1	// Read/Write
	#define LCD_RD			P3_0	// Enable R/W (High Effective)	
#elif defined(LCD_4SPI)
	// 4-wire SPI(A-Type)	
	#define SPI_SCL			P1_6	// Serial Clock
	#define SPI_SDA			P1_7	// Serial Instructions and data
	#define SPI_A0			P3_2	// Data/Command Register Selection
	#define SPI_CS			P3_0	// Chip Selection (Low Effective)
	#define LCD_RST			P3_1	// Reset (Low Effectuve)
	#include "spi.h"
#elif defined(LCD_3SPI)
	// 3-wire SPI
	#define SPI_SCL			P1_0	// Serial Clock
	#define SPI_SDA			P1_3	// Serial Instructions and data
	#define SPI_CS			P3_0	// Chip Selection (Low Effective)
	#define LCD_RST			P3_1	// Reset (Low Effectuve)
	#include "spi.h"
#elif defined(LCD_I2C)
	// I2C Interface
	#define I2C_SDA		P3_1		// LCD SDA
	#define I2C_SCL		P3_2		// LCD SCL
	#define LCD_RST		P3_0		// LCD Reset
	#define LCD_I2C_ADDR	0x78	// Slave Address of the IC: 0111 100(B)
	#include "i2c.h"
#endif
// -----------------------------------------------------------------------------

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

// --------------------------- Functions Declaration ---------------------------
#ifdef __PORT_CONFIG__
	// Port configuration of MCU
	void PortConfig(void);
#endif
// Reset LCD
void LCD_Reset(void);
// Send a data or command to LCD
void SendByte(bit DatCmd, uint8 dByte);
// -----------------------------------------------------------------------------

#include "lcdiof.c"
#endif

⌨️ 快捷键说明

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