Hi guys,
i'm new on Arduino and got my Mega a few days ago. Same time I bought a 8x2 LCD Display with KS0066 Controller. Since there was talked about some problems using the Crystal lib for this LCD controller I decided to write my own method to use this LCD after I've had no luck with the LiquidCrystal lib.
But still i'm getting no screen output (Vee is set up with 900 Ohm resistor so contrast shouldn't be the problem). One line is black the other one brighter (same as when using the library).I've checked the wiring a lot of times but nothing seemed wrong .Here my code, which is build up considering the KS0066 datasheet (http: // pdf1.alldatasheet.com / datasheet-pdf/view/37318/SAMSUNG/ KS0066.html): (I always tried 4-Bit Mode)
//lcd defines
int E=30;
int RS=32;
int RW=31;
int DB4=25;
int DB5=24;
int DB6=23;
int DB7=22;
void setup() {
lcdsetup();
lcdsetcursor(0,0,0,0,0,0,0);
lcdwrite0();
}
void loop() {
// set the cursor to column 0, line 1
// (note: line 1 is the second row, since counting begins with 0):
//lcd.setCursor(0, 1);
// print the number of seconds since reset:
//lcd.print(millis()/1000);
}
void lcdsetup() {//connection routine
pinMode(13,OUTPUT);
pinMode(E,OUTPUT);
pinMode(RS,OUTPUT);
pinMode(RW,OUTPUT);
pinMode(DB4,OUTPUT);
pinMode(DB5,OUTPUT);
pinMode(DB6,OUTPUT);
pinMode(DB7,OUTPUT);
delay(40);
lcdbitsend(0,0,0,0,1,0);
lcdbitsend(0,0,0,0,1,0);
lcdbitsend(0,0,0,1,0,0);
delay(4);
lcdbitsend(0,0,0,0,0,0);
lcdbitsend(0,0,1,1,1,1);
delay(4);
lcdbitsend(0,0,0,0,0,0);
lcdbitsend(0,0,0,0,0,1);
delay(4);
lcdbitsend(0,0,0,0,0,0);
lcdbitsend(0,0,0,1,1,1);
delay(4);
}
void lcdbitsend(boolean lcdrs, boolean lcdrw,boolean lcddb7,boolean lcddb6,boolean lcddb5, boolean lcddb4){
digitalWrite(E,HIGH);
digitalWrite(RS,lcdrs);
digitalWrite(RW,lcdrw);
digitalWrite(DB7,lcddb7);
digitalWrite(DB6,lcddb6);
digitalWrite(DB5,lcddb5);
digitalWrite(DB4,lcddb4);
delay(2);
digitalWrite(E,LOW);
delay(10);
}
void lcdsetcursor(boolean d6, boolean d5, boolean d4, boolean d3, boolean d2 ,boolean d1, boolean d0){
lcdbitsend(0,0,1,d6,d5,d4);
lcdbitsend(0,0,d3,d2,d1,d0);
}
void lcdwrite0(){//write 0 character in DDRAM
lcdbitsend(1,0,0,0,1,0);
lcdbitsend(1,0,0,0,0,1);
}
This should print one '0' to the screen but it's doing nothing.
could it be that my NEW Lcd is broken or what is going wrong? No working with this, nothing different with the library. I'm in a lack of ideas.
Please help,
thanks a lot,
Nitro :![]()