Go Down

Topic: Library LiquidCrystal - Duplicated call to begin() (Read 159 times) previous topic - next topic

phph

Hi everyone!

Analyzing the signals between an Arduino Uno and a HD44780 display 16x2 with a logic analyzer, I detected that HD44780 is initializated two times because the function LiquidCrystal:init() calls the function begin(16,1) and the user has to configure it another time on setup().

By the way, why not supress the begin (16,1) on LiquidCrystal::init function and let the user to configure itself like stated on documentation and considering the library should not presume the hardware configuration?

The waveforms can be seen here (brazilian portuguese language can be translated on Google Translator)

http://www.phph.com.br/instrumentacao-menu/instrumentacao-eletronica/item/132-analisando-o-controlador-de-lcd-hitachi-hd44780.html

robtillaart

#1
May 17, 2015, 07:42 pm Last Edit: May 17, 2015, 07:42 pm by robtillaart
which version of the library?  part of which IDE?
do you have a link to the code?
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

phph

which version of the library?  part of which IDE?
do you have a link to the code?
Hi Sir,

I had analysed the current version of library available today (may 17) on github, line 82.

https://github.com/arduino/Arduino/blob/master/libraries/LiquidCrystal/src/LiquidCrystal.cpp

I had compiled default example on Visual Micro/1.6.3 but I am talking about the library source code itself (not specifically the Arduino official IDE).

I mean that a duplicated call to LiquidCrystal::begin() happens because the user have to call it on setup anyway.


robtillaart

Have you tried what happens if you remove/comment  that line 82 from init in the library?

didn't investigate the code but it could be some default initialization?
but yes, begin(16,2) would make more sense as one liner displays are seldom used.

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

phph

Have you tried what happens if you remove/comment  that line 82 from init in the library?

didn't investigate the code but it could be some default initialization?
but yes, begin(16,2) would make more sense as one liner displays are seldom used.


Yes, if I remove line 82 of LiquidCrystal.cpp  (init function) and call object method begin(16,2) on setup only, it works perfectly and executes only 1 initialization cycle on LCD.

If I change line 82 of LiquidCrystal.cpp (init function) to begin(16,2) and remove it from setup() on user's code, it also works perfectly and executes only 1 initialization cycle on LCD.

robtillaart

Sounds like you have an issue, not a real bug but unneeded redundancy.
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy