I2C not working in V9

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

I2C not working in V9

Post by jollybv »

Hi Guys

I've been battling with this for the whole day but cant seem to find out why the I2C component wont work. I've tried in software mode 100Khz but still nothing. In the attached file write near the top there is the first call macro that says RaadBuildingName once in there it calls a macro Read_I2C but when it goes to read it it just hangs I have been over this code numerous times but cant get it to work. So im thinking that the I2C component is faulty. This program was original done in V6 and has worked well but now for some reason cant get it to work. Please help

What i have just noticed is i have a 5 second delay that is taking 23 seconds maybe the problem is in the delay component?

mnfisher
Valued Contributor
Posts: 1958
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 158 times
Been thanked: 926 times

Re: I2C not working in V9

Post by mnfisher »

Sounds like a clock setting error if the delay is taking 4.5x ? Have you done a 1s blinkie?

Martin

chipfryer27
Valued Contributor
Posts: 1972
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 433 times
Been thanked: 647 times

Re: I2C not working in V9

Post by chipfryer27 »

Hi

For the PIC to use it's own internal oscillator then you need to use a C-block to enable it.

Fortunately Flowcode can assist by using the IntOsc Helper found under Component Libraries > Runtime.

Add that to your chart then in properties select from the drop down list the frequency you wish. It will then generate the required code for you. Copy the code and add a C-Block as the first icon in Main, then paste the code in there.

It shows the code to be :- OSCFRQ = 0x08;

Hope this helps.

Post Reply