Would you like to react to this message? Create an account in a few clicks or log in to continue.

You are not connected. Please login or register

PCF8574 error in SimulIDE

3 posters

Go down  Message [Page 1 of 1]

1PCF8574 error in SimulIDE Empty PCF8574 error in SimulIDE Fri Jun 03, 2022 12:17 pm

firefox66



Hi all.

At the beginning, I have started the project with i2c Lcd and find out that i2c connect to Lcd 16x02 or 20x04 through IC PCF8574 has a problem in simulate.

Another thing I have test the same circuit in Proteus and it work as the picture I have include below.

In further, I take the circuit in a real world and it work fine.

The Conclusion is that I think it have a problem with this driver in SimulIDE (1.0.0 and 0.4.15)

PCF8574 error in SimulIDE D92537cc82bc77c94e5ea74c8ed3f6d4 PCF8574 error in SimulIDE C02cd98a5dc1aeb6a9ccf9ee52580ba5 PCF8574 error in SimulIDE _ecf5d6cb07575dc0928ae7000826b735
Attachments
PCF8574 error in SimulIDE Attachmentfile_SimuIDE_Proteus_and_Hex.zip
File SimulIDE, Proteus and the same hex for all
You don't have permission to download attachments.
(23 Kb) Downloaded 6 times

2PCF8574 error in SimulIDE Empty Re: PCF8574 error in SimulIDE Fri Jun 03, 2022 2:37 pm

arcachofo

arcachofo

Hi.
I will have a look, but without the source code there is not much I can do.

firefox66 likes this post

3PCF8574 error in SimulIDE Empty Re: PCF8574 error in SimulIDE Fri Jun 03, 2022 3:05 pm

Defran

Defran

Try with the address 0x57.

4PCF8574 error in SimulIDE Empty Re: PCF8574 error in SimulIDE Fri Jun 03, 2022 4:00 pm

firefox66



arcachofo wrote:Hi.
I will have a look, but without the source code there is not much I can do.

I use Codevision Avr to write the code for driver lcd through PCF8574. As I have mention above, same hex I have uploaded for SimulIDE, Proteus and the same as I upload to my real IC on board.

thanks

5PCF8574 error in SimulIDE Empty Re: PCF8574 error in SimulIDE Fri Jun 03, 2022 4:05 pm

firefox66



Defran wrote:Try with the address 0x57.

it has nothing because in datasheet it takes the address config throughout A0 A1 A3 (range from 20h .. 27h). mine slave PCF8574 is 0x27.

Another thing I used to find out my slaver PCF8574 address is arduino : https://create.arduino.cc/projecthub/abdularbi17/how-to-scan-i2c-address-in-arduino-eaadda -> it is 0x27h

thanks

6PCF8574 error in SimulIDE Empty Re: PCF8574 error in SimulIDE Fri Jun 03, 2022 4:13 pm

arcachofo

arcachofo

The problem is that the address in I2CToParallel component is not set correctly.
In your circuit it is set to 80 = 0x50 when it should be 32 = 0x20.

7PCF8574 error in SimulIDE Empty Re: PCF8574 error in SimulIDE Fri Jun 03, 2022 4:21 pm

firefox66



arcachofo wrote:The problem is that the address in I2CToParallel component is not set correctly.
In your circuit it is set to 80 = 0x50 when it should be 32 = 0x20.


I set it 32 as 0x20, nothing done, but if I set to 39 = 0x27, it shows right text on lcd. In datasheet A0 A1 A2 = Vdd Vdd Vdd = 0x27, Vss Vss Vss = 0x20


PCF8574 error in SimulIDE 574f00902ff7013ab20e039b61042d63

https://www.nxp.com/docs/en/data-sheet/PCF8574_PCF8574A.pdf

8PCF8574 error in SimulIDE Empty Re: PCF8574 error in SimulIDE Fri Jun 03, 2022 4:30 pm

arcachofo

arcachofo

I set it 32 as 0x20, nothing done, but if I set to 39 = 0x27, it shows right text on lcd. In datasheet A0 A1 A2 = Vdd Vdd Vdd = 0x27, Vss Vss Vss = 0x20
In the circuit you sent A0 A1 A2 are connected to +5V.
Setting address to 32 works correctly.

