bcarroll 2 Posted September 19, 2012 Share Posted September 19, 2012 I am attempting to run the example sketch in the Liquid Crystal library that comes with Energia and am getting a compile error: sketch_sep19a.cpp: In function 'void setup()': sketch_sep19a.cpp:18:14: error: call of overloaded 'write(int)' is ambiguous sketch_sep19a.cpp:18:14: note: candidates are: C:\energia-0101E0008\hardware\msp430\libraries\LiquidCrystal/LiquidCrystal.h:82:18: note: virtual size_t LiquidCrystal::write(uint8_t) C:\energia-0101E0008\hardware\msp430\cores\msp430/Print.h:56:12: note: size_t Print::write(const char*) Here's the code: #include LiquidCrystal lcd(P2_0,P2_1,P2_2,P2_3,P2_4,P2_5); byte smiley[8] = { B00000, B10001, B00000, B00000, B10001, B01110, B00000, }; void setup() { lcd.createChar(0, smiley); lcd.begin(16, 2); lcd.write(0); } void loop() {} Quote Link to post Share on other sites
bcarroll 2 Posted September 19, 2012 Author Share Posted September 19, 2012 Apparently the problem is with the numbering in the createChar() function of the Liquid Crystal library The Liquid Crystal library documentation states: Create a custom character (gylph) for use on the LCD. Up to eight characters of 5x8 pixels are supported (numbered 0 to 7). The appearance of each custom character is specified by an array of eight bytes, one for each row. The five least significant bits of each byte determine the pixels in that row. To display a custom character on the screen, write() its number. I was able to resolve this issue by changing lcd.createChar(0,smiley); lcd.write(0); to lcd.createChar(1,smiley); lcd.write(1); I also confirmed that using 1-8 works for createChar(). Maybe the doc should be changed for the Liquid Crystal library that is included with Energia? Quote Link to post Share on other sites
bcarroll 2 Posted September 20, 2012 Author Share Posted September 20, 2012 Here is the working example: #include LiquidCrystal lcd(P2_0,P2_1,P2_2,P2_3,P2_4,P2_5); uint8_t smiley[8] = { B00000, B10001, B00000, B00000, B10001, B01110, B00000, }; void setup() { lcd.createChar(1, smiley); lcd.begin(16, 2); lcd.write(1); } void loop() {} Quote Link to post Share on other sites
energia 485 Posted September 20, 2012 Share Posted September 20, 2012 I had not tested the write modes. Thanks for testing and confirming that they work. I looked at the code for createChar() and 0 should have worked. 8 however should not have worked. I am planning a little project that uses an LCD and will look at it in more detail then. What is the make / model of your LCD? Robert Quote Link to post Share on other sites
energia 485 Posted September 20, 2012 Share Posted September 20, 2012 Just looked at the error and noticed that it has trouble finding a match for the write(0). It doesn't treat the argument as a uint8_t. When explicitly casting to a uint8_t, it works as expected. Might be an issue with the compiler and will have to narrow it down. For now your solution is: replace: write(0); by: write((uint8_t)0); pivden 1 Quote Link to post Share on other sites
xv4y 46 Posted September 30, 2012 Share Posted September 30, 2012 Hi, I am just jumping in this thread. I am new to LCD display (and new to almost everything in embedded computing I must say). I just received a 16x2 LCD and was trying it with my Arduino because the Launchpad is currently used for something else. While searching for a way to display bargraphs for another project (some kind of spectrum analyzer using FFT) I found this library : https://bitbucket.org/fmalpartida/new-l ... /wiki/Home Hardware abstraction seems better than the original one so perhaps porting it to Energia could be easier... It is also faster and allows for using a shift register saving pins... I will soon try it with the LaunchPad but I am busy until friday at least... Regards, Yan. Quote Link to post Share on other sites
RobG 1,892 Posted September 30, 2012 Share Posted September 30, 2012 If you want to use shift register, why not use 8bit mode instead of 4bit? Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.