Problems with 2x16 oled display

For my project I ordered a 2x16 OLED display from reichelt.
http://https://www.lcd-module.de/fileadmin/eng/pdf/doma/olede.pdf

However, it goes wrong when controlling a number of characters.
When it should show an empty segment for some characters, a strange character is displayed. It appears that this display is set to English / Japanese by default. But I think I must have Western Europe. When I look at the manual, it says to adjust the FTO / FT1 bits in the function set register.

I think it is the case that during initialization 0x39 (see page 5 of the manual) should be sent to the display before even 1 character is sent. This will address the European characters.
However, I am just a rookie and I am not that far into the programming and I could use some help.

The LiquidCrystal_I2C library is used. Is it true that I should add 0x39 to the file below?

//YWROBOT
#ifndef LiquidCrystal_I2C_h
#define LiquidCrystal_I2C_h


#include <inttypes.h>
#include "Print.h" 
#include <Wire.h>


// commands
#define LCD_CLEARDISPLAY 0x01
#define LCD_RETURNHOME 0x02
#define LCD_ENTRYMODESET 0x04
#define LCD_DISPLAYCONTROL 0x08
#define LCD_CURSORSHIFT 0x10
#define LCD_FUNCTIONSET 0x20
#define LCD_SETCGRAMADDR 0x40
#define LCD_SETDDRAMADDR 0x80


// flags for display entry mode
#define LCD_ENTRYRIGHT 0x00
#define LCD_ENTRYLEFT 0x02
#define LCD_ENTRYSHIFTINCREMENT 0x01
#define LCD_ENTRYSHIFTDECREMENT 0x00


// flags for display on/off control
#define LCD_DISPLAYON 0x04
#define LCD_DISPLAYOFF 0x00
#define LCD_CURSORON 0x02
#define LCD_CURSOROFF 0x00
#define LCD_BLINKON 0x01
#define LCD_BLINKOFF 0x00


// flags for display/cursor shift
#define LCD_DISPLAYMOVE 0x08
#define LCD_CURSORMOVE 0x00
#define LCD_MOVERIGHT 0x04
#define LCD_MOVELEFT 0x00


// flags for function set
#define LCD_8BITMODE 0x10
#define LCD_4BITMODE 0x00
#define LCD_2LINE 0x08
#define LCD_1LINE 0x00
#define LCD_5x10DOTS 0x04
#define LCD_5x8DOTS 0x00


// flags for backlight control
#define LCD_BACKLIGHT 0x08
#define LCD_NOBACKLIGHT 0x00


#define En B00000100  // Enable bit
#define Rw B00000010  // Read/Write bit
#define Rs B00000001  // Register select bit


class LiquidCrystal_I2C : public Print {
public:
  LiquidCrystal_I2C(uint8_t lcd_Addr,uint8_t lcd_cols,uint8_t lcd_rows);
  void begin(uint8_t cols, uint8_t rows, uint8_t charsize = LCD_5x8DOTS );
  void clear();
  void home();
  void noDisplay();
  void display();
  void noBlink();
  void blink();
  void noCursor();
  void cursor();
  void scrollDisplayLeft();
  void scrollDisplayRight();
  void printLeft();
  void printRight();
  void leftToRight();
  void rightToLeft();
  void shiftIncrement();
  void shiftDecrement();
  void noBacklight();
  void backlight();
  void autoscroll();
  void noAutoscroll(); 
  void createChar(uint8_t, uint8_t[]);
  void createChar(uint8_t location, const char *charmap);
  // Example: 	const char bell[8] PROGMEM = {B00100,B01110,B01110,B01110,B11111,B00000,B00100,B00000};
  
