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

📄 lcdiof.h

📁 测试STN LCM产品
💻 H
字号:
// ------------------------ Header file for lcdiof.c ---------------------------
#ifndef __LCD_DATA__IO__
#define __LCD_DATA__IO__

// ------------------------ Interface Selection --------------------------------
#define LCD_READABLE		// If LCD-Reading is possible & needed, define it!
#define MCU_6800_8BIT		// 6800 MCU 8-bit Parallel
//#define MCU_6800_4BIT		// 6800 MCU 4-bit Parallel
//#define MCU_8080_8BIT		// 8080 MCU 8-bit Parallel
//#define MCU_8080_4BIT		// 8080 MCU 4-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)
	#define LCD_HPM		P3_7	// High Power Mode(1: Disable; 0: Enable)
#endif

#define LCD_DataPort	P1

// Special Pins for the specific interface
#if ((defined(MCU_6800_8BIT)) || (defined(MCU_6800_4BIT)))
	// 6800 MCU 8/4-bit Parallel
	#define LCD_CS	    	P3_0	// Chip Selection
	#define LCD_RST    		P3_1	// Reset
	#define LCD_A0	    	P3_2	// Data/Command Register Selection(LCD_RS)
	#define LCD_RW      	P3_3	// Read/Write
	#define LCD_E			P3_4	// Enable R/W	
#elif ((defined(MCU_8080_8BIT)) || (defined(MCU_8080_4BIT)))
	// 8080 MCU 8/4-bit Parallel
	#define LCD_CS	    	P3_0	// Chip Selection
	#define LCD_RST    		P3_1	// Reset
	#define LCD_A0	    	P3_2	// Data/Command Register Selection
	#define LCD_WR      	P3_3	// Read/Write
	#define LCD_RD			P3_4	// Enable R/W
#elif defined(LCD_4SPI)
	// 4-wire SPI(A-Type)	
	#define SPI_CLK			P1_6	// Serial Clock
	#define SPI_MOSI		P1_7	// Serial Instructions and data(LCD_SDIN)
	//#define SPI_MISO		P3_4	// Serial Instructions and data(LCD_SDOUT)	
	#define LCD_CS			P3_0	// Chip Selection
	#define LCD_RST			P3_1	// Reset
	#define LCD_A0			P3_2	// Data/Command Register Selection
	#include "spi.h"
#elif defined(LCD_3SPI)
	// 3-wire SPI
	#define SPI_CLK			P1_6	// Serial Clock
	#define SPI_MOSI		P1_7	// Serial Instructions and data(LCD_SDIN)
	//#define SPI_MISO		P1_7	// Serial Instructions and data(LCD_SDOUT)
	#define LCD_CS			P3_0	// Chip Selection (Low Effective)
	#define LCD_RST			P3_1	// Reset
	#include "spi.h"
#elif defined(LCD_I2C)
	// I2C Interface
	#define I2C_SDA		P3_1		// LCD SDA
	#define I2C_SCL		P3_0		// LCD SCL
	#define LCD_RST		P3_2		// LCD Reset
	#define LCD_I2C_ADDR	0x78	// Slave Address of the IC: 0111 100(R/W)
	//#define LCD_I2C_ADDR	0x7C	// Slave Address of the IC: 0111 110(R/W)
	//#define LCD_I2C_ADDR	0x7A	// Slave Address of the IC: 0111 101(R/W)
	//#define LCD_I2C_ADDR	0x7E	// Slave Address of the IC: 0111 111(R/W)
	#include "i2c.h"
#endif
// -----------------------------------------------------------------------------

// -------------------------- Constants definition -----------------------------
#define iDat	1
#define iCmd	0
// LCD_Enable/Disable Macros
#ifdef LCD_CS
	#define LCD_Enable()	{LCD_CS = 0;}
	#define LCD_Disable()	{LCD_CS = 1;}
#endif
// -----------------------------------------------------------------------------

// --------------------------- Functions Declaration ---------------------------
#ifdef __PORT_CONFIG__
	// Port configuration of MCU
	void PortConfig(void);
#endif
#ifdef LCD_RST
	// Reset LCD
	void LCD_Reset(void);
#endif
// Send a data or command to LCD
void SendByte(bit DatCmd, uint8 dByte);
#ifdef LCD_READABLE
	// Read a data from LCD DDRAM
	// Page Address & Column Address should be set at first.
	// E.G. Gotoxy(PAddr, CAddr);
	uint8 LCD_ReadData(void);
	// Send a byte overlayed with the orginal data
	void AndByte(uint8 dByte);
#endif
// Write a Byte of data to the LCD
void LCD_WriteData(uint8 dByte);
// -----------------------------------------------------------------------------

#include "lcdiof.c"
#endif

⌨️ 快捷键说明

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