Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvements to the LiquidCrystal library [imported] #196

Closed
cmaglie opened this issue Nov 15, 2012 · 1 comment
Closed

Improvements to the LiquidCrystal library [imported] #196

cmaglie opened this issue Nov 15, 2012 · 1 comment
Assignees
Labels
feature request A request to make an enhancement (not a bug fix) Library: LiquidCrystal The LiquidCrystal Arduino library

Comments

@cmaglie
Copy link
Member

cmaglie commented Nov 15, 2012

This is Issue 196 moved from a Google Code project.
Added by 2010-02-01T16:37:19.000Z by [email protected].
Please review that bug for more context and additional comments, but update this bug.

Original labels: Type-Enhancement, Priority-Medium, Component-Core

Original description

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1264823411

"40x4 LCDs
I added support for an LCD of 4 LInes and 40 characters. I think that if 24x4, 32x4 LCDs exist,
they would also work with the software as I have modified it although I have not had the
opportunity to test that. The 40x4 LCD (and any HD44780 based LCD with between 81 and 160
characters) will have 2 enable lines. To use an LCD with 4 lines and 40 columns you would
declare your LiquidCrystal object as:
LiquidCrystal lcd(RS,RW,Enable1,Enable2, data3,data2,data1,data0); at this time I don’t support
8 data lines nor do I support eliminating the RW line in this option.Then in the setup function
you would call:
lcd.begin(40,4);

Linewrap
When you declare the dimensions of the LCD in your begin call, the LiquidCrystal library
remembers how long the lines are. Now when it reaches the end of line 1, text wraps onto line 2
(not line 3 as previously).

16x4 LCDs
The begin statement also correctly positions text at the beginning of the line on 16x4 (and 40x4)
LCDs, which were not correctly handled before.

setCursor
In the past setCursor selected a location in the HD44780’s RAM not actually a screen location. If
you use any of the commands that shift the display left or right with the previous routines, then
setCursor and print, text appears in an unexpected location on the screen. With the new
software, if you call either scrollDisplayLeft() or scrollDisplayRight(), the LiquidCrystal package
keeps track of the relationship between RAM and the LCD so that setCursor coordinates are
pegged to a specific spot on the screen, rather than a spot in RAM. The sotware does not handle
autoScroll, however. Call home() after autoScroll to restore the expected relationship between
setCursor and the LCD screen.

Testing the LCD Busy Flag
Previous versions of LiquidCrystal always used timed delays on the Arduino side of the interface
to give the LCD module enough time to complete its operation. This version still does that if you
tie the RW pin to ground and do not tell LiquidCrystal what that pin number is. If you do specify
RW now, however, the software will poll the busy flag on the LCD module. Arduino operations
may thus overlap LCD operations and potentially things may go a little faster.

Crazy 8 Addressing
16x1 LCDs often have an unusual address layout; these modules often have two 8 character
halves and work best with this software if you declare them as lcd.begin(8,2); if you do that, then
you can print(“abcdefghilklmno”); and have all the characters appear as you would like across the
screen. If you use any of the scrolling commands, the bizarre addressing of these modules will
manifest itself. For details follow the LCD Addressing link at web.alfredstate.edu/weimandn

Disadvantages
The two real disadvantages I can see to the changes I have made are:

The code is longer than before. Much of the increase is in checkLcdBusyFlag() and this could be
fairly easily replaced with delayMicroseconds(100);

  1. The possibility that someone with a little 16x2 LCD is using the scrollDisplayLeft() or
    scrollDisplayRight() instructions to move data across the screen, but wants to write the data 40
    characters at a time with a print statement. This version really does not let the user write data to
    the HD44780 DDRAM which is not visible. To accomplish a scrolling display with 40 characters
    per line, you would now need to write 16 characters, scroll the display, write a little more and so
    on.

There are going to be some incompatibilities between code that assumed that line 1 wrapped
onto line 3, etc."

@ffissore ffissore added the New label Feb 27, 2014
tbowmo pushed a commit to tbowmo/Arduino that referenced this issue Jul 14, 2016
MockMySensors.ino: Added V_STATUS to S_HEATER, and S_MOISTURE
@per1234 per1234 added the Library: LiquidCrystal The LiquidCrystal Arduino library label Jun 6, 2018
@per1234 per1234 added the feature request A request to make an enhancement (not a bug fix) label Sep 26, 2020
@per1234
Copy link
Collaborator

per1234 commented Mar 28, 2021

Transferred to arduino-libraries/LiquidCrystal#46

@per1234 per1234 closed this as completed Mar 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request A request to make an enhancement (not a bug fix) Library: LiquidCrystal The LiquidCrystal Arduino library
Projects
None yet
Development

No branches or pull requests

4 participants