I2C component faulty

For general Flowcode discussion that does not belong in the other sections.
Post Reply
jollybv
Posts: 144
http://meble-kuchenne.info.pl
Joined: Mon Mar 08, 2021 11:25 am
Location: Cape Town South Africa
Has thanked: 41 times
Been thanked: 12 times

I2C component faulty

Post by jollybv »

Hi Guys I'm having a problem with the I2C component in V7 as it wont let me select the SDA and SCL pins when i click on the dropdown menus it is blank how can i sort this out? as i deleted flowcode downloaded it again reloaded it still the same thing is happening
I2C.jpg
I2C.jpg (37.31 KiB) Viewed 4213 times

BenR
Matrix Staff
Posts: 2003
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 525 times
Been thanked: 715 times

Re: I2C component faulty

Post by BenR »

Hello,

What chip are you using? Can you attached your project file?

I've just tried the 16F18877 in v7 and it appears to be working correctly there.

Would using a software channel or upgrading to v10 be an option?

jollybv
Posts: 144
Joined: Mon Mar 08, 2021 11:25 am
Location: Cape Town South Africa
Has thanked: 41 times
Been thanked: 12 times

Re: I2C component faulty

Post by jollybv »

Hi Ben
I'm using the 18F47K40 I have V9 as well but the program wont compile in V9 so i have to use V7 as i really don't have the time to reprogram the whole project. V10 I would like to get but to expensive for me at the moment as i live in South Africa its like 20 to 1 exchange rate.

I have fired up my old PC and tried programming there on both machines I'm running V7.3.0.5 What I have found on the old machine I can set channel 1 and 2 of the I2C. On the 18F47K40 chip I'm using its connected to clock C3, Data C4, but if i set it to channel 1 or 2 it just hangs on the first read memory. If i set it to software on the first read it works but when you try to write a bite to memory using the SendByte Transaction it goes through all the motions but dos not store. If I write a number of bytes using the TransmitBite method it writes to memory without a problem.

I hope I'm making sense

My board has been working for a few years without problems so really not sure what could of caused this as the program has not been changed in a while
E-P_U6_V-6-0-1_WasWorking_01-12-24_For-A7682E.fcfx
(904.41 KiB) Downloaded 77 times

jollybv
Posts: 144
Joined: Mon Mar 08, 2021 11:25 am
Location: Cape Town South Africa
Has thanked: 41 times
Been thanked: 12 times

Re: I2C component faulty

Post by jollybv »

Another thing is if i try to program the chip from my new PC the compiler hangs. I thought that the compiler was corrupt so i copied from old machine into new machine still no luck. I Have done a windows 11 repair as i thought something might be corrupt with windows then i removed V7 and reloaded it still no luck not sure where to go from here now
Compiler message.jpg
Compiler message.jpg (38.56 KiB) Viewed 4117 times

jollybv
Posts: 144
Joined: Mon Mar 08, 2021 11:25 am
Location: Cape Town South Africa
Has thanked: 41 times
Been thanked: 12 times

Re: I2C component faulty

Post by jollybv »

Hi guys

I'm not sure what i did but turned the PC on this morning and i was able to compile to the chip everything seems to be working the only thing that isn't is the I2C channel but it is working with software.
One thing I cant understand is the addressing to talk to the I2C memory if A1, A2, A3 are all pulled to ground then the ControlByte should be 0xA0 for write 0xA1 for read but if i do a Sendbyte Transaction or ReceiveByte Transaction I need to use 0x50 or it dose not work. Using the TransmitByte and ReceiveByte I have to use 0xA0 and 0xA1 which is verry confusing but it is working

LeighM
Valued Contributor
Posts: 503
Joined: Mon Dec 07, 2020 1:00 pm
Has thanked: 88 times
Been thanked: 269 times

Re: I2C component faulty

Post by LeighM »

Sounds like the address of the device is 0x50.
The protocol has this 7 bit address in the highest 7 bits of the first byte, with the read/write flag in bit 0.
Hence the address appears shifted left one bit.

