Setting 2 Serial speeds in one program?

Hello guys,

I'm here with another question.
I'm working with a couple of other guys on a project named 'Pumping Nature' we are programming and placing a water pumpingsystem in a swamp area.

We're using Arduino Mega2560, HD44780 (4bit connection) and a SD shield from adafruit.
In this project we need a datalogger (SD) and a LCD-display. We're managing just fine except for a couple of errors with Baud rates.

For the datalogger we need to write the date and time (RTC) this runs on 57600 baud.
But we also need a LCD, and this runs on 9600 baud. When a sketch is uploaded with a serial connection speed of 57600baud, then the LCD will write gibberish.

I've read that there is an option to configure multiple Baud rates.. However the example provided is with a serial monitor..

My question: Can, and if so can you help me with the code, an arduino run 2 diffrent Baud speeds in one program?

So is there a way to control the RTC bit with 57600baud but the lcd with 9600?

Many thanks for reading my Topic.

So is there a way to control the RTC bit with 57600baud but the lcd with 9600?

As the Mega has four hardware serial ports that should be easy. One device on each of two separate serial ports

But the serial ports are only 2 pins, right?

the pin configuration of the LCD is (Rs,E,D4,D5,D6,D7) as I recall, but the serial pins are only 2 pins? not 6?

Sounds like your LCD is not serial.

It is not, it is parallel (right?)

But neither is my SD shield if I'm not mistaken since it uses port 10-13?
(Tutorial - datasheet)

As seen on p17 we need to use 57600baud.

You can ignore this if the answer is: Neither of them is serial.

If the one is parallel, and the other serial, can I put serial.begin(9600) on the whole program except for the SD shield which I use another serial port for as per: serial1.begin(57600) ?

Do I need to connect my chip select and ground on those port? (TX1 and RX1)

The Serial in the tutorial of your link is only used to display the clock data in the Serial monitor, it's only for testing. You don't need it if you don't use a Serial monitor :stuck_out_tongue:

yes but I'm sending the same data to my LCD, but the problem is, if I use 57600Baud on my LCD it gives me these alien characters.

I thought that we had established that the LCD was not using serial.

To use your LCD you don't need to set any bauds:

lcd.begin( numColumns, numRows );

lcd.print( "Hello" );

The baud rate set in Serial.begin() should have nothing to do with the LCD or the SD card. There is likely a problem in your sketch. If you show your sketch we might be able to tell you what is wrong.

Make sure you are not using the same pin for two different devices.

Yeah the problem seems to be solved now,

we have a 16x2 display and we programmed lcd.begin(16,1) thereby it gave wrong characters (Or that is what my friend told me)