3C : LCD I2C
- Dan81
- Valued Contributor
- Posts: 268
- Joined: Sun Jan 15, 2006 4:07 pm
- Location: Albi France
- Been thanked: 60 times
- Contact:
3C : LCD I2C
Hello
I'm still using "Customize Component Code" (only for Flowcode v4)
I'll post the code soon.
There'll be all the usual "Component Macros" with an I2C management.
I use a classic LCD with a GPIO (from Microchip) : MCP23008.
The only rule is to respect the schematic below.
Daniel
I'm still using "Customize Component Code" (only for Flowcode v4)
I'll post the code soon.
There'll be all the usual "Component Macros" with an I2C management.
I use a classic LCD with a GPIO (from Microchip) : MCP23008.
The only rule is to respect the schematic below.
Daniel
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: 3C : LCD I2C
Hi Dan,
Great idea for an article. We actually use the SPI version of this output expander on the EB057 and EB058 gLCD to allow for the LCD pins to be controlled from a single E-blocks port. The SPI version is pretty much identical but because of the overhead for I2C communications the SPI version will run a little faster. With a slow device like the LCD the I2C method shouldn't experience any slowdown.
Many thanks.
Great idea for an article. We actually use the SPI version of this output expander on the EB057 and EB058 gLCD to allow for the LCD pins to be controlled from a single E-blocks port. The SPI version is pretty much identical but because of the overhead for I2C communications the SPI version will run a little faster. With a slow device like the LCD the I2C method shouldn't experience any slowdown.
Many thanks.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
- Dan81
- Valued Contributor
- Posts: 268
- Joined: Sun Jan 15, 2006 4:07 pm
- Location: Albi France
- Been thanked: 60 times
- Contact:
Re: 3C : LCD I2C
How to use I2C LCD.
INTRODUCTION
I2C bus is very interesting cause it needs only 2 lines of the micro-controller.
You can find lots of components (RTC, thermometer, Led dimmer, …).
The bus frequency is 100kHz, writing a register will take about 300us.
It could be a bit slow for some components, but for some others it is quick enough.
I was working with an RTC (DS1307) and needed to display the time.
Using a classic LCD will waste 6 (or 10) pins of my Pic and a real I2C LCD was expensive enough
Then I decided to use an I2C GPIO (MCP 23008) from Microchip.
For me, the code customization with version 4 of Flowcode is very interesting cause all the code stays with your Flowchart.
On top of that, I wanted to use this new component identical to Matrix_Multimedia (with simulation).
End of chat.
TECHNICAL
For hardware the only rule is to respect the schematic given above ( close to the one given by Matrix M in the LCD help)
For the Software,
Choose your LCD as usual (2x16 , 4x20,…), the macros are identical (and simulable).
The supplementary thing is to add a I2C component and to add the macro I2C "Init" BEFORE the LCD init.
Note : I2C is only "Hardware" , the software mode is not supported (it could be).
Note2 : It is not necessary to provide a port for connection, if you leave "unconnected", when you compile, you will get 2 warnings which tell you "some components are not connected" but everything will go well.
Remarks :
- I have done the same thing with a PCF8574A and a real I2C LCD (BATRON BTHQ21605AV-YETF-LED04-I2C from Farnell , a little detail : the char set is not standard)
- You can do the same thing with the keyboard.
Daniel
PS : thanks for the feedback
INTRODUCTION
I2C bus is very interesting cause it needs only 2 lines of the micro-controller.
You can find lots of components (RTC, thermometer, Led dimmer, …).
The bus frequency is 100kHz, writing a register will take about 300us.
It could be a bit slow for some components, but for some others it is quick enough.
I was working with an RTC (DS1307) and needed to display the time.
Using a classic LCD will waste 6 (or 10) pins of my Pic and a real I2C LCD was expensive enough
Then I decided to use an I2C GPIO (MCP 23008) from Microchip.
For me, the code customization with version 4 of Flowcode is very interesting cause all the code stays with your Flowchart.
On top of that, I wanted to use this new component identical to Matrix_Multimedia (with simulation).
End of chat.
TECHNICAL
For hardware the only rule is to respect the schematic given above ( close to the one given by Matrix M in the LCD help)
For the Software,
Choose your LCD as usual (2x16 , 4x20,…), the macros are identical (and simulable).
The supplementary thing is to add a I2C component and to add the macro I2C "Init" BEFORE the LCD init.
Note : I2C is only "Hardware" , the software mode is not supported (it could be).
Note2 : It is not necessary to provide a port for connection, if you leave "unconnected", when you compile, you will get 2 warnings which tell you "some components are not connected" but everything will go well.
Remarks :
- I have done the same thing with a PCF8574A and a real I2C LCD (BATRON BTHQ21605AV-YETF-LED04-I2C from Farnell , a little detail : the char set is not standard)
- You can do the same thing with the keyboard.
Daniel
PS : thanks for the feedback
- Attachments
-
- I2C_LCD_mcp.fcc
- (9.6 KiB) Downloaded 1749 times
-
- I2C_LCD_mcp.fcf
- (28.62 KiB) Downloaded 2065 times
- Dan81
- Valued Contributor
- Posts: 268
- Joined: Sun Jan 15, 2006 4:07 pm
- Location: Albi France
- Been thanked: 60 times
- Contact:
Re: 3C : LCD I2C
Hello Bercioiu
The same flowchart as above but with a PCF8574A.
Daniel
The same flowchart as above but with a PCF8574A.
Daniel
- Attachments
-
- LCD-I2C-PCF8574a.fcf
- only tested with Proteus7.10
(not hard tested) - (29.97 KiB) Downloaded 1587 times
-
- Posts: 161
- Joined: Sun Feb 25, 2007 10:56 am
- Location: bucharest, romania
- Has thanked: 90 times
- Been thanked: 34 times
- Contact:
Re: 3C : LCD I2C
Thank you for the reply!
In the custom component I see a new macro "OUT7" how can I use that? It is for P7 on the pcf? If yes, how can I use that in the flowchart? And one more question: I see that PCF is a little different from MCP , in the PCF I didn`t see the reset pin, so, what modification have to make to your schematic if I want to use PCF instead MCP?
Thank you again!
In the custom component I see a new macro "OUT7" how can I use that? It is for P7 on the pcf? If yes, how can I use that in the flowchart? And one more question: I see that PCF is a little different from MCP , in the PCF I didn`t see the reset pin, so, what modification have to make to your schematic if I want to use PCF instead MCP?
Thank you again!
- Dan81
- Valued Contributor
- Posts: 268
- Joined: Sun Jan 15, 2006 4:07 pm
- Location: Albi France
- Been thanked: 60 times
- Contact:
Re: 3C : LCD I2C
Hello Bercioiu
It is (quite) the same schematic.
The macro "OUT7" was a project , it is empty (sorry).
Daniel
It is (quite) the same schematic.
The macro "OUT7" was a project , it is empty (sorry).
Daniel
-
- Posts: 161
- Joined: Sun Feb 25, 2007 10:56 am
- Location: bucharest, romania
- Has thanked: 90 times
- Been thanked: 34 times
- Contact:
Re: 3C : LCD I2C
Hi DAN!
First, thanks for your help so far!
I cant compile your file with LCD for PCF 8574 (LCD-I2C-PCF8574a-1.fcf), when I compile it return me the following errors:
What can I do to compile it?
Thanks!
L.E. I forgot to mention that I use Flowcode 5 with all updates (5.5.2.1).
First, thanks for your help so far!
I cant compile your file with LCD for PCF 8574 (LCD-I2C-PCF8574a-1.fcf), when I compile it return me the following errors:
Code: Select all
LCD-I2C-PCF8574a-1.c(145): Illegal symbol name: %
LCD-I2C-PCF8574a-1.c(146): Illegal symbol name: %
LCD-I2C-PCF8574a-1.c(147): Illegal symbol name: %
LCD-I2C-PCF8574a-1.c(148): Illegal symbol name: %
LCD-I2C-PCF8574a-1.c(149): Illegal symbol name: %
LCD-I2C-PCF8574a-1.c(150): Illegal symbol name: %
LCD-I2C-PCF8574a-1.c(151): Illegal symbol name: %
LCD-I2C-PCF8574a-1.c(152): Illegal symbol name: %
LCD-I2C-PCF8574a-1.c(153): Illegal symbol name: %
LCD-I2C-PCF8574a-1.c(154): Illegal symbol name: %
LCD-I2C-PCF8574a-1.c(155): Illegal symbol name: %
LCD-I2C-PCF8574a-1.c(156): Illegal symbol name: %
LCD-I2C-PCF8574a-1.c(157): Illegal symbol name: %
LCD-I2C-PCF8574a-1.c(158): Illegal symbol name: %
LCD-I2C-PCF8574a-1.c(159): Illegal symbol name: %
LCD-I2C-PCF8574a-1.c(160): Illegal symbol name: %
LCD-I2C-PCF8574a-1.c(161): Illegal symbol name: %
LCD-I2C-PCF8574a-1.c(162): Illegal symbol name: %
LCD-I2C-PCF8574a-1.c(163): Illegal symbol name: %
LCD-I2C-PCF8574a-1.c(164): Illegal symbol name: %
LCD-I2C-PCF8574a-1.c(168): Illegal symbol name: %
LCD-I2C-PCF8574a-1.c(169): Illegal symbol name: %
LCD-I2C-PCF8574a-1.c(177): Illegal symbol name: %
LCD-I2C-PCF8574a-1.c(224): Illegal symbol name: 3
LCD-I2C-PCF8574a-1.c(225): Illegal symbol name: 3
LCD-I2C-PCF8574a-1.c(226): Illegal symbol name: 3
LCD-I2C-PCF8574a-1.c(227): Illegal symbol name: 3
LCD-I2C-PCF8574a-1.c(228): Illegal symbol name: 3
LCD-I2C-PCF8574a-1.c(229): Illegal symbol name: 3
LCD-I2C-PCF8574a-1.c(230): Illegal symbol name: 3
LCD-I2C-PCF8574a-1.c(231): Illegal symbol name: 3
LCD-I2C-PCF8574a-1.c(233): Illegal symbol name: 3
LCD-I2C-PCF8574a-1.c(234): Illegal symbol name: 3
LCD-I2C-PCF8574a-1.c(235): Illegal symbol name: 3
LCD-I2C-PCF8574a-1.c(236): Illegal symbol name: 3
LCD-I2C-PCF8574a-1.c(237): Illegal symbol name: 3
36 errors detected
Error: preprocessing error
failure
Thanks!
L.E. I forgot to mention that I use Flowcode 5 with all updates (5.5.2.1).
-
- Posts: 161
- Joined: Sun Feb 25, 2007 10:56 am
- Location: bucharest, romania
- Has thanked: 90 times
- Been thanked: 34 times
- Contact:
Re: 3C : LCD I2C
There is a way to modify this custom code for Flowcode V5 ? What is the different between V4 and V5?
Thank you anyway!
Thank you anyway!
Re: 3C : LCD I2C
Hello Dan81,
I try to complie the code with flowcode V5 but it not work, do you have one for it ?
I try it with flowcode V4 and i it work perfectly.
Thanks
I try to complie the code with flowcode V5 but it not work, do you have one for it ?
I try it with flowcode V4 and i it work perfectly.
Thanks
Re: 3C : LCD I2C
Dan81 wrote:Hello Bercioiu
The same flowchart as above but with a PCF8574A.
Daniel
Hello Dan. I'm trying to control i2c LCD with PCF8574 but on Atmel AVR (atmega168) MCU.
I managed to open LCD-I2C-PCF8574a.fcf in Flowcode AVR 5.3 to see basic commands. I realized the main substance of "code" but there is one thing that I don't understand at all.
Physical Connection of LCD ?! That LCD (your is 20x4 and mine is 16x2, anyway standard) should be connected to I2C pins of MCU, ( in my case those are 27-SDA and 28-SCL), Vcc and GND, 4 wire total, and as far I understand those should be the only 4 pins used for LCD. I have 4 pin IDC connector for i2c with those 4.
But when I opened LCD-I2C-PCF8574a.fcf under LCD connections I saw that almost entire PORT B is used ?!
From PB0-PB3 for data bits of lcd and PB4-RS and PB5-EN.
During Simulation I see on "view chip" that states of those pins are being changed from LOW to HI, randomly.
Question is What to do with those ?? I need those pins of PORT B for something else, those are my "inputs on plc board" and I can't allow their state to change without any signal on real inputs, I need those pins completely free from lcd controll .
If I "remove" those connection of LCD to Port B in Flowcode I get warnings and error during compile?

I have not made any real hardware for LCD yet, until i get anything logical in simulation , main MCU board is finished and tested for everything else except I2C communication to others "slaves"
// sorry bcs my probably bad english
- Dan81
- Valued Contributor
- Posts: 268
- Joined: Sun Jan 15, 2006 4:07 pm
- Location: Albi France
- Been thanked: 60 times
- Contact:
Re: 3C : LCD I2C
Hello Milek
Customisation was made for Flowcode v4 (different with Flowcode v5).
Connections to portB are not really made (it is a I2C bus) .
You can move connections to "unconnected" and the compilation will be OK with Flowcode4.
If you can manage a LCD with C code, it is enough easy to manage it through a PCF (but a bit long !) .
Moving the code to Flowcode5 is not useful because Flowcode6 is the current version.
Sorry
Daniel
Customisation was made for Flowcode v4 (different with Flowcode v5).
Connections to portB are not really made (it is a I2C bus) .
You can move connections to "unconnected" and the compilation will be OK with Flowcode4.
If you can manage a LCD with C code, it is enough easy to manage it through a PCF (but a bit long !) .
Moving the code to Flowcode5 is not useful because Flowcode6 is the current version.
Sorry
Daniel
Re: 3C : LCD I2C
Hi Dan.
So does it mean that if I open FC, chose my MCU target (mega168) and make exactly same Flowcode diagram like yours, completely from scratch but in FC V5.3 it will not work because such a diagram is intended for V4 and same one goes bad in v5? I did that already and simulation works ok, LCD writes all those stuff from diagram, numbers, letters, characters, it compiles to C (with warning about LCD unconnected ) but not in .hex
I don't understand? Is it not the same in recent versions, that for example some block like "calculation", or "decision" are different in V4 and V5? Problem for me is that I don't understand #C, that's why I'm using FC ( also pretty hard to get around with it ) to program something "simple" by drawing diagrams.
Is there any other simple solution how to make my i2c LCD to work in V5, but w/o moving to V6 ?
If there is a new version of some SW (like in this case FC-V6) than the previous one should not just get obsolete easy like that? Ok, I know, it's "easy" to work in FC for some simple task, but when there is a problem like "how to control i2c LCD" there is no any specific tutorial about that, help file is unusable for that. There no any webpage here, or tutorial where I can simply see do this, this and this and it will work? thanks and sorry to bothering you.
So does it mean that if I open FC, chose my MCU target (mega168) and make exactly same Flowcode diagram like yours, completely from scratch but in FC V5.3 it will not work because such a diagram is intended for V4 and same one goes bad in v5? I did that already and simulation works ok, LCD writes all those stuff from diagram, numbers, letters, characters, it compiles to C (with warning about LCD unconnected ) but not in .hex
I don't understand? Is it not the same in recent versions, that for example some block like "calculation", or "decision" are different in V4 and V5? Problem for me is that I don't understand #C, that's why I'm using FC ( also pretty hard to get around with it ) to program something "simple" by drawing diagrams.
Is there any other simple solution how to make my i2c LCD to work in V5, but w/o moving to V6 ?

