LCD offset 16x4 i2c / SPI character LCD backpack

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
lineman2208
 
Posts: 4
Joined: Thu Sep 17, 2020 8:33 pm

LCD offset 16x4 i2c / SPI character LCD backpack

Post by lineman2208 »

I am having troubles with a 16x4 LCD and the i2c / SPI character LCD backpack. The bottom 2 lines are offset by 4 blocks.
If i use the code below the bottom 2 lines will have 4 unused spaces at the front of the line.

Code: Select all

// include the library code:
#include "Wire.h"
#include "Adafruit_LiquidCrystal.h"

// Connect via i2c, default address #0 (A0-A2 not jumpered)
Adafruit_LiquidCrystal lcd(0);

void setup() {
  // set up the LCD's number of rows and columns: 
  lcd.begin(16, 4);
  lcd.setCursor(0, 0);
  lcd.print("hello, world!");
  lcd.setCursor(0, 1);
  lcd.print("hello, world!");
  lcd.setCursor(0, 2);
  lcd.print("hello, world!");
  lcd.setCursor(0, 3);
  lcd.print("hello, world!");
}

void loop() {
}
If i use the code below the bottom 2 lines will be at the beginning of the line like it should be when it is set to zero.

Code: Select all

// include the library code:
#include "Wire.h"
#include "Adafruit_LiquidCrystal.h"

// Connect via i2c, default address #0 (A0-A2 not jumpered)
Adafruit_LiquidCrystal lcd(0);

void setup() {
  // set up the LCD's number of rows and columns: 
  lcd.begin(16, 4);
  lcd.setCursor(0, 0);
  lcd.print("hello, world!");
  lcd.setCursor(0, 1);
  lcd.print("hello, world!");
  lcd.setCursor(-4, 2);
  lcd.print("hello, world!");
  lcd.setCursor(-4, 3);
  lcd.print("hello, world!");
}

void loop() {
}
What do i do to get the last 2 lines at the front of the line when it is set to 0? i have used 2 different displays on different backpacks and same problem.

User avatar
adafruit_support_bill
 
Posts: 88136
Joined: Sat Feb 07, 2009 10:11 am

Re: LCD offset 16x4 i2c / SPI character LCD backpack

Post by adafruit_support_bill »

Are you sure it is a 16x4 display? The most common sizes are 16x2 and 20x4.

User avatar
lineman2208
 
Posts: 4
Joined: Thu Sep 17, 2020 8:33 pm

Re: LCD offset 16x4 i2c / SPI character LCD backpack

Post by lineman2208 »

adafruit_support_bill wrote:Are you sure it is a 16x4 display? The most common sizes are 16x2 and 20x4.
It is what I said. Did I say 20x4? no I said 16x4.

User avatar
adafruit_support_bill
 
Posts: 88136
Joined: Sat Feb 07, 2009 10:11 am

Re: LCD offset 16x4 i2c / SPI character LCD backpack

Post by adafruit_support_bill »

We do not sell a 16x4 character display. We carry the two most common sizes which are 16x2 and 20x4.

If your display is 16x4, we cannot guarantee that the backpack will work with it. Please post a link to the spec sheet for the display you are using.

User avatar
lineman2208
 
Posts: 4
Joined: Thu Sep 17, 2020 8:33 pm

Re: LCD offset 16x4 i2c / SPI character LCD backpack

Post by lineman2208 »

adafruit_support_bill wrote:We do not sell a 16x4 character display. We carry the two most common sizes which are 16x2 and 20x4.

If your display is 16x4, we cannot guarantee that the backpack will work with it. Please post a link to the spec sheet for the display you are using.
I did not buy the LCD form adafruit if you think I will pay over $10 for a LCD you are NUTS! NUTS! NUTS! I have attached LCD documentation.
Attachments
SPLC780.pdf
(812.3 KiB) Downloaded 5 times
ERM1604-1_Series_Datasheet.pdf
(411.69 KiB) Downloaded 3 times

User avatar
adafruit_support_bill
 
Posts: 88136
Joined: Sat Feb 07, 2009 10:11 am

Re: LCD offset 16x4 i2c / SPI character LCD backpack

Post by adafruit_support_bill »

Not familiar with the SPLC780 controller you are using. From what we have seen in the past, not all HD44780 'equivalent' controllers are 100% equivalent. Some require tweaks to the library for proper operation. Looks like yours may have some differences in addressing of the character RAM.

User avatar
lineman2208
 
Posts: 4
Joined: Thu Sep 17, 2020 8:33 pm

Re: LCD offset 16x4 i2c / SPI character LCD backpack

Post by lineman2208 »

adafruit_support_bill wrote:Not familiar with the SPLC780 controller you are using. From what we have seen in the past, not all HD44780 'equivalent' controllers are 100% equivalent. Some require tweaks to the library for proper operation. Looks like yours may have some differences in addressing of the character RAM.
If you could give me some help in the matter to get my adafruit product that promised any ice from 8x1 to 20x4 to work with my lcd that would be appreciated.

User avatar
adafruit_support_bill
 
Posts: 88136
Joined: Sat Feb 07, 2009 10:11 am

Re: LCD offset 16x4 i2c / SPI character LCD backpack

Post by adafruit_support_bill »

You would need to change the row offsets in line 258 of Adafruit_LiquidCrystal.cpp to match your display's non-standard memory layout.

Based on the symptoms you describe, the mapping is probably something like:

Code: Select all

void Adafruit_LiquidCrystal::setCursor(uint8_t col, uint8_t row) {
  int row_offsets[] = {0x00, 0x40, 0x10, 0x50};
  if (row > _numlines) {
    row = _numlines - 1; // we count rows starting w/0
  }

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino”