Go Down

Topic: DIP 204-4 4-line-mode (Read 1 time) previous topic - next topic


Sep 16, 2011, 11:49 am Last Edit: Sep 16, 2011, 12:35 pm by _frank_ Reason: 1

after SPI-Mode does not work, i tryed with 4bit and Liquidcrystal...and i get a text-output...first thank you for the lib ;)

here the Data-Sheet of the display:

the example shows:
"hello, world!" in the first line - OK
"!" in the second line - FALSE (copy of line 1 cols >12 in line 2)
<seconds> in the 3rd line

i changed the row-offsets in LiquidCrystal.cpp see thread - same result

note that only 12 cols are accessable
col 13 [!] and following is printed also on line 2
i looked also in hardware/arduino/cores/arduino/print.cpp for the print-function (but this only uses write in a loop), and its not overwritten in LiquidCrystal.cpp/h

the library only supports 2-line-mode...
i added
#define LCD_4LINE 0x09 to LiquidCrystal.h and the following to the begin-method in the cpp:
 if (lines == 4) {
   _displayfunction = LCD_4BITMODE | LCD_4LINE;
 } else //now the (if lines >1)

now the display changes contrast (white on black,maybe "inverting cursor"), but why?
i cant still not access the 4 lines.. (2= line 3, 1=no text,3=no text)

i assume that the behaviour is because this display uses a "extended function set" to set number of lines, but i dont get it working yet (LCD_4LINE sets reversebit=inverse display)

RE-bit is set by functionset (DB2=4)

regards Frank


Sep 16, 2011, 12:59 pm Last Edit: Sep 16, 2011, 02:41 pm by _frank_ Reason: 1
successful enabled 4-line-mode:

// flags for function set
#define LCD_8BITMODE 0x10
#define LCD_4BITMODE 0x00
#define LCD_REBIT 0x04
#define LCD_2LINE 0x08
#define LCD_1LINE 0x00
#define LCD_5x10DOTS 0x04
#define LCD_5x8DOTS 0x00

//extended function set
#define LCD_4LINE 0x09


void LiquidCrystal::begin(uint8_t cols, uint8_t lines, uint8_t dotsize) {
 if (lines == 4) {
   _displayfunction |= LCD_REBIT;
 } else
 // finally, set # lines, font size, etc.
 command(LCD_FUNCTIONSET | _displayfunction);  
 if (lines==4)
   command(LCD_FUNCTIONSET | _displayfunction & !LCD_REBIT );

copy of col>12 persists no more (maybe HD44780 mode only supports 12 cols)
the cols (>=12) are also accessable by setcursor

hoping this will be added to the liquidCrystal lib in further arduino-software-versions
attached my LiquidCrystal.h/cpp based on version 0022
changes are marked by "//FW" appended by a char (a=add,d=delete,c=changed) on every changed line

some special chars are not working yet ($ like x), i try to make a conversion table (maybe charset german <> us) and charset us<>display

to get the $ on my display i have to do the following:
Code: [Select]

 char s[]="hello,world  ";

some special chars (german display):
Code: [Select]
  lcd.setCursor(0,2);//3rd line, first col
  char s2[20];
  //€ not in charset
  s2[14]=0x90;//single note
  s2[15]=0x91;//double note
  s2[16]=0xDE;//arrow up
  s2[17]=0xDF;//arrow right
  s2[18]=0xE0;//arrow down
  s2[19]=0xE1;//arrow left


Now that you have posted the solution could you provide us with a description of the problem?



the display handles not the 4-line-mode of the EA DIP204-4 (maybe other 4-line-displays).

maybe you have to add an "if" at the changed row_offsets (they may not work with other displays, i don't have another to test)

more details are in the first post...but don't use the code provided there


the display handles not the 4-line-mode of the EA DIP204-4 (maybe other 4-line-displays).

What do you mean by the 4-line mode?  Are you referring to the the 4 lines of characters on the display or are you referring to the 4 data lines connected to LCD pins 11, 12, 13, and 14?



4 lines of characters on the Display...


cause my changes are not taken to arduino 1.0, i want to ask why

Go Up