New DOGM204 Not working on Arduino

Hi
Trying to use this display,

but as i just try to use same code as when i used this display

Nothing happens no char on the display. :frowning:
And as you can understand i not really understanding what happens in the code :frowning:

Any one had succes width this display and Arduino. ? or know what command to send ?

This code Works fine width the DIP204-4 (Running 4 bit mode)

  //put the LCD into 4 bit or 8 bit mode
  if (! (_displayfunction & LCD_8BITMODE)) {
    // this is according to the hitachi HD44780 datasheet
    // figure 24, pg 46
 
    // we start in 8bit mode, try to set 4 bit mode
    write4bits(0x03);
    delayMicroseconds(4500); // wait min 4.1ms
 
    // second try
    write4bits(0x03);
    delayMicroseconds(4500); // wait min 4.1ms
   
    // third go!
    write4bits(0x03);
    delayMicroseconds(150);
 
    // finally, set to 8-bit interface
    write4bits(0x02);
 
    command(0x09); //ext. Function set 4-line display
 
  } else {
    // this is according to the hitachi HD44780 datasheet
    // page 45 figure 23
 
    // Send function set command sequence
    command(LCD_FUNCTIONSET | _displayfunction);
    delayMicroseconds(4500);  // wait more than 4.1ms
 
    // second try
    command(LCD_FUNCTIONSET | _displayfunction);
    delayMicroseconds(150);
                 // third go
    command(LCD_FUNCTIONSET | _displayfunction);
  }

FYI, if you want to post code you might want to use the "#" CODE button (just to the left of the QUOTE button).
If you want to redo it you can click on the MODIFY button, highlight the code , and then click on the "#" CODE
button and it will create a scrolling window to scroll through the code.
Robert

Well tryed many things,
Now i have something on the display. but in reverse

Now try to initialyse like this, but still not working, perfect wery unstable when power on, i have to power off at least to get display like this, if to fast nothing is displayed.

//put the LCD into 4 bit or 8 bit mode
  if (! (_displayfunction & LCD_8BITMODE)) {
    // this is according to the hitachi HD44780 datasheet
    // figure 24, pg 46

    // we start in 8bit mode, try to set 4 bit mode
    write4bits(0x03);
    delayMicroseconds(4500); // wait min 4.1ms

    // second try
    write4bits(0x03);
    delayMicroseconds(4500); // wait min 4.1ms
    
    // third go!
    write4bits(0x03); 
    delayMicroseconds(150);

    // finally, set to 8-bit interface
    
    write4bits(0x02); //Before DOG DISPLAY


	//command(0x2A);	//4-Bit data length extension Bit RE=1; REV=0
	command(0x09);	//4 line display
	command(0x06);	//Bottom view
	command(0x1E);	//Bias setting BS1=1
	command(0x29);	//4-Bit data length extension Bit RE=0; IS=1
	command(0x1B);	//BS0=1 -> Bias=1/6
	command(0x6E); //Devider on and set value
	command(0x57); //Booster on and set contrast (BB1=C5, DB0=C4)
	command(0x72); //Set contrast (DB3-DB0=C3-C0)
	command(0x28); //4-Bit data length extension Bit RE=0; IS=0

Picture of the display setup, i do the 3,3 volt width simple voltage devider 1K / 2 K gives nice squre 3,3 volt signal, and as i do not need to read this will work for me.

dog-2.JPG

Ok got it to work
I changed the delay times need to be bigger.
And finally initialized it correct.
Here is the library i endet up width. only first bit of it
But still not perfect, if i power it of and quick in again, it show nothing, but power off 5 sec and then back on it workes :slight_smile:

Here is the first bit of the "LiquidCrystal.cpp" i was not able to post it all it was to big.

But i am an amateur, in changing library, just lucky i got it to work, if some more capable then me have changes to make it more stable, please post.

#include "LiquidCrystal.h"

#include <stdio.h>
#include <string.h>
#include <inttypes.h>
#include "Arduino.h"

// When the display powers up, it is configured as follows:
//
// 1. Display clear
// 2. Function set: 
//    DL = 1; 8-bit interface data 
//    N = 0; 1-line display 
//    F = 0; 5x8 dot character font 
// 3. Display on/off control: 
//    D = 0; Display off 
//    C = 0; Cursor off 
//    B = 0; Blinking off 
// 4. Entry mode set: 
//    I/D = 1; Increment by 1 
//    S = 0; No shift 
//
// Note, however, that resetting the Arduino doesn't reset the LCD, so we
// can't assume that its in that state when a sketch starts (and the
// LiquidCrystal constructor is called).

LiquidCrystal::LiquidCrystal(uint8_t rs, uint8_t rw, uint8_t enable,
			     uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3,
			     uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7)
{
  init(0, rs, rw, enable, d0, d1, d2, d3, d4, d5, d6, d7);
}

LiquidCrystal::LiquidCrystal(uint8_t rs, uint8_t enable,
			     uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3,
			     uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7)
{
  init(0, rs, 255, enable, d0, d1, d2, d3, d4, d5, d6, d7);
}

LiquidCrystal::LiquidCrystal(uint8_t rs, uint8_t rw, uint8_t enable,
			     uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3)
{
  init(1, rs, rw, enable, d0, d1, d2, d3, 0, 0, 0, 0);
}

LiquidCrystal::LiquidCrystal(uint8_t rs,  uint8_t enable,
			     uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3)
{
  init(1, rs, 255, enable, d0, d1, d2, d3, 0, 0, 0, 0);
}

void LiquidCrystal::init(uint8_t fourbitmode, uint8_t rs, uint8_t rw, uint8_t enable,
			 uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3,
			 uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7)
{
  _rs_pin = rs;
  _rw_pin = rw;
  _enable_pin = enable;
  
  _data_pins[0] = d0;
  _data_pins[1] = d1;
  _data_pins[2] = d2;
  _data_pins[3] = d3; 
  _data_pins[4] = d4;
  _data_pins[5] = d5;
  _data_pins[6] = d6;
  _data_pins[7] = d7; 

  pinMode(_rs_pin, OUTPUT);
  // we can save 1 pin by not using RW. Indicate by passing 255 instead of pin#
  if (_rw_pin != 255) { 
    pinMode(_rw_pin, OUTPUT);
  }
  pinMode(_enable_pin, OUTPUT);
  
  if (fourbitmode)
    _displayfunction = LCD_4BITMODE | LCD_1LINE | LCD_5x8DOTS;
  else 
    _displayfunction = LCD_8BITMODE | LCD_1LINE | LCD_5x8DOTS;
  
  begin(16, 1);  
}

void LiquidCrystal::begin(uint8_t cols, uint8_t lines, uint8_t dotsize) {
  if (lines > 1) {
    _displayfunction |= LCD_2LINE;
  }
  _numlines = lines;
  _currline = 0;

  // for some 1 line displays you can select a 10 pixel high font
  if ((dotsize != 0) && (lines == 1)) {
    _displayfunction |= LCD_5x10DOTS;
  }

  // SEE PAGE 45/46 FOR INITIALIZATION SPECIFICATION!
  // according to datasheet, we need at least 40ms after power rises above 2.7V
  // before sending commands. Arduino can turn on way befer 4.5V so we'll wait 50
  delayMicroseconds(200000); 
  // Now we pull both RS and R/W low to begin commands
  digitalWrite(_rs_pin, LOW);
  digitalWrite(_enable_pin, LOW);
  if (_rw_pin != 255) { 
    digitalWrite(_rw_pin, LOW);
  }
  
  //put the LCD into 4 bit or 8 bit mode
  if (! (_displayfunction & LCD_8BITMODE)) {
    // this is according to the hitachi HD44780 datasheet
    // figure 24, pg 46

    // we start in 8bit mode, try to set 4 bit mode
    write4bits(0x03);
    delayMicroseconds(9000); // wait min 4.1ms

    // second try
    write4bits(0x03);
    delayMicroseconds(9000); // wait min 4.1ms
    
    // third go!
    write4bits(0x03); 
    delayMicroseconds(300);

    // finally, set to 8-bit interface
    
    write4bits(0x02); //skal på igen


	command(0x2A);	//4-Bit data length extension Bit RE=1; REV=0
	command(0x09);	//4 line display
	command(0x06);	//Bottom view
	command(0x1E);	//Bias setting BS1=1
	command(0x29);	//4-Bit data length extension Bit RE=0; IS=1
	command(0x1B);	//BS0=1 -> Bias=1/6
	command(0x6E); //Devider on and set value
	command(0x57); //Booster on and set contrast (BB1=C5, DB0=C4)
	command(0x72); //Set contrast (DB3-DB0=C3-C0)
	command(0x28); //4-Bit data length extension Bit RE=0; IS=0

  } else {
    // this is according to the hitachi HD44780 datasheet

dog-3.jpg

Nothing happens no char on the display. :frowning:

Ok got it to work

Your post is hard to follow. Can you please give a concise SITREP (Mil-Speak for SITUATION REPORT) ?
I can see the characters on the display so what do you need ?
At this point I don't think anyone knows what you need...

Hi
Yes the situation is as follow.

When i power up arduino, the display is most of the times not showing anything.
Then i power it off for 5 sec and then power it on again. then suddenly it works.
And when it works it does anything right.

If anyone know what the problem can be regarding boot up sequence, delays and so on, so that there are chars on the display every time i power it up.

I changed the delay times need to be bigger.

Why are you messing around with the library ? Can't you do whatever you want to do without changing the library code ?

When i power up arduino, the display is most of the times not showing anything.
Then i power it off for 5 sec and then power it on again. then suddenly it works.
And when it works it does anything right.

This is indicative of improper initialization. Several possibilities come to mind.

(1) The initialization may not exactly follow the sequence recommended by Hitachi. This could result in code that works almost all of the time on almost all devices but on the oddballs it may work erratically or not at all. The LiquidCrystal library that has come with the Arduino for the past several years and all of the libraries derived from that library fall in this category.

(2) The program author may not have spotted the missing time delay in the initialization sequence recommended by Hitachi (catch22). This may or may not be a problem depending on the efficiency of the C compiler code and the speed of the processor running the code (the Arduino). The LiquidCrystal library that has come with the Arduino for the past several years and the libraries derived from that library fall in this category. The code in the OP and reply #2 also falls in this category.

(3) The initialization sequence may exactly follow the sequence recommended by Hitachi but the author may have used the nominal timing values from the datasheet without following the notes that recommend adjusting them to account for possible variations in the clock frequency of the LCD controller. The LiquidCrystal library that has come with the Arduino for the past several years and the libraries derived from that library are OK in this respect.

(4) The particular LCD in question may be so far out of specification that even a properly written library won't work reliably. The use of really long delays in the proper places can compensate for this. This might be easier to check out if you use LCD code that is not incorporated into a library. You can find some code examples by following the appropriate links at http://web.alfredstate.edu/weimandn. You can find out how to deal with the Initialization at the same place.

Don

Why are you messing around with the library ? Can't you do whatever you want to do without changing the library code ?

Not really since you can't fix delays between the steps in the initialization. I don't think you can put delays between the writing of individual characters in a string either.

Don

Hi Thanks for any reply so far.

I have experimented a lot more.
Now i found out, if i just power up arduino width the LCD connected. and if noting is displayed
Then i Make a reset on the display, pulling the reset pin low.
Then i reset the arduino, pressing the reset button.
Then all is fine works every time.
But i hope there is a way to get it up and running without doing this
Any idea ?

I initialize width the Reset pin high all the time, maybe that is the problem. as i just found this in the ssd1803a data sheet
Turn on VDDIO, VDD and VCI supply
Delay ? 5ms
Hardware RESET (? 10 ms)
Delay ? 1ms
http://www.lcd-module.de/fileadmin/eng/pdf/zubehoer/ssd1803a_2_0.pdf "13.4 Power On/Off Sequence & Vout Timing"

Hi Last Post

Got it to work :slight_smile:
Reset PIN on display connected to Reset pin on Arduino, i found this solution somewhere on this FORUM
EDIT (it also work if the 3.3 volt goes to Reset true a 10K resistor, and a 100 nF from reset to ground. )

That means if you want to use this display you have to do the following.
Modify the LiquidCrystal.cpp

// finally, set to 8-bit interface
    write4bits(0x02); 
	command(0x2A);	//4-Bit data length extension Bit RE=1; REV=0
	command(0x09);	//4 line display
	command(0x06);	//Bottom view
	command(0x1E);	//Bias setting BS1=1
	command(0x29);	//4-Bit data length extension Bit RE=0; IS=1
	command(0x1B);	//BS0=1 -> Bias=1/6
	command(0x6E); //Devider on and set value
	command(0x57); //Booster on and set contrast (BB1=C5, DB0=C4)
	command(0x72); //Set contrast (DB3-DB0=C3-C0)
	command(0x28); //4-Bit data length extension Bit RE=0; IS=0

And this
int row_offsets[] = { 0x00, 0x40, 0x14, 0x54 }
Change to this
int row_offsets[] = { 0x00, 0x20, 0x40, 0x60 };