9PCF8574 error in SimulIDE Empty Re: PCF8574 error in SimulIDE Fri Jun 03, 2022 4:33 pm

arcachofo

arcachofo

Here you can see that the "hardcoded" address is 0x20, and the first 3 bits are set by A0 A1 A2 pins.
So the correct address is 0x20 = 32.
PCF8574 error in SimulIDE 574f00902ff7013ab20e039b61042d63

10PCF8574 error in SimulIDE Empty Re: PCF8574 error in SimulIDE Fri Jun 03, 2022 4:42 pm

firefox66



arcachofo wrote:Here you can see that the "hardcoded" address is 0x20, and the first 3 bits are set by A0 A1 A2 pins.
So the correct address is 0x20 = 32.
PCF8574 error in SimulIDE 574f00902ff7013ab20e039b61042d63

in SimulIDE I connected A0, A1, A2 to Ground, it means 32 = 0x20, but take 32 to Control Code in PCF8574 properties, it is not thing done.

You try it in my file SimulIDE that I included.

inclusion, in my code, my slaver address is 0x27 like this:

// I2C LCD Shield initialization for TWI
// PCF8574 I2C bus address: 0x27
// LCD characters/line: 16
lcd_twi_init(0x27, 16);

In proteus, I connect A0 A1 A2 = 0x27 = 39 (connect to 5V+) it work, but if to connect A0 A1 A2 = 0x22 = 32 (connect to ground), it show notthing (because the address now is 0x20).



Last edited by firefox66 on Fri Jun 03, 2022 4:58 pm; edited 1 time in total

11PCF8574 error in SimulIDE Empty Re: PCF8574 error in SimulIDE Fri Jun 03, 2022 4:57 pm

Defran

Defran

Use this program to test.

12PCF8574 error in SimulIDE Empty Re: PCF8574 error in SimulIDE Fri Jun 03, 2022 5:03 pm

arcachofo

arcachofo

in SimulIDE I connected A0, A1, A2 to Ground, it means 32 = 0x20, but take 32 to Control Code in PCF8574 properties, it is not thing done.
In the circuit you attached (main.sim1.sim1.simu) in your first post you connected A0, A1, A2 to +5V.
Which is the correct thing to do (you did the same in Proteus).
Connecting to ground is wrong if you want to use address 0x27.
If you connect to ground you must use address 0x20 as is clearly shown in the table in your own post.

In conclusion:
To use address 0x27 you must do what is shown in the table in your own post:
- "Control code" = 0x20 = 32
- A0 A1 A2 connected to +5V.


You try it in my file SimulIDE that I included.
I already did and I already told you that it works correctly.

PCF8574 error in SimulIDE 010

13PCF8574 error in SimulIDE Empty Re: PCF8574 error in SimulIDE Fri Jun 03, 2022 5:03 pm

firefox66



Defran wrote:Use this program to test.

Open file error, I used both 1.0.0 and 0.4.15

PCF8574 error in SimulIDE Ac3114804e405d483ed7d598f7fe26cf

14PCF8574 error in SimulIDE Empty Re: PCF8574 error in SimulIDE Fri Jun 03, 2022 5:25 pm

firefox66



arcachofo wrote:
in SimulIDE I connected A0, A1, A2 to Ground, it means 32 = 0x20, but take 32 to Control Code in PCF8574 properties, it is not thing done.
In the circuit you attached (main.sim1.sim1.simu) in your first post you connected A0, A1, A2 to +5V.
Which is the correct thing to do (you did the same in Proteus).
Connecting to ground is wrong if you want to use address 0x27.
If you connect to ground you must use address 0x20 as is clearly shown in the table in your own post.

In conclusion:
To use address 0x27 you must do what is shown in the table in your own post:
- "Control code" = 0x20 = 32
- A0 A1 A2 connected to +5V.


You try it in my file SimulIDE that I included.
I already did and I already told you that it works correctly.

PCF8574 error in SimulIDE 010

Your "Control Code" reverse to datasheet of PCF85740

Vdd is positive supply 5V
Vss is negative supply or 0v or Ground

In the circuit above you have showed me, A0 A1 A2 you connect to 5V that mean A0 A1 A2 = Vdd Vdd Vdd = 0x27 = 39 (in datasheet). Am i right ? and the question is why you take the "Control Code" is 32 = 0x20 It work, but it must be right if you take 39 = 0x27 like datasheet, but it won't work if you take the "Control code" is 39? (in my code and hex code: it has been programmed to be 0x27 for the address)

