I2C GLCD start problem

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 8.

Moderator: Benj

Post Reply
User avatar
Jan Lichtenbelt
Posts: 796
Joined: Tue Feb 17, 2009 8:35 pm
Location: Haren GN, the Netherlands
Contact:

I2C GLCD start problem

Post by Jan Lichtenbelt »

Hi,

I'm new in the field of I2C GLCD with SSD1306 driver. I start with showing one number, but I get the error
Test_I2C_LCD_V1.c: 209: (1250) could not find space (128 bytes) for variable _FCV_0cc51_gLCD_SSD1306_i2c1__DRAM0
What to do?

Kind regards

Jan
Test_I2C_LCD_V1.fcfx
(7.98 KiB) Downloaded 87 times

mnf
Valued Contributor
Valued Contributor
Posts: 721
Joined: Wed May 31, 2017 11:57 am
Contact:

Re: I2C GLCD start problem

Post by mnf »

Hi Jan,

Looks like the MCU you are using doesn't have sufficient RAM (1024 bytes on the PIC 16LF1847) for the display buffer.

FC is trying to allocate a buffer of 8 x 128 bytes for the display memory (1k) and there are several other variables (currentX etc) - you could use one of the 32x128 displays instead of the 64 x 128 oLEDs..

Martin

User avatar
Jan Lichtenbelt
Posts: 796
Joined: Tue Feb 17, 2009 8:35 pm
Location: Haren GN, the Netherlands
Contact:

Re: I2C GLCD start problem

Post by Jan Lichtenbelt »

Hi Martin,

Thanks a lot. I will try a microchip with more RAM

Kind regards

Jan

User avatar
Jan Lichtenbelt
Posts: 796
Joined: Tue Feb 17, 2009 8:35 pm
Location: Haren GN, the Netherlands
Contact:

Re: I2C GLCD start problem

Post by Jan Lichtenbelt »

The RAM error has been disappeared using the 16LF18857 microchip.

But now I met an other problem. The address is 0x3C (https://www.okaphone.com/artikel.asp?id=484012) while the flowcode has only the choices between 0x78 and 0x7A. Does someone has a solution for this problem?

Kind regards

Jan
Test_I2C_LCD_V18857.fcfx
(7.92 KiB) Downloaded 36 times

mnf
Valued Contributor
Valued Contributor
Posts: 721
Joined: Wed May 31, 2017 11:57 am
Contact:

Re: I2C GLCD start problem

Post by mnf »

Flow code uses th address shifted left one bit (x2) with bit 0 as r/w

Both systems seem to be in widespread use - but it is a bit confusing - though I think the unshifted form seems more common.

Martin

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8873
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Contact:

Re: I2C GLCD start problem

Post by medelec35 »

Hi Jan,
Since 0x3C * 2 = 0x78
Then you will will use 0x78 for write and 0x79 to read
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

viktor_au
Posts: 183
Joined: Fri Jan 26, 2018 12:30 pm
Location: South Australia
Contact:

Re: I2C GLCD start problem

Post by viktor_au »

Hello Jan

ssd1306 default address

The default 7-bit I2C address is = 0x3C or 0b00111100
Which makes the 7-bit address + Write bit = 8bit address or = 0x78 or 0b01111000 (120)
And hence the 7-bit address + Read bit = 8bit address or = 0x79 or 0b01111001
-----------
The 8-bit address has one bit to change the mode from the write mode to the read mode.

That is why:
- 0x3C =7bit address
- 0x78 = 8bit address with write mode
-0x79= 8bit address with read mode.
---
As Ssd1306 allow user to choose the two addresses (you will see the pads on the back of the board), one 8-bit write address would be 0x78 and the other 8-bit read address would be 0x7A.
---
Normally the program will write to OLED. The 0x78 address is the default one.

User avatar
Jan Lichtenbelt
Posts: 796
Joined: Tue Feb 17, 2009 8:35 pm
Location: Haren GN, the Netherlands
Contact:

Re: I2C GLCD start problem

Post by Jan Lichtenbelt »

Hello Martin(s) and Victor

Thanks a lot for all explanations. Now I have to find out why the display does not work. More research.

Kind regards

Jan

User avatar
Jan Lichtenbelt
Posts: 796
Joined: Tue Feb 17, 2009 8:35 pm
Location: Haren GN, the Netherlands
Contact:

Re: I2C GLCD start problem

Post by Jan Lichtenbelt »

After adding 2 pull-up resistor of 1k8 (with 3V3 power supply), it works!

That made a happy for me.

Kind regards

Jan

User avatar
Jan Lichtenbelt
Posts: 796
Joined: Tue Feb 17, 2009 8:35 pm
Location: Haren GN, the Netherlands
Contact:

Re: I2C GLCD start problem

Post by Jan Lichtenbelt »

I tried to get understanding the results shown on the gLCD:
Reality.jpg
Reality.jpg (54.64 KiB) Viewed 1129 times
It seems like the gLCD is not 64x128, but 32x128

I did also a simulation in Flowcode which resulted in:
Simulation.jpg
Simulation.jpg (11.09 KiB) Viewed 1129 times
This looks more as expected for a 64x128 gLCD. Or is there something else what can explain the first picture?

Kind regards

Jan

User avatar
Benj
Matrix Staff
Posts: 14835
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Contact:

Re: I2C GLCD start problem

Post by Benj »

Hi Jan,

Yes it looks like the resolution of the display is only 32 pixels high assuming you are using font size 0.

Looks like it might be only 32 x 64.

Post Reply