LCD-09568 changes baud rate intermittently

I have a 20x4 character display part number LCD-09568 for which I have attached an Arduino Uno to via the serial output.

In my code, I setup the baud rate to 38400. The first thing I do is set the serial port to 9600. Then I send (0x12) to the display to make sure it is set to 9600. Then I wait about a second to let the display set itself up. Then I change the baud rate to 38400 by sending (0x7c) and then (0x10) to the display.

It seems to work and the baud rate does get to 38400. I am not sure though that the 9600 baud reset command I send (0x12) is working.

I found that after several power on off cycles to the Arduino board and the display, that the display looses its baud rate setting. After changing the baud rate on my code, I usually see the display come back to life at 4800 bps (weird). Once I communicate with it, I reset the baud rate to 38400 and everything is back to normal.

Now the “SerLCD v2.5” document I have says to send (0x12) when the splash screen is active. Now I am not sure if it makes it to the splash screen cycle. With exception to setting the baud rate on the Arduino board, it is the very first thing I do. So I guess it is a who boots faster, the Arduio or the display that will determine if I actually get it reset.

So, how can I reliably reset the display to a 9600 baud rate? How can I mitigate the baud rate changing on the display in the first place?

I have attached the two code files in question. “Joint_Adjust_zero.ino” is the main file. Look in the setup section for the code I described.

The other file is “Display.ino”. There you will want to see “set_display_baud”.


Ok. I have solved my problem for now. I have added a N-channel FET to pin 4 of my Arduino Uno. I’ve connected the FET to the ground on the display such that it opens and closes the connection between ground and the ground wire on the display.

Pin 4 is at high resistance during the boot up of the Arduino. This places the display in a power off condition. Once the Arduino Uno boots up and is ready to run my program, the display is still powered down. My program then power’s up the display, waits 250msec’s and then sends (0x12) command to the display to reset the baud rate to 9600kbs. My program then wait two seconds to let the display reset the baud rate to 9600.

Then I power down the display and wait 10 seconds to let the display completely power down. I then power up the display and wait 5 seconds so that the display boots up. I then configure the display for a baud rate of 38400kbs. I wait again about 1 second to let the display reset the baud rate to 38400. I am now ready to go. This is all done in “setup” and before the loop structure.

I have tried this over a hundred times and it always boots up correctly. Thus far it seems to be very reliable. This sequence and hardware change is good if you have a display whose baud rate setting is unknown or lost.

Joint_Adjust_Zero.ino (17.6 KB)

Display.ino (11.8 KB)

Here is my updated code:

void setup()
{
//------------------------- Test pins -------------------------

analogReference(EXTERNAL);

pinMode (button,INPUT_PULLUP);
pinMode (display_power, OUTPUT);

//---------------------- communication -------------------------

//
//------------------------ Set up baud rate for a new LCD display --------------
//------------------------ Run only once for a new display ---------------------

LCD.begin(9600);
digitalWrite (display_power, LOW); //disable power to the display
delay(250);
digitalWrite (display_power, HIGH);//turn the display power on
delay(250);
LCD.write(0x12);
delay(2000);
digitalWrite (display_power, LOW); //disable power to the display
delay(10000);
digitalWrite (display_power, HIGH);//turn the display power on
delay(5000);
set_display_baud();

//------------------------ Set the Arduino Baud rate to 38400
LCD.begin(38400);
delay(1000);

//------------------------- Set up the splash screen on a new LCD Display--------------
//------------------------ Run only once for a new display ---------------------
//delay(500);
//set_splash_screen();
//delay(1);

}

Note that this will not help those who have uploaded their program to their Arduino board while the display is connected to the serial port. It will though put it back into a communication configuration for which you may be able to reset some of the parameters that were over written during that process.

If anyone knows of an interrupt or pin that I could monitor to see if the Arduino is being programmed, I could probably update my software to shut down the display before the events of programming ruin the display parameters.