in Conclusion, in Proteus, it work like I have mentioned.
Sorry about waste your time but I think it is very weird.

PCF8574 error in SimulIDE 574f00902ff7013ab20e039b61042d63

https://www.nxp.com/docs/en/data-sheet/PCF8574_PCF8574A.pdf



Last edited by firefox66 on Fri Jun 03, 2022 5:50 pm; edited 1 time in total

15PCF8574 error in SimulIDE Empty Re: PCF8574 error in SimulIDE Fri Jun 03, 2022 5:40 pm

arcachofo

arcachofo

In the circuit above you have showed me, A0 A1 A2 you connect to 5V that mean A0 A1 A2 = Vdd Vdd Vdd = 0x27 = 39 (in datasheet).
That is YOUR circuit main.sim1.sim1.simu

and the question is why you take the "Control Code" is 32 = 0x20 It work,
Because that is how it works:
bits 0, 1 and 2 are determined by the state of the pins A0 A1 A2.

but it must be right if you take 39 = 27 like datasheet, but it don't work?
NO, the datasheets shows that you MUST connect A0 A1 A2 to Vdd to use address 0x27.

PCF8574 error in SimulIDE 110

16PCF8574 error in SimulIDE Empty Re: PCF8574 error in SimulIDE Fri Jun 03, 2022 5:56 pm

Defran

Defran

TEST 0X27 ADDR.

17PCF8574 error in SimulIDE Empty Re: PCF8574 error in SimulIDE Fri Jun 03, 2022 6:15 pm

firefox66



Defran wrote:TEST 0X27 ADDR.
It just like the same result my post above, I can't open your file in 1.0.0 or 0.4.15. but  inspected your code


Code:
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x57,16,2);  // ADDRESS HERE

void setup()
{
lcd.init();
lcd.backlight();
lcd.print("Hi everyone!");
}

void loop()
{
 lcd.setCursor(0, 1);
 lcd.print(millis()/1000);
 lcd.print(" Secs");
 delay(100);
}

in datasheet PCF8574 for PCF8574A -> these is no address 0x57

- PCF8574
PCF8574 error in SimulIDE 574f00902ff7013ab20e039b61042d63

- PCF8574_A
PCF8574 error in SimulIDE Aee6da1bdc682f9edc8fcfe119be5971

In real world or proteus it will not work correct. You can try it and show your result right here to me.

thanks

18PCF8574 error in SimulIDE Empty Re: PCF8574 error in SimulIDE Fri Jun 03, 2022 6:59 pm

Defran

Defran

For 0415
Attachments
PCF8574 error in SimulIDE AttachmentPCF8574_SIMULIDE_TEST_3.zip
You don't have permission to download attachments.
(7 Kb) Downloaded 3 times

19PCF8574 error in SimulIDE Empty Re: PCF8574 error in SimulIDE Fri Jun 03, 2022 7:36 pm

firefox66



Defran wrote:For 0415

Read Table 4. PCF8574 Address Map and view your code with "LiquidCrystal_I2C lcd(0x27,16,2); // ADDRESS HERE" and asking yourself this question: why you code the address in arduino is 0x27 but in the simulate, the address you set for "Control Code" is 32 = 0x20 and it still work fine instead of the same address code 39 = 0x27 as the same of your code in arduino?

Thanks

20PCF8574 error in SimulIDE Empty Re: PCF8574 error in SimulIDE Fri Jun 03, 2022 8:36 pm

arcachofo

arcachofo

Read Table 4. PCF8574 Address Map and view your code with "LiquidCrystal_I2C lcd(0x27,16,2); // ADDRESS HERE" and asking yourself this question: why you code the address in arduino is 0x27 but in the simulate, the address you set for "Control Code" is 32 = 0x20 and it still work fine instead of the same address code 39 = 0x27 as the same of your code in arduino?
"Control Code" is not the address, is just the upper part of the address, that is why it is not called "Address" but "Control Code".

The lower 3 bit of the address are determined by the state of pins A0 A1 A2.
So address = Control code (upper 4 bits) + A2 A1 A0

PCF8574 error in SimulIDE _011

Sponsored content



Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum