i2c

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 4.
To post in this forum you must have a registered copy of Flowcode 4 or higher. To sign up for this forum topic please use the "Online Resources" link in the Flowcode Help Menu.

Moderator: Benj

Post Reply
Darren.Smith
Flowcode V4 User
Posts: 38
Joined: Thu Feb 24, 2011 4:38 pm
Has thanked: 2 times
Been thanked: 1 time
Contact:

i2c

Post by Darren.Smith »

hi guys, am still playing with thw i2c component. am now trying to read from an mcp23008 expnader ic, in doing this i have changed my ic to a 16f1826, also tried a 12f1840, the problem i am having is when i come to compile. i get a failure sspif not recognized. my question is does the i2c macro only work on certain ic's and would i need to re-write the macro to work on different ic's, it seems that it compiles ok with a 16f884 and 16f887.

cheers
Dazza

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: i2c

Post by medelec35 »

Hi Dazza,
The bug is not caused by Flowcode, but by BoostC

BoostC have not put the definitions in for PIR1 or PIR2 bits, hence the error your currently getting.

Fix is:
If 64bit windows go to C:\Program Files (x86)\Matrix Multimedia\Flowcode V4\boostc\include
or
If 32bit windows go to C:\Program Files\Flowcode\boostc\include

Make a copy of PIC16F1826.h & PIC16F1827.h
then replace original with attached files.
Hopefully flowchart will compile successfully.

Martin
Attachments
PIC16F1826.h
(39.99 KiB) Downloaded 247 times
PIC16F1827.h
(47.87 KiB) Downloaded 211 times
Martin

Darren.Smith
Flowcode V4 User
Posts: 38
Joined: Thu Feb 24, 2011 4:38 pm
Has thanked: 2 times
Been thanked: 1 time
Contact:

Re: i2c

Post by Darren.Smith »

cheers medelec35, i will give this a try later this evening, am just off out to soothe the brain with a little liquid nurishment (ie the pub)..

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: i2c

Post by medelec35 »

No probs.
Darren.Smith wrote:am just off out to soothe the brain with a little liquid nurishment (ie the pub)..
Now that sounds like a good plan!
Martin

Darren.Smith
Flowcode V4 User
Posts: 38
Joined: Thu Feb 24, 2011 4:38 pm
Has thanked: 2 times
Been thanked: 1 time
Contact:

Re: i2c

Post by Darren.Smith »

cheers martin, for your post, it seems to let me compile now, have been looking thru the new and old files to try and work out what is different. i see in your new file that there are now 2 lots of the pir1 and pir2 defines. when checking the old file i see that it defines ssp1if, what i was wondering is if i was to change the macro from sspif to ssp1if would this have the same effect as changing the files.i am unfortunatly only a beginner so have hundreds of questions at the moment, i am just trying to get my head around the basics....


cheers
Dazza

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: i2c

Post by medelec35 »

Hi Dazza,
Since there was an error: unknown identifier 'SSPIF'
either problem with PIC_I2C_Master.c or in boost C header file PIC16F1826.h

A look at the data sheet confirmed it was not PIC_I2C_Master.c since SSPIF does exist.

So I searched for SSPIF and that could not be found.
So I added the correct bits from a different header file.

However after your latest post I just had a closer look and your correct with what you are saying about PIR being repeated.
But the PIR that already existed has got

Code: Select all

#define SSP1IF                0x0003 
Instead of correct

Code: Select all

#define SSPIF                 0x0003 
That's why I could not find SSPIF and assumed it was missing. I did not look further down.
Had I have done then I would have just removed the extra 1 that's appeared between the P and I.

So in reality I should of said, PIR1 is wrong and not missing.

good spot!

That will teach me for searching for the bit name instead of register :lol:

So to answer your question there should only be one lot PIR1 and PIR2 but with correct bit names :P
And if you have changed SSP1IF to SSPIF ie removed all the odd 1's then it would of worked!

I don't believe it matters if both are there.

Martin
Martin

Post Reply