Go Down

Topic: I2C/TWI Serial 2004A (20x4) LCD (Read 3325 times) previous topic - next topic

wushumike

The Liquid Crystal 2004A (20x4) sing I2C is working on the UNO fine,  but when port over to DUE,  the library gives error :
if(value & _BV))

Have been trying various libraries from the web but without success.
  The closes I would get is to display a single character every line and subsequent character disappeared.

Any help would be much appreciated.

MorganS

It looks like the forum software ate some of that error message. Please use [ code ] tags. Please post the complete error message and the complete program, if it's not too big.

_BV might be one of the "bit value" macros that is used to quickly set a single bit in an 8-bit byte. It may not exist on the Due or it is being misinterpreted as a 32-bit int in this example.

For simple comparisons to constants, like testing if the 4th bit of value has been set, it's often simpler to use binary notation directly:

Code: [Select]

const int FourthBit = 0b1000;

if(value & FourthBit) {...
"The problem is in the code you didn't post."

wushumike

#2
Mar 13, 2016, 03:31 pm Last Edit: Mar 13, 2016, 03:37 pm by wushumike
Additional information.
  I have removed the pull-up resistor on the DUE board.
      Have also tested the RTC module which is also on the I2C line and is working properly as I can retrieve the data to be displayed on the serial port.

The library I mentioned earlier with _BV error ...have error during compilation ....so no result to show.



Code: [Select]
//YWROBOT
//Compatible with the Arduino IDE 1.0
//Library version:1.1
#include <Wire.h>
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x27,20,4);  // set the LCD address to 0x27 for a 16 chars and 2 line display

void setup()
{
  lcd.init();                      // initialize the lcd
  lcd.init();
  // Print a message to the LCD.
  lcd.backlight();
  lcd.setCursor(3,0);
  lcd.print("Hello, world!");
  lcd.setCursor(2,1);
  lcd.print("Ywrobot Arduino!");
   lcd.setCursor(0,2);
  lcd.print("Arduino LCM IIC 2004");
   lcd.setCursor(2,3);
  lcd.print("Power By Ec-yuan!");
}


void loop()
{
}

wushumike


This is the library that works on UNO....but when used in DUE I've got compilation error



Code: [Select]
Arduino: 1.6.7 (Windows 10), Board: "Arduino Due (Native USB Port)"

C:\Users\user\Documents\Arduino\libraries\LiquidCrystal\FastIO.cpp: In function 'void fio_shiftOut1(fio_register, fio_bit, uint8_t, boolean)':

C:\Users\user\Documents\Arduino\libraries\LiquidCrystal\FastIO.cpp:214:19: error: '_BV' was not declared in this scope

   if(value & _BV(i))

                   ^

exit status 1
Error compiling.

wushumike

Thanks everyone...Found my answer in the following thread started on 10Mar2016


http://forum.arduino.cc/index.php?topic=385536.0


Nasa is having the exact problem which I'm facing.


I managed to get the 20x4 displaying correctly now on the DUE
   
   
   

Go Up