void LCD_write_4(char byteToSend) { unsigned char sendByte = byteToSend; sendByte &= 0x0F; sendByte |= LCDCON; sendByte &= 0x7f; SPI_send(sendByte); delayMilli(); sendByte |= 0x80; SPI_send(sendByte); delayMilli(); sendByte &= 0x7F; SPI_send(sendByte); delayMilli(); }
void LCDinit() { writeCommandNibble(0x03); writeCommandNibble(0x03); writeCommandNibble(0x03); writeCommandNibble(0x02); writeCommandByte(0x28); writeCommandByte(0x0C); writeCommandByte(0x01); writeCommandByte(0x06); writeCommandByte(0x01); writeCommandByte(0x02); SPI_send(0); delayMilli(); }
void writeString(char * string) { int i = 0; LCDcon |= RS_MASK; for (i = 0; i < 8; i++) { LCD_write_8(string[i]); //send data in the string to be written delayMilli(); } }
void writeDataByte(char dataByte) { LCDCON |= RS_MASK; LCD_write_8(dataByte); delayMilli(); }
void writeCommandByte(char commandByte) { LCDCON &= ~RS_MASK; LCD_write_8(commandByte); delayMilli(); }
void writeCommandNibble(char commandNibble) { LCDCON &= ~RS_MASK; LCD_write_4(commandNibble); delayMilli(); }