1 Reply Latest reply on Aug 13, 2015 10:40 AM by PabloM_Intel

    possible issue with Arduino 1602A LCD 'Display' example on Edison

    ahazelton

      Hi,  I was trying out a 1602A LCD module with the Arduino 'Display.ino' example code and i found an odd problem i thought i should report.

       

      My LCD module is running in 4-bit mode, it is not driven by I2C, instead it uses RS/E/D4-D0 pins.  the problem is that the display library that comes with  arduino-1.6.5-r2-windows is not setting the RS & E pins to 'output' with the result that the helloWorld does not work.  This is fixed by adding...

       

        pinMode(12, OUTPUT); 

        pinMode(11, OUTPUT);

       

      ...to Setup....

       

      void setup() {

        pinMode(12, OUTPUT); 

        pinMode(11, OUTPUT);

        // set up the LCD's number of columns and rows:

        lcd.begin(16, 2);

        // Print a message to the LCD.

        lcd.print("hello, world!");

        lcd.setCursor(0,2);

        lcd.print("andyH here");

      }

       

      however, the odd thing is that the D3-D0 pins do work as is. the LiquidCrystal.cpp file has...

       

      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);


        ... which should work fine - but on my setup it doesn't!.  The data pins that do work are a little different....

       

      void LiquidCrystal::write4bits(uint8_t value) {

        for (int i = 0; i < 4; i++) {

          pinMode(_data_pins[i], OUTPUT);

          digitalWrite(_data_pins[i], (value >> i) & 0x01);

        }

       

      I verified the problem by changing...

         LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

      to...

         LiquidCrystal lcd(5, 4, 12, 11, 3, 2);

      ...and checking the pins with a 'scope.  making this change moves the problem onto 5/4 and 11/12 now work fine.

      then i put the extra pinModes into Setup to see if the library code was not setting up the IO properly and the problem went away! Weird.

       

      I'm posting this in case folk run into the same problem.

       

      My original setup was to install Intel IOT Development Kit with all 3 IDE's but alas the Arduino IDE is 1.6.4 rather than the latest.  So i ended up downloading 1.6.5 from the Arduino site and installing the Edison and Galileo board support modules. in the end the LCD works fine.  I have not tried it on Galileo yet though.

       

      andyH_Intel