If there is a new version of some SW (like in this case FC-V6) than the previous one should not just get obsolete easy like that? Ok, I know, it's "easy" to work in FC for some simple task, but when there is a problem like "how to control i2c LCD" there is no any specific tutorial about that, help file is unusable for that. There no any webpage here, or tutorial where I can simply see do this, this and this and it will work? thanks and sorry to bothering you.
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: 3C : LCD I2C
Hello,
If you look in the I2C component help file for v5 then there is information about how to use the I2C bus and how to read / write data.
There should also be a page on Wikipedia regarding I2C which should provide some insight on the protocol.
I2C is a fairly simple protocol so once you get the basics it should be possible to talk to just about any I2C device using the same principals.
I hope you can appreciate that we cannot write specific tutorials for all of the millions of different devices out there. If you want to document how you get on then this would be great and would potentially help out other users in a similar situation.
If you look in the I2C component help file for v5 then there is information about how to use the I2C bus and how to read / write data.
There should also be a page on Wikipedia regarding I2C which should provide some insight on the protocol.
I2C is a fairly simple protocol so once you get the basics it should be possible to talk to just about any I2C device using the same principals.
I hope you can appreciate that we cannot write specific tutorials for all of the millions of different devices out there. If you want to document how you get on then this would be great and would potentially help out other users in a similar situation.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Re: 3C : LCD I2C
hello Benj
I2C component help file was first thing to look. But...for someone who works as anesthesiologist in hospital it doesn't help me a lot...
electronics is something that interests me a side, and i don't have that much knowledge. For me it was a great success even to make PCB!
I have build some mcu projects before but only those where I found finished .hex and I was interested to learn how to program something that I could use around my house, in garage, just anything, C was the problem, nooo way I could learn that easy, but making something by "drawing diagram" sounds as great solution!
I understand that i2c use two wires for communication, an that's practically all.
"
Sending Data
Output a start condition //Starts the device listening to the I²C bus.
Transmit the External Device address with the LSB cleared. //Enables the device and sets to write mode.
Transmit the Internal address. //Sets the address to start writing data to.
Transmit a byte of data. //Device will acknowledge and increment internal address until page limit is reached
....
Transmit a byte of data. //Device will acknowledge and increment internal address until page limit is reached
Output a stop condition //Stops the device listening to the I²C bus.
Alternatively use the Send_Byte_Transaction macro.
This part of help file doesn't tell me anything, i see it's "example" for some memory chip but any way i don't know what to do with that, what blocks in diagram i have to use, where to put those and how to set all features.
I made one diagram based on Dan81 example.
Result: Simulation-ok , LCD ( in simulation ) show what i wanted to see, simple word "text" and then characters behind. Compile to C-OK, compile to .hex-OK Problem: as in my first comment i saw that states of pins on POrtB are being changed (view chip) , Dan said "Connections to portB are not really made" but i just sent hex to mcu and because i have some LED's attached to PortB i see they are blinking, ( I didn't made i2c board with that 8574 chip until i get something that could work ) so connections to portB are really made. If disconnect LCD from portB (in flowcode), simulation still work but with warning about unconnected device, compile to C-ok, compile to .hex doesn't work.
I'm really desperate about this. I understand it should be probably easy but for someone who understands the issues and I'm not in this story.
I wanted to attach that diagram files but it's on my home pc but i saved some *screen shoots* on my flash drive,
These days I'm on duty in hospital so I will not be able to deal with fc until I get back to home town.
sorry because long text, sorry because probably "tips&tricks" is wrong places to write all this.
I2C component help file was first thing to look. But...for someone who works as anesthesiologist in hospital it doesn't help me a lot...


