TextLCD

30 Nov 2010

I've been using TextLCD with a Lumex 20x4 (Lumex part number S02004) module.  The locate() function does not work correctly for lines 3 and 4 of this display.  In particlar, locate(0,3) should go to the begoinning of the fourth line but instead goes to the same position as locate(0,0).  locate(0,2) goes to about postion 16 on line 2; it should, of course, go to the beginning of the third line.

01 Dec 2010

Hi Jim,

If you look at the "address" function within the library (assuming you've imported it, right click and choose "Edit Library"), you can see a switch which works out the address based on the different type of screen. I suspect yours has a slightly different memory map, so you should be able to add an option here to support yours.

The two methods would be to decipher the datasheet for your particular display, or some educated trial and error!

If you get it working, you can re-publish the library and i'll pull and incorporate the results.

Simon

01 Dec 2010

Hi,

 

01 Dec 2010

Hi,

 

01 Dec 2010

Hi,

 

01 Dec 2010

Hi,

Tnx for the quick response.  Pardon the almost empty prior response; I use the TAB key at the beginning of a paragraph without thinking.

I must be doing something wrong and I don't understand CPP very well.  In my previous attempts, the constructor I used had a variable list which ended

with the variables, _column and _row.  When I 'updated the library, it now expects a variable which is the LCDType.  My listing is below:



#include "mbed.h"
#include "TextLCD.h"


TextLCD lcd(p24, p25, p26, p27, p28, p29, p30, TextLCD::LCD20x4); // rs, rw, e, d0, d1, d2, d3

const char *message = "Hello there!";

int main() {

int i = 0;

while (1) {
i += 1;
i %= 4;
lcd.cls();
lcd.locate(0,i);
lcd.printf(message);
lcd.putc(' ');
lcd.putc ('0' + i);
wait_ms(500);   
}
}
I now get a compile time error in line 6.  I obviously do not know how to enter the LCDType in the variable list.

Jim

01 Dec 2010

Hi,

I think I have found the problem.  In the new library, there is no pin assigned for the R/W pin on the LCD.  For each LCD, there must be 7 pins definied, not 6.  My problem was that I was passing too many variables to the constructor.

Jim

23 Mar 2011

Hi,

Is there a way to display a variable (eg double) without using any external function? In Atmega8 it had to be done through a conversion using sprintf function. How is it here?

Regards, Martin

23 Mar 2011

Hi Marcin,

Perhaps something like printf?

float v = 1.34;
lcd.printf("value = %f", v);

Simon