I2C GLCD start problem

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

Moderator: Benj

User avatar
Jan Lichtenbelt
Posts: 794
Joined: Tue Feb 17, 2009 8:35 pm
Location: Haren GN, the Netherlands
Has thanked: 128 times
Been thanked: 261 times
Contact:

I2C GLCD start problem

Postby Jan Lichtenbelt » Sat Oct 19, 2019 3:39 pm

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 29 times

mnf
Valued Contributor
Valued Contributor
Posts: 559
Joined: Wed May 31, 2017 11:57 am
Has thanked: 54 times
Been thanked: 314 times
Contact:

Re: I2C GLCD start problem

Postby mnf » Sat Oct 19, 2019 4:55 pm

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
These users thanked the author mnf for the post:
Jan Lichtenbelt (Mon Oct 21, 2019 6:26 pm)
Rating: 5.26%
 

User avatar
Jan Lichtenbelt
Posts: 794
Joined: Tue Feb 17, 2009 8:35 pm
Location: Haren GN, the Netherlands
Has thanked: 128 times
Been thanked: 261 times
Contact:

Re: I2C GLCD start problem

Postby Jan Lichtenbelt » Sat Oct 19, 2019 6:28 pm

Hi Martin,

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

Kind regards

Jan

User avatar
Jan Lichtenbelt
Posts: 794
Joined: Tue Feb 17, 2009 8:35 pm
Location: Haren GN, the Netherlands
Has thanked: 128 times
Been thanked: 261 times
Contact:

Re: I2C GLCD start problem

Postby Jan Lichtenbelt » Sun Oct 20, 2019 11:55 am

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 15 times

mnf
Valued Contributor
Valued Contributor
Posts: 559
Joined: Wed May 31, 2017 11:57 am
Has thanked: 54 times
Been thanked: 314 times
Contact:

Re: I2C GLCD start problem

Postby mnf » Sun Oct 20, 2019 12:00 pm

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
These users thanked the author mnf for the post:
Jan Lichtenbelt (Mon Oct 21, 2019 6:27 pm)
Rating: 5.26%
 

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8440
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2412 times
Been thanked: 3450 times
Contact:

Re: I2C GLCD start problem

Postby medelec35 » Sun Oct 20, 2019 12:07 pm

Hi Jan,
Since 0x3C * 2 = 0x78
Then you will will use 0x78 for write and 0x79 to read
These users thanked the author medelec35 for the post:
Jan Lichtenbelt (Mon Oct 21, 2019 6:27 pm)
Rating: 5.26%
 
Martin

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

viktor_au
Posts: 122
Joined: Fri Jan 26, 2018 12:30 pm
Location: South Australia
Has thanked: 21 times
Been thanked: 31 times
Contact:

Re: I2C GLCD start problem

Postby viktor_au » Sun Oct 20, 2019 12:13 pm

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.
These users thanked the author viktor_au for the post:
Jan Lichtenbelt (Mon Oct 21, 2019 6:27 pm)
Rating: 5.26%
 

User avatar
Jan Lichtenbelt
Posts: 794
Joined: Tue Feb 17, 2009 8:35 pm
Location: Haren GN, the Netherlands
Has thanked: 128 times
Been thanked: 261 times
Contact:

Re: I2C GLCD start problem

Postby Jan Lichtenbelt » Mon Oct 21, 2019 9:38 am

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: 794
Joined: Tue Feb 17, 2009 8:35 pm
Location: Haren GN, the Netherlands
Has thanked: 128 times
Been thanked: 261 times
Contact:

Re: I2C GLCD start problem

Postby Jan Lichtenbelt » Mon Oct 21, 2019 11:37 am

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: 794
Joined: Tue Feb 17, 2009 8:35 pm
Location: Haren GN, the Netherlands
Has thanked: 128 times
Been thanked: 261 times
Contact:

Re: I2C GLCD start problem

Postby Jan Lichtenbelt » Mon Oct 21, 2019 12:49 pm

I tried to get understanding the results shown on the gLCD:

Reality.jpg
Reality.jpg (54.64 KiB) Viewed 391 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 391 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: 14370
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4447 times
Been thanked: 4145 times
Contact:

Re: I2C GLCD start problem

Postby Benj » Mon Oct 21, 2019 3:45 pm

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.
These users thanked the author Benj for the post:
Jan Lichtenbelt (Mon Oct 21, 2019 6:23 pm)
Rating: 5.26%