I understand that i2c use two wires for communication, an that's practically all.
"
Sending Data
Output a start condition //Starts the device listening to the I²C bus.
Transmit the External Device address with the LSB cleared. //Enables the device and sets to write mode.
Transmit the Internal address. //Sets the address to start writing data to.
Transmit a byte of data. //Device will acknowledge and increment internal address until page limit is reached
....
Transmit a byte of data. //Device will acknowledge and increment internal address until page limit is reached
Output a stop condition //Stops the device listening to the I²C bus.
Alternatively use the Send_Byte_Transaction macro.
This part of help file doesn't tell me anything, i see it's "example" for some memory chip but any way i don't know what to do with that, what blocks in diagram i have to use, where to put those and how to set all features.
I made one diagram based on Dan81 example.
Result: Simulation-ok , LCD ( in simulation ) show what i wanted to see, simple word "text" and then characters behind. Compile to C-OK, compile to .hex-OK Problem: as in my first comment i saw that states of pins on POrtB are being changed (view chip) , Dan said "Connections to portB are not really made" but i just sent hex to mcu and because i have some LED's attached to PortB i see they are blinking, ( I didn't made i2c board with that 8574 chip until i get something that could work ) so connections to portB are really made. If disconnect LCD from portB (in flowcode), simulation still work but with warning about unconnected device, compile to C-ok, compile to .hex doesn't work.
I'm really desperate about this. I understand it should be probably easy but for someone who understands the issues and I'm not in this story.

I wanted to attach that diagram files but it's on my home pc but i saved some *screen shoots* on my flash drive,
These days I'm on duty in hospital so I will not be able to deal with fc until I get back to home town.
sorry because long text, sorry because probably "tips&tricks" is wrong places to write all this.

- Attachments
-
- I put together three screen shoots into one image
- 1slika.jpg (401.39 KiB) Viewed 44910 times
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: 3C : LCD I2C
Hello Mike,
Sorry for the delay, could you attach your program so we can have a look at the compilation errors? What version of Flowcode are you using?
Sorry for the delay, could you attach your program so we can have a look at the compilation errors? What version of Flowcode are you using?
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
- Dan81
- Valued Contributor
- Posts: 268
- Joined: Sun Jan 15, 2006 4:07 pm
- Location: Albi France
- Been thanked: 60 times
- Contact:
Re: 3C : LCD I2C
Hello Milek
I've modified the flowchart for AVR and Flowcode5.
It seems to be OK in simulation , but I can't test it in real .
You will have to modify the chip configuration and quartz frequency.
Daniel
I've modified the flowchart for AVR and Flowcode5.
It seems to be OK in simulation , but I can't test it in real .
You will have to modify the chip configuration and quartz frequency.
Daniel
- Attachments
-
- I2C_LCD_pcf_FC5_Avr.fcf_avr
- not Hard tested
- (30.8 KiB) Downloaded 1121 times
Re: 3C : LCD I2C
hello Dan81.
It was some time ago since I visited this forum (and used FC at all) last time and i was happy to see the answer
I have tried simulation and build hex, both works now, on pc and hex is generated, but my problem also is hardware check, the wiring of my pcb it's not same as matrix multimedia lcd and little schematic you have posted earlier in this thread.
address 0x20=Ok, connections for data bus d4-d7 lines=OK, RS pin of lcd=OK, but my RW is connected to p5 and EN of lcd to p6, backlight to P7 (npn transistor)
i just need information where in custom code to find that part where i can change order of connection between PCF and LCD because my pcf8574 is smd chip and i have no any other way to make changes except in code. cutting my pcb traces and soldering wires arround doesn't look as option.
chip configuration and quartz frequency , no problem ,they are already same
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
EDIT: TODAY i took my pcb and looked around , changes on board were minimal so I have decided to make them.
now connections are same,
PCF-LCD
-----------
PO--D4
P1 --D5
P2 --D6
P3 --D7
P4 --RS
P5 --En
backlight is ON because it's connected to Vcc and gnd.
a2,a1,a2 are all tied to GND so address is 0x20, everything ( I think) as it should be but something is not OK. on my LCD just after power up first row of 16 is filled like in picture attached (it's not my picture, i have just find it on internet because it's same issue as mine)
It was some time ago since I visited this forum (and used FC at all) last time and i was happy to see the answer

