static void InitWrite(uint8_t temp_wr) { lcd_u.bits.e = FALSE; lcd_u.bits.rs = FALSE; WritePortA(); WritePortB(temp_wr); _asm nop nop nop _endasm lcd_u.bits.e = TRUE; WritePortA(); _asm nop nop nop nop nop nop nop nop nop _endasm lcd_u.bits.e = FALSE; WritePortA(); }
void LCD_dwrite(uint8_t temp_wr) { //SLAVE_SLEEP_INDICATOR = 1; // XXX debug LCDBusy(); lcd_u.bits.e = FALSE; lcd_u.bits.rs = TRUE; WritePortA(); WritePortB(temp_wr); _asm nop nop nop nop _endasm lcd_u.bits.e = TRUE; WritePortA(); _asm nop nop nop nop nop nop _endasm lcd_u.bits.e = FALSE; lcd_u.bits.rs = FALSE; WritePortA(); //SLAVE_SLEEP_INDICATOR = 0; // XXX debug }
void LCDConfigWrite (BYTE byte) { WritePortA(0,0); WritePortB(byte); Nop();Nop();Nop(); WritePortA(1,0); Nop();Nop();Nop();Nop();Nop(); Nop();Nop();Nop();Nop(); WritePortA(0,0); }
void LCDDataWrite(BYTE data) { LcdBusy(); WritePortA(0,1); WritePortB(data); Nop(); Nop(); Nop(); Nop(); WritePortA(1,1); Nop(); Nop(); Nop(); Nop(); Nop(); Nop(); WritePortA(0,0); }
void LCDInit(void) { LCD_CS_TRIS = 0; // set chip select to output LCD_CS = 1; // unselect LCD LCD_RST_TRIS = 0; // Set LCD Reset to output LCD_RST = 1; // delay();delay(); delay(); SpiInit(); PortASpiInit(); PortBSpiInit(); WritePortA(0,0); delay(); LCDConfigWrite(0x3C); delay(); LCDConfigWrite(0x0C); //Display off delay(); LCDConfigWrite(0x01); //Display Clear delay(); LCDConfigWrite(0x06); //Entry Mode }
void lcd_init() { LCD_CS_DIR = OUTPUT; LCD_CS = 1; LCD_RST_DIR = OUTPUT; LCD_RST_DIR = 0; Wait(LCD_DELAY); LCD_RST_DIR = 1; /**** init port A *******/ LCD_CS = 0; SpiInOut(0x40); SpiInOut(0x00); SpiInOut(0x00); LCD_CS = 1; /**** init port A *******/ LCD_CS = 0; SpiInOut(0x40); SpiInOut(0x01); SpiInOut(0x00); LCD_CS = 1; lcd_u.bits.e = FALSE; lcd_u.bits.rs = FALSE; WritePortA(); Wait(LCD_DELAY); InitWrite(0x3c); // function set Wait(LCD_DELAY); InitWrite(0x0c); // display off Wait(LCD_DELAY); InitWrite(0x01); // display clear Wait(LCD_DELAY); InitWrite(0x06); // entry mode }