Detecting if I2C has been Initialized

Coding and general discussion relating to the compiler

Moderators: David Barker, Jerry Messina

Post Reply
TimC
Registered User
Registered User
Posts: 5
Joined: Sun Nov 19, 2006 4:51 am
Location: Boston MA

Detecting if I2C has been Initialized

Post by TimC » Thu Dec 07, 2006 4:06 pm

Hi,
Is there a way to test under program control if I2CInitialize() has been issued?

There are enough problems dealing with I2C such as pullups, addresses, speed, hard or soft I2CInitialize

It would be good to know before starting any I2C commands if the software or hardware I2CInitialize has already been started. The program could then send out a error message if desired.

Thank you
Tim C

User avatar
David Barker
Swordfish Developer
Posts: 1214
Joined: Tue Oct 03, 2006 7:01 pm
Location: Saltburn by the Sea, UK
Contact:

Post by David Barker » Thu Dec 07, 2006 6:19 pm

The compiler won't be able to detect if it has been initialised or not, if that is what you mean.

If you are writing a module that uses I2C, you can call 'Initialize' from within the code section of the module to ensure it is called before the main program executes. However, you will probably need a few #options to enable the user to configure hardware I2C.

Personally, I think an explicit call to Initialize (or your modules Initialize) is probably a better idea in most cases.

Post Reply