3 Replies Latest reply on Dec 31, 2013 3:38 PM by s.widmer

    Simple Serial LCD

    intel_jassowski

      I just wanted to make a post to help anyone looking to quickly add an LCD display to their Galileo board.  A very simple way is to use a serial LCD connected to the UART Tx pin (I/O 1).  This means that only 3 wires are necessary to connect: 5V, GND, and Tx, and it only consumes one I/O pin.

       

      The LCD can then be controlled by using sketch with the Serial1() commands.

      The commands to control the serial LCD will be specific to each LCD module, but the example code below should get you started.

      This code is based on the Parallax Serial LCD module (Parallax 2 x 16 Serial LCD (Backlit) | 27977 | Parallax Inc).

       

      The LCD module has a 3 pin jumper on the back: connect GND to GND, 5V to 5V, and RX (LCD) to TX (Galileo Pin TX->1).

       

      You will need to initialize the LCD in your setup() routine.

      User Serial1.write() to send control bytes to the display, and Serial1.print() to send strings.

       

      void setup()

      {

        Serial1.begin(19200);    // Make sure the LCD switches are set to 19200 baud

        Serial1.write(22);          // Turn the display on, with cursor off and no blink

        Serial1.write(17);          // Turn backlight on (only on models 27977, 27979)

        Serial1.write(12);          // Form Feed - The cursor is moved to position 0 on line 0

                    // and the entire display is cleared. Users must pause 5mS after this command.

        delay(5);

      }

       

      void loop()

      {

        Serial1.write(128);          // Move cursor to line 0, position 0 (not really needed for the first loop, but thereafter...)

        Serial1.print("Hello World!");

        Serial1.write(148);          // Move cursor to line 1, position 0

        Serial1.print("Intel Galileo");

      }

       

      This LCD module also has rudimentary sound capabilities which you can access using the Serial1.write() commands as well.

      D

        • 1. Re: Simple Serial LCD
          Clayton Hofrock

          I personally have had trouble getting an I2C device to work with Galileo.

           

          I have gotten my serial LCD to work by adding just one line of code in the Setup function.

               lcd.init(1,12,255,11,5,4,3,2,0,0,0,0); //Place before any lcd access.

          • 2. Re: Simple Serial LCD
            ek

            the lcd.init() is a fix for parallel LCD. I2C LCD still does not work.

            • 3. Re: Simple Serial LCD
              s.widmer

              This example works well with the Sparkfun 16x2 Serial (3 wire TX/RX/GND) Display.  The biggest tricks are:
              1: knowing to connect TX to RX from the Controller CCA to the display. (some equipment does not follow that standard)
              2: The device suggested it works by default at 9600 BPS, I found using 19200BPS to work nicely.

              3: finding out that the MicroControllers ports for TX and RX are not called Serial in the library, but are instead called Serial1.