void SendLCD(UCHAR command, UCHAR data1) { /* Wait for the busy flag to clear */ LCD_busy(); /* Set RW low, RS high, CS low to write the instruction command */ LCD_rw = 0; LCD_rs = 1; LCD_cs = 0; LCD_data = swap(command); LCD_busy(); lcd_strobe_enable(); LCD_busy(); /* Set RW low, RS low to write the instruction data */ LCD_rw = 0; LCD_rs = 0; LCD_data = swap(data1); LCD_busy(); lcd_strobe_enable(); LCD_busy(); }
void lcd_strobe_enable(void) { LCD_en = 1; LCD_busy();; LCD_en = 0; LCD_busy();; }
void LCD_command(unsigned char var, UCHAR inIsData) { // inIsData - low instraction - High Data unsigned char i; LCD_rw = 1; //LCD_data = var; //Function set: 2 Line, 8-bit, 5x7 dots LCD_data = swap(var); LCD_rs = 0; //Selected command register if (inIsData == 1) { LCD_rs = 1; //Selected command register } LCD_rw = 0; //We are writing in instruction register LCD_cs = 0; for(i=0;i<250;i++); LCD_en = 1; for(i=0;i<250;i++); LCD_en = 0; LCD_busy(); LCD_rs = 1; //Selected command register if (inIsData == 1) { LCD_rs = 0; //Selected command register } LCD_rw = 1; LCD_cs = 1; }
void lcd_cmd (char cmd) { LCD_data_port = cmd; LCD_port_EN |= LCD_EN; LCD_port_EN &= ~LCD_EN; LCD_busy(); }
// Function to display single Character void lcd_data (unsigned char dat) { LCD_port_RS |= LCD_RS; /* Data register */ LCD_data_port =dat; /* set data */ LCD_port_EN |= LCD_EN; /* Starts data */ LCD_port_EN &= ~LCD_EN; LCD_port_RS &= ~LCD_RS; /* instruction register */ LCD_busy(); }
//* LCD Display Character void cprint(char dval){ LCD_busy(); // wait for busy to clear LCD_DAT = dval; // ouptut data }
void LCD_Command(unsigned char cval){ //unsigned char cval; LCD_busy(); // wait for busy to clear LCD_CMD = cval; // ouptut command }