jollybv
Posts: 144
Joined: Mon Mar 08, 2021 11:25 am
Location: Cape Town South Africa
Has thanked: 41 times
Been thanked: 12 times

Re: I2C component faulty

Post by jollybv »

Hi Leigh

But it is strange how can the device have 2 addresses 0xA0 for when i do a TransmitByte transaction but 0x50 for SendByte Transaction dose not make sense I've even asked AI and it says that the 24LC256 address if all address lines are to ground is 0xA0 for read and 0xA1 for write so I'm not sure how this is working.

LeighM
Valued Contributor
Posts: 503
Joined: Mon Dec 07, 2020 1:00 pm
Has thanked: 88 times
Been thanked: 269 times

Re: I2C component faulty

Post by LeighM »

Have a look at a datasheet for the device and the protocol diagrams should help.
Ps. The transaction API works with a predefined device address, the transmit byte is a low level raw byte send.

jollybv
Posts: 144
Joined: Mon Mar 08, 2021 11:25 am
Location: Cape Town South Africa
Has thanked: 41 times
Been thanked: 12 times

Re: I2C component faulty

Post by jollybv »

Hi Guys

This is driving me crazy i tried to program a board today and the compiler was just hanging as above so i deleted flowcode V7 reinstalled now it has stopped the hanging but now sending me this error.

Target folder: C:\Users\BRIANH~1\Dropbox\DESIGN~1\U6PROG~1
Source name: C:\Users\BrianHome\Dropbox\Designs and software\U6 Programs 06-10-25\E-P_U6_V-4-6-2_WorkingON_11-11-25_For-A7682E.fcfx
Title: Master Pannel
Description: UNI-CALL Universal intercom syatem
Device: PIC.18F.18F47K40
Generated by: Flowcode v7.3.0.5
Date: Tuesday, November 18, 2025 14:12:53
Users: 1
Registered to: Brian Van Staden
Licence key: VF6C7K
http://www.matrixtsl.com
Launching the compiler...
C:\Program Files (x86)\Flowcode 7\compilers\pic\bin\xc8.exe --chip=18F47K40 "E-P_U6_V-4-6-2_WorkingON_11-11-25_For-A7682E.c" --MSGDISABLE=359,1273,1388
Microchip MPLAB XC8 C Compiler (Free Mode) V1.41
Build date: Jan 24 2017
Part Support Version: 1.41
Copyright (C) 2017 Microchip Technology Inc.
License type: Node Configuration

E-P_U6_V-4-6-2_WorkingON_11-11-25_For-A7682E.c:
27573: #warning "This interrupt has previously been enabled, so the macro <Getkey> may never get called."
^ (162) #warning: "This interrupt has previously been enabled, so the macro <Getkey> may never get called." (warning)
27586: #warning "This interrupt has previously been enabled, so the macro <Getkey> may never get called."
^ (162) #warning: "This interrupt has previously been enabled, so the macro <Getkey> may never get called." (warning)
27599: #warning "This interrupt has previously been enabled, so the macro <Getkey> may never get called."
^ (162) #warning: "This interrupt has previously been enabled, so the macro <Getkey> may never get called." (warning)
27625: #warning "This interrupt has previously been enabled, so the macro <Getkey> may never get called."
^ (162) #warning: "This interrupt has previously been enabled, so the macro <Getkey> may never get called." (warning)
27662: #warning "This interrupt has previously been enabled, so the macro <Getkey> may never get called."
^ (162) #warning: "This interrupt has previously been enabled, so the macro <Getkey> may never get called." (warning)
27675: #warning "This interrupt has previously been enabled, so the macro <recive_data> may never get called."
^ (162) #warning: "This interrupt has previously been enabled, so the macro <recive_data> may never get called." (warning)
27687: #warning "This interrupt has previously been enabled, so the macro <Getkey> may never get called."
^ (162) #warning: "This interrupt has previously been enabled, so the macro <Getkey> may never get called." (warning)
27700: #warning "This interrupt has previously been enabled, so the macro <Getkey> may never get called."
^ (162) #warning: "This interrupt has previously been enabled, so the macro <Getkey> may never get called." (warning)
27713: #warning "This interrupt has previously been enabled, so the macro <Getkey> may never get called."
^ (162) #warning: "This interrupt has previously been enabled, so the macro <Getkey> may never get called." (warning)
27726: #warning "This interrupt has previously been enabled, so the macro <Getkey> may never get called."
^ (162) #warning: "This interrupt has previously been enabled, so the macro <Getkey> may never get called." (warning)
27739: #warning "This interrupt has previously been enabled, so the macro <Getkey> may never get called."
^ (162) #warning: "This interrupt has previously been enabled, so the macro <Getkey> may never get called." (warning)
27752: #warning "This interrupt has previously been enabled, so the macro <Getkey> may never get called."
^ (162) #warning: "This interrupt has previously been enabled, so the macro <Getkey> may never get called." (warning)
27765: #warning "This interrupt has previously been enabled, so the macro <Getkey> may never get called."
^ (162) #warning: "This interrupt has previously been enabled, so the macro <Getkey> may never get called." (warning)
27778: #warning "This interrupt has previously been enabled, so the macro <Getkey> may never get called."
^ (162) #warning: "This interrupt has previously been enabled, so the macro <Getkey> may never get called." (warning)
27791: #warning "This interrupt has previously been enabled, so the macro <Getkey> may never get called."
^ (162) #warning: "This interrupt has previously been enabled, so the macro <Getkey> may never get called." (warning)
27804: #warning "This interrupt has previously been enabled, so the macro <Getkey> may never get called."
^ (162) #warning: "This interrupt has previously been enabled, so the macro <Getkey> may never get called." (warning)
27817: #warning "This interrupt has previously been enabled, so the macro <Getkey> may never get called."
^ (162) #warning: "This interrupt has previously been enabled, so the macro <Getkey> may never get called." (warning)
27830: #warning "This interrupt has previously been enabled, so the macro <Getkey> may never get called."
^ (162) #warning: "This interrupt has previously been enabled, so the macro <Getkey> may never get called." (warning)
27843: #warning "This interrupt has previously been enabled, so the macro <Getkey> may never get called."
^ (162) #warning: "This interrupt has previously been enabled, so the macro <Getkey> may never get called." (warning)
27856: #warning "This interrupt has previously been enabled, so the macro <Getkey> may never get called."
^ (162) #warning: "This interrupt has previously been enabled, so the macro <Getkey> may never get called." (warning)
27869: #warning "This interrupt has previously been enabled, so the macro <Getkey> may never get called."
^ (162) #warning: "This interrupt has previously been enabled, so the macro <Getkey> may never get called." (warning)
C:\Program Files (x86)\Flowcode 7\CAL\PIC\PIC_CAL_I2C.c: FC_CAL_I2C_Master_Init_1()
246: = 0;
^ (195) expression syntax
247: = ;
^ (195) expression syntax
248: = ;
^ (195) expression syntax
276: tris |= (1 << (0));
^ (192) undefined identifier "tris"
C:\Program Files (x86)\Flowcode 7\CAL\PIC\PIC_CAL_I2C.c: FC_CAL_I2C_Slave_Init_1()
535: = 0;
^ (195) expression syntax
536: = ;
^ (195) expression syntax
537: = 19;
^ (195) expression syntax
E-P_U6_V-4-6-2_WorkingON_11-11-25_For-A7682E.c: main()
13342: break;
^ (345) unreachable code (warning)
27541: }
^ (350) unused label "FCC_Main_V" (from line 0) (warning)
(908) exit status = 1
(908) exit status = 1

C:\Program Files (x86)\Flowcode 7\compilers\pic\bin\xc8.exe reported error code 1



FINISHED


Please can someone help as i need to install a system tomorrow and i found a small software error which i have corrected but need to program to the board
E-P_U6_V-4-6-2_WorkingON_11-11-25_For-A7682E.fcfx
(905.22 KiB) Downloaded 5 times

BenR
Matrix Staff
Posts: 2003
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 525 times
Been thanked: 715 times

Re: I2C component faulty

Post by BenR »

Hello,

It appears the SDA Remap pin of the I2C Master component is unassigned in the project.

Post Reply