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.
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:
const int FourthBit = 0b1000;
if(value & FourthBit) {...
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.
//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()
{
}
This is the library that works on UNO....but when used in DUE I've got compilation error
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.
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