Crystalfonts cfah-634 update

Here is a pic of the back of the lcd. It shows that the JPE and JPB pads have been soldered closed. Those correspond with (0 to +5v) and inverted.

jumper settings for crystalfontz cfah 634 serial lcd display

Here is the code I used to test it. I got my start by changing code from djmatic.

EDIT -> Now that I have had a little time away from the computer, I realized that the subroutines work just fine. I was trying to use them incorrectly. Here is a bit of code that reads the data from a pot (on analog in 0) and outputs it to the lcd (using what I have been calling a subroutine). It also does some neat stuff like averaging (is that called hysteresis?) and only updating the lcd when there is a change. This might seem like simple stuff the second time one does it, but the first time I thought of it, I felt pretty smart!

Oh yeah, I’m sorry this looks like such $hL1 in wordpress, but I’m working on it… Slowly…

// cheap hack to read pot data
// it uses averaging to smooth out data over time, (do they call that hysteresis?)
// to make sure it is a signifigant change.
// it only updates the display on changes to pot readings, so it looks much smoother.

int count = 0; // for looping
int delayTime = 500; // unused i think
int val = 0; // pot value
int hyst = 1; // mount of hysteresis
int oldVal = 0; // to remember previous pot value
void setup() {
Serial.print(004, BYTE); //turn off blinking cursor

void loop() {
for (count = 0; count < 10; count++) { //loops 10 times
val = val + analogRead(0); //adds the pot readings together

val = (val / 100)*1.18; // finds average of readings and scales from 0-1020 to 0-120
if (val < (oldVal - hyst)) // if variance is less than hyst
oldVal = val; //set oldVal to val
else if (val > (oldVal + hyst)) // if variance is more than hyst
oldVal = val; // set oldVal to val
else { // variance is below hyst IS THIS ELSE NEEDED
val = oldVal; // keep oldVal


void LCDBarGraph() {
Serial.print(12, BYTE); // clear lcd
Serial.print(13, BYTE); //align left
Serial.print(18, BYTE); //create bargraph
Serial.print(000, BYTE); //custom character
Serial.print(255, BYTE); //bar type
Serial.print(000, BYTE); //start column (0-19)
Serial.print(19, BYTE); //end column (0-19, must be higher than start)
Serial.print(val, BYTE); //length in pixels 0-120
Serial.print(002, BYTE); //y position (000-003)