lcdiof.c
来自「一个测试LCD的应用程序」· C语言 代码 · 共 67 行
C
67 行
// ------------------ 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 + =
减小字号Ctrl + -
显示快捷键?