LCD display

Dependents:   LAB05_Oppgave4

Fork of LCDLib by Rune Langoy

Revision:
8:b12188ddd403
Parent:
5:d9eb6ed84a06
Child:
9:9529e943259c
--- a/TextLCD.cpp	Sun Sep 20 14:14:36 2015 +0000
+++ b/TextLCD.cpp	Sun Sep 20 15:55:57 2015 +0000
@@ -12,10 +12,9 @@
 
 
 TextLCD::TextLCD(PinName rs,PinName rw, PinName e, PinName d4, PinName d5,
-                 PinName d6, PinName d7) : LCD_RS(rs),LCD_RW(rw),
-    LCD_EN(e), LCD_D4(d4), LCD_D5(d5), LCD_D6(d6), LCD_D7(d7)
+                 PinName d6, PinName d7) : LCD_RS(rs),LCD_RW(rw), LCD_EN(e),
+    LCD_D4to7(d4,d5,d6,d7)
 {
-
     CLEAR_RW();
     wait_ms(50);  // Wait for disp to turn on
 
@@ -31,16 +30,14 @@
     lcdComand(0x28);//(0b0010 1000);   // 4- bit mode   LCD 2 line 16x2 Matrix
     wait_us(100);
 
-    lcdComand(0xE);//(0b0000 1110);    // Hva gjør vi her ?
+    lcdComand(0xE);//(0b0000 1110);
     wait_us(100);
-    lcdComand(0x01); //(0b00000001); //Hva gjør vi her ?
+    lcdComand(0x01); //(0b00000001);
     wait_us(100);
-    lcdComand(0x06);//(0b00000110);  //Hva gjør vi her ?
+    lcdComand(0x06);//(0b00000110);
     wait_us(100);
-
 }
 
-
 // Causes the LCD-module to read the data on the data input pins
 void TextLCD::pulseEn()
 {
@@ -52,14 +49,7 @@
 //Writes the low lible of data to the LCD-module data pins D4 to D7
 void TextLCD::writeLcdBitD4toD7(char data)
 {
-    if ( ( data >> 3) & 0x01) LCD_D7=1;
-    else  LCD_D7=0;
-    if ( ( data >> 2) & 0x01) LCD_D6=1;
-    else  LCD_D6=0;
-    if ( ( data >> 1) & 0x01) LCD_D5=1;
-    else  LCD_D5=0;
-    if (  data  & 0x01)  LCD_D4=1;
-    else  LCD_D4=0;
+    LCD_D4to7=data;
 }
 
 //Enable 4 bit mode  From KS0066U Documentation