Pages: [1]   Go Down
Author Topic: serial LCD, creating custom characters  (Read 1124 times)
0 Members and 1 Guest are viewing this topic.
Breda, The Netherlands
Offline Offline
Newbie
*
Karma: 0
Posts: 9
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello everyone,

I used to use an older version of Arduino. But after the updates to version 1.0 and 1.0.1. I'm having difficulties using my serial controlled LCD. I made this topic about it: http://arduino.cc/forum/index.php/topic,118375.msg892058.html#msg892058 .
After I found http://www.arduino.cc/playground/Learning/SparkFunSerLCD .
I figured out how to use the most comon function.

But now I ran into new problems trying to create custom characters.

I have made this code to make this character. Sorry for any dutch commentary.

The serLCD came with the following instructions.


Code:
#include <SoftwareSerial.h>
#define rxPin 0
#define txPin 16
SoftwareSerial LCD = SoftwareSerial(rxPin,txPin);

const int LCDdelay = 5;

void lcdPosition(int row, int col) {
  LCD.write(0xFE);   //command flag
  LCD.write((col + row*64 + 128));    //position
  delay(LCDdelay);
}
void clearLCD(){
  LCD.write(0xFE);   //command flag
  LCD.write(0x01);   //clear command.
  delay(LCDdelay);
}
void backlightOn() {  //turns on the backlight
  LCD.write(0x7C);   //command flag for backlight stuff
  LCD.write(157);    //light level.
  delay(LCDdelay);
}
void backlightOff(){  //turns off the backlight
  LCD.write(0x7C);   //command flag for backlight stuff
  LCD.write(128);     //light level for off.
   delay(LCDdelay);
}
void serCommand(){   //a general function to call the command flag for issuing all other commands   
  LCD.write(0xFE);
}

void setup(){
digitalWrite(txPin,HIGH);
delay(LCDdelay);
pinMode(txPin,OUTPUT);
LCD.begin(9600);
delay(LCDdelay);
}



void loop()
{
  clearLCD();
  lcdPosition(1,2);
  LCD.print("SPACE INVADERS");
  lcdPosition(0,0);
//  delay(1000);
  //en dan nu; tromgeroffel
  //customcharacterdingtest
//  LCD.createChar(1, chartest); werktniet, procreate versie >1.0
 
 
//  customcharacter byte voor byte schrijven
  serCommand();
  LCD.write(64);//selecteer regel 0
  delay(LCDdelay);
  LCD.write(1); //input regel 0
  delay(LCDdelay);
  LCD.write(65);//selecteer regel 1
  delay(LCDdelay);
  LCD.write(4); //input regel 1
  delay(LCDdelay);
  LCD.write(66);//selecteer regel 2
  delay(LCDdelay);
  LCD.write(2); //input regel 2
  delay(LCDdelay);
  LCD.write(67);//selecteer regel 3
  delay(LCDdelay);
  LCD.write(31); //input regel 3
  delay(LCDdelay);
  LCD.write(68);//selecteer regel 4
  delay(LCDdelay);
  LCD.write(2); //input regel 4
  delay(LCDdelay);
  LCD.write(69);//selecteer regel 5
  delay(LCDdelay);
  LCD.write(4); //input regel 5
  delay(LCDdelay);
  LCD.write(70);//selecteer regel 6
  delay(LCDdelay);
  LCD.write(1); //input regel 6
  delay(LCDdelay);
  LCD.write(71);//selecteer regel 7
  delay(LCDdelay);
  LCD.write(1); //input regel 7
 
  lcdPosition(0,0);
  delay(LCDdelay);
  LCD.print("test");
  delay(LCDdelay);
  LCD.write(1);
  LCD.print(1);
  delay(10000);
}
I think I followed the instructions perfectly, why does my character look completly different then expected?

Any help would be very appreciated.
The function LCD.createChar(0, character) doesn't work, because liquid crystal library doesn't work with serial LCD's.
Logged

Georgia, US
Offline Offline
Jr. Member
**
Karma: 2
Posts: 84
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

What do the characters look like? Not what they're supposed to look like, but what is being shown.
I'm currently working on the Parallax LCD and my custom chars were messed up also. the bit patterns were backwards for one thing, plus I can't seem to send a nul character to the display
Code:
mySerial.write(0);
doesn't work but because the LCD only uses 5 bits to make the char; I did a
Code:
mySerial.write(32);
instead.

Winston
Logged

Breda, The Netherlands
Offline Offline
Newbie
*
Karma: 0
Posts: 9
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thx for your reply, i'm going to investigate a bit more like you said.
I gave that up in the first place, because sending 1 to line 0 and sending 1 to line 1 gave a strange result. Line 0 and 1 didn't match, they looked completely different.

Thx for the hint about sending 32 if I need a zero. I had that same problem too, that's why my arrow also has pixels on the line 0, 6 and 7
Logged

Pages: [1]   Go Up
Jump to: