Using a display with PCF8574A interface (Address 0x27) everything correctly works . Can you help me understand the problem?
Ps. all displays work on Arduino programmed with Arduino IDE:
Greetings.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I had already tried with "#define LCD_I2C_Address 0x4E" "#define LCD_I2C_Address 0x27" "#define LCD_I2C_Address 0x37" but it does not work, furthermore the address of the PCF8574AT is 0x3F should be in binary 0100111 as I also see on oscilloscope.
Excuse my ignorance but what is I2c discovery?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I noticed that #define LCD_I2C_Address "...." has no effect in the program, even if you set incorrect Address values, if I use PCF8574T it always works.
With PCF8574AT I tried all the values in the table but it does not work
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I know you said Arduino code worked but I want to start at first principles as the Arduino library may or may not comply with the protocol.
Questions.
1. Do you have pull-up resistors? I cannot tell from the scope JPG as this picture does not show a sustained HIGH state. You should have a pull-up resistor for SDA and SCL lines.
2. You are using software I2C. Why?
3. The Discovery is failing. You should not all those devices - just the ones attached. So, we need to figure out what is happening with this first. Please ignore the LCD until we have discovery working. I am assuming you took a demo and adapted for 18f45k22. Correct?
4. Post a foto of your LCD device please. Is this an LCD_IO 10 or LCD_IO 12 device? You have assummed a #10 . Why? But., let us get I2C Discover working first.
5. Attached your ASM from the 866 LCD code please. I want to review.
I will pull at 886 and hook up an LCD now. I can think of no reason why this is not working.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
You have a complete mixed up piece of code.
1. There are two headers sections.
2. code for sections for the arduino
3. Hardware I2C2 - second channel
Let us start with the basic question. Tell me what hardware and the chip you have and any ports constraints please (ie what ports can you not move with respect to I2C).
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The lcd has a ucontroller to convert it to i2c from the photo. Is it set to 8 or 4 bit for lcd and any set up stuff relevant to the "i2c to parallel converter"
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I used a MCP23017 for stepper motors, I didn't leave the pins floating. I'm following this as I have some parallel displays and thinking how to convert to i2c or serial. with some expanders or shift registers.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
@Renzo. I have number the questions so you can answer the specific questions.
1) What is the state of play? You have posted a confusing message. You got I2C discovery to work ? This is a YES or NO answer.
2) Then, you post the following asking a question:
The result is:
7E 01111110 = 0x3F
4E 01001110 = 0x27
it's correct?
You post pictures of 0x4e and 0x7e without any explanation. Did you change something? or, did you get this result when rerunning the program? Very confusing.
3 ) Then, you post some code in the post that commences with
I'm sorry, the setting code has been pasted twice, now I'm attaching the real part.
HWI2C2_Discovery_for_16F1829 @ 32 modified for 18F45K22
Is this the code that works? I think not. Please confirm.
4) Let me assume that the operation code I posted is the code you got working. A few points. i) This uses I2C, the first I2C channel within the microcontroller, you tried using I2C2. Why? ii) I used hardware serial. You used software serial why? What am I missing in your choices?
5) Thank you for the ASM. This told me the version of the compiler. The first line of the ASM file shows the version number.
;Program compiled by Great Cow BASIC (0.98.01 2017-10-27)
6) Can we sort out these questions before we jump to the LCD? I have no idea what the I2C is and how to explain what is going on as I am confused.
Anobium
@Stan - please let me complete the root cause analysis before we start trying to sort the LCD. We need to get the basics correct first.
Last edit: Anobium 2018-02-10
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
3)The correct code to detect the addresses is:
"i2cHardwareDiscovery to Terminal_18F26K22"
I only changed the initial configuration with "#chip 18F45K22,4".
4)Now I'm using HI2CMode and it works.
I'm sorry I messed up but I'm new with PIC programming
plus my English is very poor.
Thanks for the infinite patience
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
OK. Sounds like you have I2C abd Serial working. The LCD address is whatever is displayed on the Discovery program. These are 8-bit addreses. If you change the address of the slave device via pullups/pulldown/float then the address may change.
You should find the LCD works now.
And, please do not every apologise forhaving to use English. I am at fault with my poor language skills (being 50% English and 50% Welsh).
ood luck with the rest of the project.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Good morning. I'm trying an 'i2c display with PCF8574AT interface (Address 0x3F) using the following code but I can not get any results.
image date and clk at the start

Using a display with PCF8574A interface (Address 0x27) everything correctly works . Can you help me understand the problem?
Ps. all displays work on Arduino programmed with Arduino IDE:
Greetings.
https://postimg.org/image/sfn61ga1v/
image date and clk at the start
Looks relatively simple to resolve.
Why? The address of your device is 0x27 as a 7-bit address. And, an 8-bit address for the device is 0x4e. Do try.
If this fails. Ensure the I2C is working - use I2c discovery
I had already tried with "#define LCD_I2C_Address 0x4E" "#define LCD_I2C_Address 0x27" "#define LCD_I2C_Address 0x37" but it does not work, furthermore the address of the PCF8574AT is 0x3F should be in binary 0100111 as I also see on oscilloscope.
Excuse my ignorance but what is I2c discovery?
It's in C:\GCB@Syn98.01\GreatCowBasic\Demos\I2C Solutions on my pc.
Ok found, I changed PIC with #chip 18f45k22,4 because I do not have a 16F1829. The serial monitor gives me:
omit the "Unknown_Device"
ID: 0x30 DS2482_1Channel_1Wire Master
ID: 0x31 DS2482_1Channel_1Wire Master
ID: 0x40 Serial_Expander_Device
ID: 0x41 Serial_Expander_Device
ID: 0x48 IC2/Serial_Expander_Device
ID: 0x49 IC2/Serial_Expander_Device
ID: 0x4A IC2/Serial_Expander_Device
ID: 0x4B IC2/Serial_Expander_Device
ID: 0x4C IC2/Serial_Expander_Device
ID: 0x4D IC2/Serial_Expander_Device
ID: 0x4E IC2/Serial_Expander_Device
ID: 0x4F IC2/Serial_Expander_Device
ID: 0x60 GCB Slave Device
ID: 0x61 GCB Slave Device
ID: 0x70 PCF8574T IC2/Serial_Expander_Device
ID: 0x71 PCF8574T IC2/Serial_Expander_Device
ID: 0x72 PCF8574T IC2/Serial_Expander_Device
ID: 0x73 PCF8574T IC2/Serial_Expander_Device
ID: 0x78 IC2 OLED Display
ID: 0x79 IC2 OLED Display
ID: 0x7E PCF8574T IC2/Serial_Expander_Device
ID: 0x7F PCF8574T IC2/Serial_Expander_Device
ID: 0xA0 EEProm_Device_Device
ID: 0xA1 EEProm_Device_Device
ID: 0xA2 EEProm_Device_Device
ID: 0xA3 EEProm_Device_Device
ID: 0xA4 EEProm_Device_Device
ID: 0xA5 EEProm_Device_Device
ID: 0xA6 EEProm_Device_Device
ID: 0xA7 EEProm_Device_Device
ID: 0xA8 EEProm_Device_Device
ID: 0xA9 EEProm_Device_Device
ID: 0xAA EEProm_Device_Device
ID: 0xAB EEProm_Device_Device
ID: 0xAC EEProm_Device_Device
ID: 0xAD EEProm_Device_Device
ID: 0xAE EEProm_Device_Device
ID: 0xAF EEProm_Device_Device
ID: 0xC0 TEA5767 FM Radio
ID: 0xC1 TEA5767 FM Radio
ID: 0xC6 AXE033 I2C LCD Device
ID: 0xC7 AXE033 I2C LCD Device
ID: 0xD0 DS1307_RTC_Device
ID: 0xD1 DS1307_RTC_Device
ID: 0xF8 FRAM_Device
ID: 0xF9 FRAM_Device
but I can not find a PCF8574AT in the list
I noticed that #define LCD_I2C_Address "...." has no effect in the program, even if you set incorrect Address values, if I use PCF8574T it always works.
With PCF8574AT I tried all the values in the table but it does not work
It is very late here. Check back Friday please.
Morning.
I know you said Arduino code worked but I want to start at first principles as the Arduino library may or may not comply with the protocol.
Questions.
1. Do you have pull-up resistors? I cannot tell from the scope JPG as this picture does not show a sustained HIGH state. You should have a pull-up resistor for SDA and SCL lines.
2. You are using software I2C. Why?
3. The Discovery is failing. You should not all those devices - just the ones attached. So, we need to figure out what is happening with this first. Please ignore the LCD until we have discovery working. I am assuming you took a demo and adapted for 18f45k22. Correct?
4. Post a foto of your LCD device please. Is this an LCD_IO 10 or LCD_IO 12 device? You have assummed a #10 . Why? But., let us get I2C Discover working first.
5. Attached your ASM from the 866 LCD code please. I want to review.
I will pull at 886 and hook up an LCD now. I can think of no reason why this is not working.
I have not inserted pullup resistors. When I have some time I will do what you suggest, then I will post the results.
Thank you.
I am using the example HWI2C2_Discovery_for_16F1829 @ 32
My conf. for 18F45K22:
I tried with 2,7k pullups and then with 10K pullups
the result is always the following:
I2C2 Hardware Device Search for Microchip
ID: 0x00 Unknown_Device
My LCD
https://postimg.org/image/9474rrryr/
You have a complete mixed up piece of code.
1. There are two headers sections.
2. code for sections for the arduino
3. Hardware I2C2 - second channel
Let us start with the basic question. Tell me what hardware and the chip you have and any ports constraints please (ie what ports can you not move with respect to I2C).
The lcd has a ucontroller to convert it to i2c from the photo. Is it set to 8 or 4 bit for lcd and any set up stuff relevant to the "i2c to parallel converter"
Here is an operational and tested solution. This is for the same family of chips.
This is for the 18F26K22 which is same chip architecture. This works. I have compiled and programmed and then tested.
If your pulls are correct - just change the chip.
We need to make sure this works first, or, you are shooting in the dark.
Last edit: Anobium 2018-02-09
I'm sorry, the setting code has been pasted twice, now I'm attaching the real part.
HWI2C2_Discovery_for_16F1829 @ 32 modified for 18F45K22
This is the ASM file working with PCF8574T (address 0x27) loaded on 16F886.
With PCF8574AT (address 0x3f) it does not work
https://ufile.io/i80dj
https://postimg.org/image/aee4y6q6r/
https://postimg.org/image/aee4y6q6r/
The result is:
7E 01111110 = 0x3F
4E 01001110 = 0x27
it's correct?
https://s13.postimg.org/o82hn8b2f/PCF8574_AT.jpg
It's an expander. I used a mcp one,works. The 3 pins that control address, I tied all high so I knew address. Is this relevent?
it is used to set a different address when you are controlling more than one display.
I used a MCP23017 for stepper motors, I didn't leave the pins floating. I'm following this as I have some parallel displays and thinking how to convert to i2c or serial. with some expanders or shift registers.
Back to the issue of basic I2C.
@Renzo. I have number the questions so you can answer the specific questions.
1) What is the state of play? You have posted a confusing message. You got I2C discovery to work ? This is a YES or NO answer.
2) Then, you post the following asking a question:
You post pictures of 0x4e and 0x7e without any explanation. Did you change something? or, did you get this result when rerunning the program? Very confusing.
3 ) Then, you post some code in the post that commences with
Is this the code that works? I think not. Please confirm.
4) Let me assume that the operation code I posted is the code you got working. A few points. i) This uses I2C, the first I2C channel within the microcontroller, you tried using I2C2. Why? ii) I used hardware serial. You used software serial why? What am I missing in your choices?
5) Thank you for the ASM. This told me the version of the compiler. The first line of the ASM file shows the version number.
6) Can we sort out these questions before we jump to the LCD? I have no idea what the I2C is and how to explain what is going on as I am confused.
Anobium
@Stan - please let me complete the root cause analysis before we start trying to sort the LCD. We need to get the basics correct first.
Last edit: Anobium 2018-02-10
1)Yes, I used it "i2cHardwareDiscovery to Terminal_18F26K22" to work
2)I said that badly.
This is the result of the I2C discovery with MCP8574AT connected:
00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
00 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
10 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70 -- -- -- -- -- -- -- -- -- -- -- -- -- -- 7E 7F
80 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
90 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
A0 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
B0 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
C0 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
D0 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
E0 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
F0 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
This is the result of the I2C discovery with MCP8574T connected:
00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
00 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
10 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40 -- -- -- -- -- -- -- -- -- -- -- -- -- -- 4E 4F
50 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
80 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
90 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
A0 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
B0 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
C0 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
D0 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
E0 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
F0 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
3)The correct code to detect the addresses is:
"i2cHardwareDiscovery to Terminal_18F26K22"
I only changed the initial configuration with "#chip 18F45K22,4".
4)Now I'm using HI2CMode and it works.
I'm sorry I messed up but I'm new with PIC programming
plus my English is very poor.
Thanks for the infinite patience
OK. Sounds like you have I2C abd Serial working. The LCD address is whatever is displayed on the Discovery program. These are 8-bit addreses. If you change the address of the slave device via pullups/pulldown/float then the address may change.
You should find the LCD works now.
And, please do not every apologise forhaving to use English. I am at fault with my poor language skills (being 50% English and 50% Welsh).
ood luck with the rest of the project.
First time I've come across these in search for serial/i2c to parallel https://www.google.co.uk/search?q=pcf8574at+pinout&tbm=isch&source=iu&ictx=1&fir=fB6C_6LOujPnHM%253A%252CmtFiuZsfKgBIdM%252C_&usg=__e51tesvLZHNGlFEpkjNjYcGPEmg%3D&sa=X&ved=0ahUKEwjOtPnc-ZvZAhXSGuwKHRslCZAQ9QEIMTAD#imgrc=fB6C_6LOujPnHM: