Help wanted I2C

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 2 and 3.

Moderators: Benj, Mods

Post Reply
MJU
Posts: 502
Joined: Wed Nov 07, 2007 6:51 pm
Location: Antwerp Belgium
Has thanked: 121 times
Been thanked: 108 times

Help wanted I2C

Post by MJU »

I want to make a simple thing with Flowcode/Eblocks.

I just want a temperature sensor to send it's data to the PIC and make this value visible on the LCD.
I got a tip to use the National LM92 temp sensor that uses I2C to communicate with the PIC.

Can I use any PIC?
I have a 16F88 and a 16F877A to play with.
To which ports the I2C bus macro is connected?

As far as I can tell I give the temp sensor a unique address and when I call this with the I2C macro, it returns a value for the temp which I can use?

Where can I find more info about the I2C macro in Flowcode?
Is there someone that can help me start with this feature?

As far as I can see, I can setup many temp sensors on the two wires of the I2C bus and by calling them with the macro?
Anything I should know about the I2C macro is welcome..

User avatar
Steve
Matrix Staff
Posts: 3433
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 114 times
Been thanked: 422 times

Post by Steve »

Flowcode's I2C component can be used in "hardware" mode (i.e. using the chip's internal MSSP module) or in a "software" mode (where the I2C protocol is created in code).

Using the latter means that any chip can be used.

The actual data you need to transmit to communicate with the temperature sensor will be found in that device's datasheet. Typically, you send a "start" bit, then an address byte, then read the sensor's data and finally send a "stop" bit.

You should be able to set a unique bus address for that sensor chip - and you will be able to attach as many devices onto the bus as you have unique addresses.

The I2C component has a help file (go into the component's property page and press "help", or look for the file in the "Flowcode V3" directory.

MJU
Posts: 502
Joined: Wed Nov 07, 2007 6:51 pm
Location: Antwerp Belgium
Has thanked: 121 times
Been thanked: 108 times

Post by MJU »

Thanks Steve!

I've read the helpfile several times but what i'm looking for is an example.
Just a simple way for me to see how i can receive data from an I2C "slave".

I read the helpfile but things like this:
Transmit the External Device address with the LSB cleared
How is this done?

If i could find an example i could figure it out for myself :-)

User avatar
Steve
Matrix Staff
Posts: 3433
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 114 times
Been thanked: 422 times

Post by Steve »

I'll ask Ben to post an example onto the web for you.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Post by Benj »

Hello

Here is an example program that shows how to read a byte from a typical I2C device.

http://www.matrixmultimedia.com/softwar ... e_Byte.fcf

It also shows how to manipulate the address to start the read or write transaction.

MJU
Posts: 502
Joined: Wed Nov 07, 2007 6:51 pm
Location: Antwerp Belgium
Has thanked: 121 times
Been thanked: 108 times

Post by MJU »

Thanks very much!!

Still not quite clear, but I will get it sooner or later :)

Post Reply