CharLCD_I2C Component interface for PCF8574AT / HD44780 Combo

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
MiBe_1380881
Level 4
Level 4
10 likes received First like received

The CharLCD_I2C component provides an interface with the PCF8574AT I2C PC Board connected to the Industry Standard HD44780 LCD  Controller (running in 4-bit mode) using only 2 I/O pins, SDA and SCL pins. The CharLCD_I2C component requires an I2C Master component to provide the I/O. For the PSoC 4 use the I2C (SBC mode)[v3.2] Master Component. For the PSoC 3 and PSoC 5 use the I2C Master (Fixed Function)[v3.50] Component. The instance name of the I2C Master Component needs to be  I2C_ 'instance name of the CharLCD_I2C component'. It has been tested and works with the PSoC 3, PSoC 4 and the PSoC 5 provided with the C8YC KIT-001.

0 Likes
1 Solution
lock attach
Attachments are accessible only for community members.
MiBe_1380881
Level 4
Level 4
10 likes received First like received

CharLCD_IC2 component Version 1.2 to correct a few typing errors of the PDF file and a statement in the CharLDC.c file that did not produce a compiler error. Sorry for any inconvenience.

View solution in original post

0 Likes
29 Replies
lock attach
Attachments are accessible only for community members.
MiBe_1380881
Level 4
Level 4
10 likes received First like received

CharLCD_IC2 component version 1.1 update. The While Loop statements /* Waits for Master to Complete Transfer */ were removed because it produces an endless loop if the I/O pins of the PSoC are not connected to the LCD. The PCF 8574AT PC Board and HD44780 combo are available on eBay for as little as 3 dollars.

0 Likes
lock attach
Attachments are accessible only for community members.
MiBe_1380881
Level 4
Level 4
10 likes received First like received

CharLCD_IC2 component Version 1.2 to correct a few typing errors of the PDF file and a statement in the CharLDC.c file that did not produce a compiler error. Sorry for any inconvenience.

0 Likes
odissey1
Level 9
Level 9
First comment on KBA 1000 replies posted 750 replies posted

Thank you for sharing. Nice datasheet also.

0 Likes
lock attach
Attachments are accessible only for community members.
MiBe_1380881
Level 4
Level 4
10 likes received First like received

CharLCD_IC2 v1.4 component update to interface with the PCF8574A I2C Adapter PC board connected to the HD44780 Contoller. I have changed the generated API file names at build so there is no conflict with other generated LCD Display component API's such as the Charter LCD or the CharLCDmp component if for some reason they are included in the same project.

   

I have included additional documentation on how the Slave Address can be changed for the PCF8574/PCF8574A chip if it becomes necessary. At this time the PCF8574A PC boards available on eBay are using the 7 bit Slave Address 0x3F which is the default address for the CharLCD_I2C component.

   

I have been using the PSoC4 28 SSOP package for my project and have been able to keep my pin count down , simplify my PC board layout and able to connect to the LCD with a simple 4 wire connecter. My project is being used in small RC devices and the PCF8574A/HD44780 LCD combo is removed after the variables of my project are programmed. The 3 dollar price for the LCD combo is also a significant cost savings.

0 Likes
MiBe_1380881
Level 4
Level 4
10 likes received First like received

CharLCD_IC2 v1.5 component upgrade for minor changes of the Slave Address section of the Datasheet and the beginning Comment Section of the generated API files.  There should be no other upgrades unless I can determine a way of customizing the component to include a way to input for the 7 Bit Slave Address and Instance Name of the I2C Master Component. Sorry for so may upgrades and any inconvenience it may have caused.

0 Likes
lock attach
Attachments are accessible only for community members.
MiBe_1380881
Level 4
Level 4
10 likes received First like received

CharLCD_I2C v1.5 upgrade

0 Likes
lock attach
Attachments are accessible only for community members.
MiBe_1380881
Level 4
Level 4
10 likes received First like received

Changed the Component Catalog Tab name from "MyLib" to "Component". Also, remember to Start the I2C Master component before starting the CharLCD_I2C component in the main.c file.

0 Likes
lock attach
Attachments are accessible only for community members.
MiBe_1380881
Level 4
Level 4
10 likes received First like received

Changed the Command Delay in the CharLCD_I2C.h file from 1.5msec to 2.0msec so the ClearDisplay API command works properly with the HD44780 controller.

0 Likes
WoKi_264666
Level 3
Level 3
First like received

Hello Michael,

   

thank you for sharing this nice program! But I miss a little "demo", for user's comfort.

   

Anyway, I have edited a lot of lines, then I was successful and could see the result on a 16 x 2 Display, with CY8CKIT-059.

   

Best regards, Wolfgang (DH1AKF)

0 Likes
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

Hi guys. I was probing the component in the PSOC 5LP. I have some problems when I build the project, I guess is because of the version of the PSOC. How can I make it work in the PSOC 5LP? The error I get is relating a missing I2C_CharLCD.h and I2C_CharLCD_PVT.h.  I attached the bundle and the images that show the error. I'll appreciate the help. 

   

Thanks.

   

   

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Can you please post your complete project, so that we all can have a look at all of your settings. To do so, use
Creator->File->Create Workspace Bundle (minimal)
and attach the resulting file. I can only guess that you did forget to put the required component onto your topdesign.

   

 

   

Bob

0 Likes
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

Hi! In the tab component in the workspace explorer I clicked on Import Component/Import from project/library and then select the CharLCD. I don't know if that's the correct way to do it or there's something else I forgot to do. I attached the workspace bundle. 

   

Thanks!

0 Likes
lock attach
Attachments are accessible only for community members.
WoKi_264666
Level 3
Level 3
First like received

Hi,

   

here I bring you a little example for CY8CKIT-059 with PSoC5LP, interfaced with I²C to a 4*20 LCD.
The example is an excerpt of an ongoing bigger project, but you can see the function also without the full periphery.
You can easily modify the program to satisfy your needs.

   

Best regards, Wolfgang (DH1AKF)

MiBe_1380881
Level 4
Level 4
10 likes received First like received

Please carefully read under the General Description of the Component Datasheet which describes what I2C Master Component that one has to choose to work with The CharLCD_I2C Component both for the PSoC5LP and the PSoC4 chips. For the PSoC 4 use the I2C (SBC mode)[v3.2] Component set to Master Mode. For the PSoC 3 and PSoC 5LP use the I2C Master(Fixed Function)[v3.50] Component. Also, it describes how the I2C Master and CharLCD_I2C components instance's names need to be chosen. This will prevent compiling errors when building a project. I will Up Load an Example Project for The PSoC5LP and the PSoC4 using the CharLCD_I2C component and an I2C Master. Please down the latest version v1.5 of the CharLCD_I2C component.

0 Likes
MiBe_1380881
Level 4
Level 4
10 likes received First like received

PROTOCOL for INSTANCE NAMING of the CharLCD_I2C Component and the I2C Master Component. First determine the Instance Name of the CharLCD_I2C component, for example if the instance name is XYZ_1, then the Instance name of the I2C Master MUST to be I2C_XYZ_1. If the Instance Name of the CharLCD_I2C component is CharLCD then the Instance Name of the I2C Master MUST be I2C_CharLCD. This is because the CharLDC_IC2 Component  has to interface with 2 Header files of the I2C Master  in order for the MasterWriteBuf statement to function properly. The 2 necessary H files of the I2C Master Component for the PSoC4 and  PSoC5LP have different Instance Names. The C file of the CharLCD_I2 Component will take this into account with out having to reprogram any of the statements of the C file if the above Protocol is followed.

   

Good Luck, Mike

0 Likes
lock attach
Attachments are accessible only for community members.
MiBe_1380881
Level 4
Level 4
10 likes received First like received

I have Several Example Projects that can be downloaded for the PSoC3, PSoC4 and PSoC5LP using the CharLCD_I2C Component and the appropriate I2C Master Component. Also please download an updated CharLCD_I2C Component v1.5. I have included important new information in the DataSheet on page 1 so building errors should not occur. Editing of the C file should not be necessary.  I added two pages with instruction on how to Load Community Components to your projects. I used the CY8CKIT-001 to test the example projects.

   

Good Luck

   

Mike

lock attach
Attachments are accessible only for community members.
MiBe_1380881
Level 4
Level 4
10 likes received First like received

I am making the CharLCD_I2C Data Sheet PDF file available for download hopefully with all of the typo's corrected.

   

Mike

lock attach
Attachments are accessible only for community members.
MiBe_1380881
Level 4
Level 4
10 likes received First like received

I have a Example Project for the CharLCD_I2C component using the CY8CKIT-059.

MiBe_1380881
Level 4
Level 4
10 likes received First like received

IMPORTANT: After unzipping CharLCD_I2C_v1_5.cylib it is necessary to rename the Main Folder CharLCD_I2C_v1_5.cylib to  CharLCD_I2C.cylib or else a error message will occur stating, "A project must reside in a directory of the same name." when loading the CharLCD_I2C component. I have corrected the problem in the current CharLCD_I2C_v1_5.zip file. So sorry for such a careless mistake and any wasted time.

0 Likes
lock attach
Attachments are accessible only for community members.
MiBe_1380881
Level 4
Level 4
10 likes received First like received

CharLCD_I2C Custom Component

   

This is rhe corrected Download. I have tested it and does not generate any errors.

   

Mike

0 Likes
lock attach
Attachments are accessible only for community members.
MiBe_1380881
Level 4
Level 4
10 likes received First like received

Above is the Download for the Datasheet and this is the Download for the corrected CharLCD_I2C_v1_5.cylib.zip file.

Anonymous
Not applicable

It's so wonderful!
My LCD1602 with a backpack(PCF8574) which is previously used for an Arduino works completely with PSoC 5LP!

   

Thank you for your great work.

0 Likes

Hi Mike,

Don't know if you're still monitoring this thread.  I've been trying to get my PCF8574T based I2C/LCD to work with your code.  It is a generic 1602 display with the cheap-o addon boards.  All this is running on a CY8CKIT-059.

The code all compiles and I have set the device name to CHARLCD and am using the master mode as specified.  In that mode the I2C is either figuring out what port things are running on or is using some default.  I am using the generic board untouched for I2C so there are no jumpers on A0 A1 A2.  I presume this is 0x27.  The I2C is set up as SDA=P12(4) and SCL=P12(3).

So everything builds and runs, except there is no output from the LCD.

I've tried everything I can think of and I've run out of ideas.

Rich

I tried to attach the bundle but am told that it's forbidden.

0 Likes
Anonymous
Not applicable

Try to poll the device till you find the address. Have you changed the slave address in the CharLCD_I2C.h file?

I used:-

      i=0xFF;

         do{

            i--;

           

        result=I2C_1_MasterSendStart(i, I2C_1_WRITE_XFER_MODE);

        I2C_1_MasterSendStop();

        CyDelay(100);

       

        if (result==0)

        {

            sprintf(str,"\r\n Ping reply %d",i);

        UART_1_PutString(str);

       

        }

0 Likes
Anonymous
Not applicable

Amazing! Amazing! Amazing! You just saved me hours(days) of work. Thanks a billion for this component, it works like a charm.

Just one thing though. The slave address has to be manually configured in the CharLCD_I2C.h file. Personally I would like to enter it somewhere as a variable in my .c files instead of keeping it defined in a Macro. The issue is that whenever I do a "Clean and Build", it reverts to the default slave address and I am left hunting for what wen wrong.. again.

I'd love to edit the component and add a "CharLCD_SetSlaveAddress()" function but I don't have the first idea how. Any suggestions?

0 Likes
Anonymous
Not applicable

Now I have been playing around with this component for a few days and I have noticed quite a few hiccups.

1. I tried changing the Slave Address to an "extern int8" but then the compiler gave errors saying CharLCD_I2C_SLAVE_ADDR not defined.

2. When using a DS1307 RTC clock and CharLCD_I2C together, I have to stop & start I2C everytime I need to shift from one device to another.

3. Seems like if I try to call the component from within an interrupt, it does not work at all. For now it only works in main.

I don't know if any of this is due to my stupidity or something you missed but I think it's best if you know of this.

I guess I'll have to adapt your code into my own functions to make this work. Still thanks a billion for this component.

0 Likes

Mike,

Some time ago I was struggling to get my CY8CKIT-059 working with a 1602 generic LCD display and an eBay PCF8574 backpack board.

I've tried several of the sample projects, installed the CharLCD 1.5 library and I'm still stymied.

Do the SCL/SDA pull-ups have to be discrete resistors or can I use the port supplied pullups?

I'm using the -059 ports P12_0/P12_1 respectively, should I be using any other port pins for this?

I've added the 'eBay' address as defined in the datasheet.

Essentially, it just sits there and does nothing.  It has been a while since I tried to work with this and I can't recall whether I've seen the display/backpack board work together.

Any suggestions on other things I can try?

Rich

0 Likes

Looks like v1.5  fr0m 2017 ended up in the community code examples...
Here is Mike's v2.1  from May 19, 2018

CharLCD_I2C interface for PSoc3, 4 and 5LP using 2 i/o pins with the PCF8574AT-HD44780 Combo designe...

0 Likes
PaGy_1246781
Level 2
Level 2
5 replies posted 5 questions asked First like received

Hi Michael,

Thanks for creating and publishing the component.  I do have a question about the I2C master.

The data sheet says that, for a PSoC 5 device, use the I2C Master (Fixed Function) component.  My fixed function I2C is already being used as a slave.  So far, the project has built OK using the UDB I2C master, but I don't have the LCD module yet to test it.

Would the UDB I2C Master also work, or must it be the fixed function I2C?

Paul

0 Likes