PDA

View Full Version : I2C slave



Stump
- 18th February 2005, 01:33
Greetings eh!
Firstly Thanks to all users of this forum.
All the issues I encountered over the past 6mo
were solved from postings on this forum.

A special thanks to Mel... MN1307.txt demonstrated
a lot more than just reading and setting an RTC.
(my own similar program was more than 2x in size)

Now to business..

A master control using 18F6720 is to send and receive data from up to 12 slave pics
(possibly 18F252) located up to 5 meters from the master using I2C.
Each slave is located in a seperate enclosure and will be opto isolated.

1) Can the master control have more than one I2C bus?
one for on board accessories RTC,eeprom,etc,
and a second buffered i2c bus to talk to the slave modules.
ref... i2cslave.bas & i2cmast.bas

2) What exactly does "DEFINE I2C_HOLD" do?
2a) does this affect the hardware i2c or the software i2c or both
2b) will this affect the use of RTC and eeprom on the software controlled bus

3) would RS485 or other be a better choice?
Thanks Kindly
Ron

mister_e
- 18th February 2005, 02:49
Have slave/master in I2C ?!? Not sure it will be the easy or appropriate way... a simple RS485 network will do the job.

You can place up to 8 I2C device on the same pair of wire if they have the capability of. The only things you have to do, is to change their A0-A3 setting bits(kinda chip select) to access them separatley and have the according Control Word to access them.

I've never see any application for this I2C_slow stuff. All i2C that i use support the high speed communication.

To resume, in your case, i'll prefer using RS485 network ICs + all I2C device you have on the same pins.. if they supported this.

NavMicroSystems
- 18th February 2005, 14:36
A master control using 18F6720 is to send and receive data from up to 12 slave pics
(possibly 18F252) located up to 5 meters from the master using I2C.
Each slave is located in a seperate enclosure and will be opto isolated.

With PBPs I2C Routines your PIC acts as a Master, you would have to write your own Routines to make the PIC act as I2C-Slave



Can the master control have more than one I2C bus?
one for on board accessories RTC,eeprom,etc,
and a second buffered i2c bus to talk to the slave modules.


No Problem,
I use two I2C buses on several of my projects, one "internal" for RTC, EEPROM, etc. and one "external" bus for I2C I/O Expanders (PCF8574)



would RS485 or other be a better choice?


Well, for PIC2PIC communication with more than 2 PICs sharing the same bus
I would prefer RS485 due to it's robustness.

Stump
- 18th February 2005, 15:24
Thanks for the replies and advice
A major question is still unanswered though..

Will "DEFINE I2C_HOLD 1" affect multiple i2c buses
and will this command affect normal operation with
RTC & EEprom?
Thks
R

NavMicroSystems
- 18th February 2005, 15:45
Stump

I would assume this is a "global" DEFINE
so it would affect each bus being used with I2CWRWITE / I2CREAD.

I guess you have to check the datasheets of the RTC / EEPROM you are using to see wether or not there would be an effect.

What I can tell so far is:
24FC512 and DS1307 work fine even with this DEFINE.