I have tried simulation and build hex, both works now, on pc and hex is generated, but my problem also is hardware check, the wiring of my pcb it's not same as matrix multimedia lcd and little schematic you have posted earlier in this thread.
address 0x20=Ok, connections for data bus d4-d7 lines=OK, RS pin of lcd=OK, but my RW is connected to p5 and EN of lcd to p6, backlight to P7 (npn transistor)
i just need information where in custom code to find that part where i can change order of connection between PCF and LCD because my pcf8574 is smd chip and i have no any other way to make changes except in code. cutting my pcb traces and soldering wires arround doesn't look as option.
chip configuration and quartz frequency , no problem ,they are already same

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
EDIT: TODAY i took my pcb and looked around , changes on board were minimal so I have decided to make them.
now connections are same,
PCF-LCD
-----------
PO--D4
P1 --D5
P2 --D6
P3 --D7
P4 --RS
P5 --En
backlight is ON because it's connected to Vcc and gnd.
a2,a1,a2 are all tied to GND so address is 0x20, everything ( I think) as it should be but something is not OK. on my LCD just after power up first row of 16 is filled like in picture attached (it's not my picture, i have just find it on internet because it's same issue as mine)
- Attachments
-
- kvadratici LCD.jpg
- (50.62 KiB) Downloaded 28187 times
- Dan81
- Valued Contributor
- Posts: 268
- Joined: Sun Jan 15, 2006 4:07 pm
- Location: Albi France
- Been thanked: 60 times
- Contact:
Re: 3C : LCD I2C
Hello Milek
Have you put pull up resistors on clock and data lines ?
Which hardware are you using ?
Daniel
Have you put pull up resistors on clock and data lines ?
Which hardware are you using ?
Daniel
Re: 3C : LCD I2C
Check the requirements of the contrast pin3.
For other LCD's I have used the wiring pin3 direct to the supply pins will often not work.
Place a 10k preset between +5 and GND and take the wiper to pin3. As you adjust the setting it should go from all pixel black to a blank display, and somewhere in between the characters 'may' burst into view.
For other LCD's I have used the wiring pin3 direct to the supply pins will often not work.
Place a 10k preset between +5 and GND and take the wiper to pin3. As you adjust the setting it should go from all pixel black to a blank display, and somewhere in between the characters 'may' burst into view.
Re: 3C : LCD I2C
Yeap, there are pull-up on scl and sda but 3,9k, i hope it's fine bcs i don't have higher values at this moment but there are still pull-up's, maybe i could add to them one more in series to get 7k8 for both data lines?Dan81 wrote:Hello Milek
Have you put pull up resistors on clock and data lines ?
Which hardware are you using ?
Daniel
I'm using my own design, a board with ATmega168 ( internal 8mhz). Everything else (mostly very simple stuff) i have tried on that board is working except i don't know how to use i2c