  void setCursor(uint8_t, uint8_t); 
#if defined(ARDUINO) && ARDUINO >= 100
  virtual size_t write(uint8_t);
#else
  virtual void write(uint8_t);
#endif
  void command(uint8_t);
  void init();
  void oled_init();


////compatibility API function aliases
void blink_on();						// alias for blink()
void blink_off();       					// alias for noBlink()
void cursor_on();      						// alias for cursor()
void cursor_off();      					// alias for noCursor()
void setBacklight(uint8_t new_val);				// alias for backlight() and nobacklight()
void load_custom_character(uint8_t char_num, uint8_t *rows);	// alias for createChar()
void printstr(const char[]);


////Unsupported API functions (not implemented in this library)
uint8_t status();
void setContrast(uint8_t new_val);
uint8_t keypad();
void setDelay(int,int);
void on();
void off();
uint8_t init_bargraph(uint8_t graphtype);
void draw_horizontal_graph(uint8_t row, uint8_t column, uint8_t len,  uint8_t pixel_col_end);
void draw_vertical_graph(uint8_t row, uint8_t column, uint8_t len,  uint8_t pixel_col_end);
	 


private:
  void init_priv();
  void send(uint8_t, uint8_t);
  void write4bits(uint8_t);
  void expanderWrite(uint8_t);
  void pulseEnable(uint8_t);
  uint8_t _Addr;
  uint8_t _displayfunction;
  uint8_t _displaycontrol;
  uint8_t _displaymode;
  uint8_t _numlines;
  bool _oled = false;
  uint8_t _cols;
  uint8_t _rows;
  uint8_t _backlightval;
};


#endif

Can you post a link to datasheet that we can have access to?
I can't tell much until I see a datasheet and the link you posted gets redirected to various sites.

You could switch to the hd44780 library and use the hd44780_I2Cexp i/o class.
That library also comes with a full diagnostic, I2CexpDIag, that will test the i2c lines, and the LCD to verify that everything is working.
It can be installed directory from the IDE using the library manager and comes with lots of documentation.

--- bill

Oh I see now indeed that the link is not working.
Excuses for this.
Hopefully the following will work fine:

The problem is that I don't have the code myself. I will briefly explain how this came about. It is a guitar looper with which you can program a number of presets with which a total of 8 effect pedals can be switched. A number of projects are already roaming around on the internet here.
Now I ended up on a facebook group where 2 guys have taken the initiative to share their experiences with the rest. The only caveat is that these keep the source code for themselves. So they release almost everything. No problems in itself. I also wanted to experiment with this project. So that's the reason I can't dive into the source code.
But they are thinking about a solution. So if I can come up with a solution where my display can be controlled, they are willing to help me with that.

I'm not quite understanding your situation.
Some of the code is open and some isn't ?
Sounds like you may have all the original code but there are a couple of guys now making changes but not sharing their changes?

Whenever Arduino and in particular this LCD library is used to build a product/project that is shared, ALL the code becomes subject to LGPL 2.1+ licensing requirements.
While not sharing some code is allowed when using LGPL licensed code, any changes made to the open source code must be shared.
Also a user that obtains a copy of code (even if it is embedded in device) must be able to rebuild and update any LGPL code used in the firmware image.

You have the right to ask for all the LGPL source code used and any code objects necessary to rebuild your new image with updates for any LGPL components used in the image and they are require to provide it to you in order to meet the LGPL 2.1 licensing requirements.


On the technical side, it isn't clear what is happening as you have not provided enough information.
i.e. there is no description of what is on the LCD vs what should be in the LCD.

For large characters composed of multiple custom characters on the display, the code should use 0x20 to get a blank space.
If they are using 0x14 then they should change their code to use 0x20

But my guess is that there may be some other s/w or h/w issue.
There a few issues in that library related to timing and custom characters perhaps those are being triggered by something in the other s/w (i.e. code in the sketch)
It could be a h/w issue and the data is getting corrupted across the i2c bus so the character and or command codes are being corrupted which causes corruption of the LCD display.

Again, I would recommend installing the hd44780 library and running the included diagnostic sketch to verify that the i2c bus signals and the LCD h/w is working as expected.

--- bill

The problem is solved. They actually used 0x14 for a space. We have adjusted this to 0x20. Now it works fine.
Thanks.

This topic was automatically closed after 54 days. New replies are no longer allowed.