I have been trying to program custom characters on a Parallax serial LCD with the Arduino. I have the LCD working, but it does not fully work with the custom characters. You setup custom characters by sending the display 8 bytes of display data that corresponds to the pixels on each 5x8 pixel character area. only the first 5 bits of each byte is kept, so you do not actually need the last three bits. Please see my code for a better explanation. The problem is that when I try to make a 5x8 character area solid black by filling the 8 bytes entirely with 1's, the display only shows three columns of pixels on the right side of the character area. I need to fix this or I cannot make custom characters. The display does this at random times, and not only when I send all 1's.
Here are pictures of the problem: http://xlabs.eng.usf.edu/index.php/forum/13-microcontrollers-/30-problem-with-parallax-lcd
Here is my code:
//Parallax 2x16 Serial LCD
#include <NewSoftSerial.h>
NewSoftSerial mySerial (2, 3); //LCD RX is connected to pin 2
void setup() {
mySerial.begin(9600);
pinMode(1, OUTPUT);
delay(10);
mySerial.print(17, BYTE); //Turns Backlight ON
delay(10);
}
void loop() {
mySerial.print(12, BYTE); //Clears Display
delay(10);
mySerial.print("Hello CoytHV"); //Hello CoytHV
mySerial.print(142, BYTE); //Move cursor to line 0, position 14
Character1(); //Display Custom Character
delay(5000);
}
void Character1() { //This custom character works
delay(10);
mySerial.print(252, BYTE); //Define Custom Character 4
mySerial.print(11101, BYTE); //8 byte display data follows
mySerial.print(11101, BYTE);
mySerial.print(11101, BYTE);
mySerial.print(11101, BYTE);
mySerial.print(11101, BYTE);
mySerial.print(11101, BYTE);
mySerial.print(11101, BYTE);
mySerial.print(11101, BYTE);
mySerial.print(4, BYTE); //Display custom character 4
}
//THis custom character does not work, and defaults to 3 coulmns of pixels on the right.
// mySerial.print(11111, BYTE); //8 byte display data follows
// mySerial.print(11111, BYTE);
// mySerial.print(11111, BYTE);
// mySerial.print(11111, BYTE);
// mySerial.print(11111, BYTE);
// mySerial.print(11111, BYTE);
// mySerial.print(11111, BYTE);
// mySerial.print(11111, BYTE);
Any ideas?