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

📄 lcdiof.c

📁 一个测试LCD的应用程序
💻 C
字号:
// ------------------ The Basic I/O functions for LCD --------------------------

#ifdef __PORT_CONFIG__
	// Port configuration of MCU
	void PortConfig(void)
	{
		#if defined(MCU_6800)
			LCD_PS = 1;
			LCD_C86 = 1;
		#elif defined(MCU_8080)
			LCD_PS = 1;
			LCD_C86 = 0;
		#elif defined(LCD_4SPI)
			P3 = 0xFF;
			LCD_DataPort = 0xFF;
			LCD_PS = 0;
			LCD_C86 = 0;
		#elif defined(LCD_3SPI)
			P3 = 0xFF;
			LCD_DataPort = 0xFF;
			LCD_PS = 0;
			LCD_C86 = 1;
		#endif
	}
#endif

// Function for sending a byte to LCD
void SendByte(bit DatCmd, uint8 dByte)
{
	#ifdef MCU_6800
		LCD_DataPort = 0x00;	// Set the port as Output
		LCD_A0 = DatCmd;
		LCD_CS = 0;
		LCD_RW = 0;
		LCD_E = 1;
		LCD_DataPort = dByte;
		//DelayUs(4);
		LCD_E = 0;
		LCD_RW = 1;
		LCD_CS = 1;
		LCD_DataPort = 0xFF;
	#elif defined(MCU_8080)
		LCD_DataPort = 0x00;	// Set the port as Output
		LCD_A0 = DatCmd;
		LCD_CS = 0;		
		LCD_RD = 1;
		LCD_WR = 0;
		LCD_DataPort = dByte;
		//DelayUs(4);
		LCD_WR = 1;
		LCD_CS = 1;
		LCD_DataPort = 0xFF;
	#elif defined(LCD_4SPI)
		SPI_A0 = DatCmd;
		SPI_CS = 0;
		spi_sendbyte(dByte);
		SPI_CS = 1;
	#elif defined(LCD_3SPI)
		SPI_CS = 0;
		SPI_SCL = 0;
		SPI_SDA = DatCmd;		// Sendout LCD_A0
		SPI_SCL = 1;
		spi_sendbyte(dByte);
		SPI_CS = 1;
	#endif
}

⌨️ 快捷键说明

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