I was also looking for some finished hex code for atmega 168 (or atmega8) just to burn it to mcu and check is my pcf8574 board is ok at all and i have found this http://mmdolze.users.sourceforge.net/us ... h-twi.html it has same wiring except back light where mine is npn transistor and not pnp BUT there is no hex included and i can't get it no chance.

I thought of it so that part is 100% ok, i have some other board with tiny2313 programmed just to scroll text around on LCD (standard 4b parallel connection) and contrast on pin3 is adjusted to be ok. Then I switch my lcd to PCB With 8574 and get those square like from picture above but they are visible because i set same value of POT on both boards.KevinH wrote:Check the requirements of the contrast pin3.
For other LCD's I have used the wiring pin3 direct to the supply pins will often not work.
Place a 10k preset between +5 and GND and take the wiper to pin3. As you adjust the setting it should go from all pixel black to a blank display, and somewhere in between the characters 'may' burst into view.
Re: 3C : LCD I2C
First I'm very new to Flowcode so am using this as part of my learning how programs are constructed, so I'm of little help here! BUT, I now recall having a similar problem with an LCD many years ago (Using STE bus and Arcom Basic) which I eventually located as the LCD's power up/ reset time. The issue was the LCD was taking greater than 1 second to initialise, so was ignoring my my set-up codes during this time.
Try an initial delay of say 2 seconds and see if this helps, if it does gradually reduce it until it faults and choose a reliable delay greater than this.
The other delay that others have reported as an issue is the pulse on the 'E' line which seems to require some 10mS, however I can't recall having this issue, but did 'play' with many delay values to get things right.
The simulation would not find this type of issue, so there is hope.....
Try an initial delay of say 2 seconds and see if this helps, if it does gradually reduce it until it faults and choose a reliable delay greater than this.
The other delay that others have reported as an issue is the pulse on the 'E' line which seems to require some 10mS, however I can't recall having this issue, but did 'play' with many delay values to get things right.
The simulation would not find this type of issue, so there is hope.....
Re: 3C : LCD I2C
Dan81, I was just looking your last FC diagram and under LCD component/ custom code / component macros
Defines, RawSend (there is one more RawSend below ?), Start, Clear, Enable_pulse and Backlight are true (customized) and further under:
Start /Edit code I see there are lines of Wdt_delay_ms() ?
As i remember My WDT fuse bit is not ON
i need WDT turned on to get this (maybe) working, right ?
I would try that right now but my isp programmer is at my home, not close, so i just asking at least to know is that possible issue?
Defines, RawSend (there is one more RawSend below ?), Start, Clear, Enable_pulse and Backlight are true (customized) and further under:
Start /Edit code I see there are lines of Wdt_delay_ms() ?
As i remember My WDT fuse bit is not ON

I would try that right now but my isp programmer is at my home, not close, so i just asking at least to know is that possible issue?