//***********************************
//填充液晶DDRAM全为空格
//**********************************
void clrram_lcd(void)
{ uint16_t data;
data=0x30;
wr_i_lcd(data);
shortdelay(3);
data=0x01;
wr_i_lcd(data);
longdelay(2);
}
//***********************************
//对液晶写数据
//content为要写入的数据
//***********************************
void wr_d_lcd(uint8_t content)
{
busy_lcd();
DrvGPIO_Open(E_PORT2, E_PIN0, E_IO_OUTPUT);
DrvGPIO_Open(E_PORT2, E_PIN1, E_IO_OUTPUT);
DrvGPIO_Open(E_PORT2, E_PIN2, E_IO_OUTPUT);
DrvGPIO_SetBit(E_PORT2, E_PIN0); //rs=1,data mode
DrvGPIO_ClrBit(E_PORT2, E_PIN1); //rw=0,write mode
DrvGPIO_Open(E_PORT0, E_PIN0, E_IO_OUTPUT);
DrvGPIO_Open(E_PORT0, E_PIN1, E_IO_OUTPUT);
DrvGPIO_Open(E_PORT0, E_PIN2, E_IO_OUTPUT);
DrvGPIO_Open(E_PORT0, E_PIN3, E_IO_OUTPUT);
DrvGPIO_Open(E_PORT0, E_PIN4, E_IO_OUTPUT);
DrvGPIO_Open(E_PORT0, E_PIN5, E_IO_OUTPUT);
DrvGPIO_Open(E_PORT0, E_PIN6, E_IO_OUTPUT);
DrvGPIO_Open(E_PORT0, E_PIN7, E_IO_OUTPUT);
DrvGPIO_SetPortBits(E_PORT0,content); //write data
DrvGPIO_SetBit(E_PORT2, E_PIN2); //enable
shortdelay(2);
DrvGPIO_ClrBit(E_PORT2, E_PIN2); //disable
}
//********************************
//对液晶写指令
//content为要写入的指令代码
//*****************************
void wr_i_lcd(uint8_t content)
{
busy_lcd();
DrvGPIO_Open(E_PORT2, E_PIN0, E_IO_OUTPUT);
DrvGPIO_Open(E_PORT2, E_PIN1, E_IO_OUTPUT);
DrvGPIO_Open(E_PORT2, E_PIN2, E_IO_OUTPUT);
DrvGPIO_ClrBit(E_PORT2, E_PIN0); //rs=0,command mode
DrvGPIO_ClrBit(E_PORT2, E_PIN1); //rw=0,write mode
DrvGPIO_Open(E_PORT0, E_PIN0, E_IO_OUTPUT);
DrvGPIO_Open(E_PORT0, E_PIN1, E_IO_OUTPUT);
DrvGPIO_Open(E_PORT0, E_PIN2, E_IO_OUTPUT);
DrvGPIO_Open(E_PORT0, E_PIN3, E_IO_OUTPUT);
DrvGPIO_Open(E_PORT0, E_PIN4, E_IO_OUTPUT);
DrvGPIO_Open(E_PORT0, E_PIN5, E_IO_OUTPUT);
DrvGPIO_Open(E_PORT0, E_PIN6, E_IO_OUTPUT);
DrvGPIO_Open(E_PORT0, E_PIN7, E_IO_OUTPUT);
DrvGPIO_SetPortBits(E_PORT0,content); //write command
DrvGPIO_SetBit(E_PORT2, E_PIN2); //enable
shortdelay(2);
DrvGPIO_ClrBit(E_PORT2, E_PIN2); //disable
}