// Direct instruction functions for LCD
void LCD_Low_Level::clearDisplay() {
  
	waitUntilNotBusy();
 
	command(LCD_ClearDisplay);
	// delayMicroseconds(2000); // Must wait 1.53ms, so waiting 2ms to be safe.
}
void LCD_Low_Level::writeDataToRAM(uint8_t data) {

  waitUntilNotBusy();
  
	writeData(data);
	
	// delayMicroseconds(100); // Must wait 43us, so waiting 100us to be safe
}
void LCD_Low_Level::returnHome() {
  
	waitUntilNotBusy();
 
	command(LCD_ReturnHome);
	// delayMicroseconds(2000); // Must wait 1.53ms, so waiting 2ms to be safe.
	
}
void LCD_Low_Level::setDDRAMAddress(uint8_t DDRAM_address) {

  waitUntilNotBusy();
  
	uint8_t data = LCD_SetDDRAMAddress | (DDRAM_address & 0x7F);
	command(data);
	
	// delayMicroseconds(100); // Must wait 39us, so waiting 100us to be safe
}
uint8_t LCD_Low_Level::readDataFromRAM(void) {

  waitUntilNotBusy();
  
	uint8_t data = 0;
	data = readData(1);
	
	// delayMicroseconds(100); // Must wait 39us, so waiting 100us to be safe
	
	return data;
}
Beispiel #6
0
void lcdWriteData(Data)
{
	waitUntilNotBusy();
	RS=1
	RW=0;
	P0=dData;
	EN=1;
	delay();
	EN=0;
	RW=1;
}
Beispiel #7
0
void writeCMD(cmd)
{
	waitUntilNotBusy();
	RS=0;
	RW=0;
	P0=cmd;
	EN=1;
	delay();
	EN=0;
	RW=1;
}
void LCD_Low_Level::cursorDisplayShift(uint8_t screen_shift, uint8_t direction) {
  
	waitUntilNotBusy();
 
	uint8_t data = LCD_CursorShift;
	if (screen_shift) {
		data |= LCD_MoveDisplay;
	}
	if (direction) {
		data |= LCD_MoveRight;
	}
	command(data);
	
	// delayMicroseconds(100); // Must wait 39us, so waiting 100us to be safe
}
void LCD_Low_Level::entrySetMode(uint8_t direction, uint8_t shift_enable) {

  waitUntilNotBusy();
  
	uint8_t data = LCD_EntryModeSet;
	if (direction) {
		data |= LCD_DisplayRight;
	}
	if (shift_enable) {
		data |= LCD_CursorRight;
	}
	
	command(data);
	// delayMicroseconds(100); // Must wait 39us, so waiting 100us to be safe.
}
void LCD_Low_Level::functionSet(uint8_t data_length, uint8_t number_lines, uint8_t display_font) {
  
	waitUntilNotBusy();
 
	uint8_t data = LCD_FunctionSet;
	if (data_length) {
		data |= LCD_8BitMode;
	}
	if (number_lines) {
		data |= LCD_2Line;
	}
	if (display_font) {
		data |= LCD_5x10Dots;
	}
	command(data);
	
	// delayMicroseconds(100); // Must wait 39us, so waiting 100us to be safe
}
void LCD_Low_Level::displayControl(uint8_t display_on, uint8_t cursor_on, uint8_t blinking_on) {

  waitUntilNotBusy();
  
	uint8_t data = LCD_DisplayControl;
	if (display_on) {
		data |= LCD_DisplayOn;
	}
	if (cursor_on) {
		data |= LCD_CursorOn;
	}
	if (blinking_on) {
		data |= LCD_BlinkOn;
	}
	command(data);
	
	// delayMicroseconds(100); // Must wait 39us, so waiting 100us to be safe
}