|
|
View previous topic :: View next topic |
Author |
Message |
Wridmuld
Joined: 02 Apr 2004 Posts: 15
|
Is it possible to have two 16F84A communicating through i2c? |
Posted: Thu Apr 29, 2004 5:46 am |
|
|
I am doing a project where I get a value from a A/D converter (pcf8591) into my 16F84. Those values are supposed to be sent to another 16F84, preferrably on the i2c-bus.
Is this possible?
It seems to be possible to make the 16F84 a slave, but nowhere on the net have I found one single example of this.
Or are both devices supposed to be set as masters and somehow poll the bus? And if so - which address should I use?
Does anybody know if that has been done, or how?
It is of course possible to use some other interface, but if i2c is at all possible, I would like to use it.
thx
/Wridmuld |
|
|
Ttelmah Guest
|
Re: Is it possible to have two 16F84A communicating through |
Posted: Thu Apr 29, 2004 7:57 am |
|
|
Wridmuld wrote: | I am doing a project where I get a value from a A/D converter (pcf8591) into my 16F84. Those values are supposed to be sent to another 16F84, preferrably on the i2c-bus.
Is this possible?
It seems to be possible to make the 16F84 a slave, but nowhere on the net have I found one single example of this.
Or are both devices supposed to be set as masters and somehow poll the bus? And if so - which address should I use?
Does anybody know if that has been done, or how?
It is of course possible to use some other interface, but if i2c is at all possible, I would like to use it.
thx
/Wridmuld |
It is 'possible', but not really practical. The 16F84, does not have hardware I2C. As such the whole interface has to be handled in software. Getting the timing right for a slave, would be very difficult indeed. The CCS code does not support this, and even if done, there would be very severe limitations on the master timings, if the software slave was to handle the interface correctly. If you want to do this, you would be far better off selecting a chip that has hardware I2C. Even using 'another interface', will be have significant timing restriction, since there is no hardware UART either...
Best Wishes |
|
|
rnielsen
Joined: 23 Sep 2003 Posts: 852 Location: Utah
|
|
Posted: Thu Apr 29, 2004 8:33 am |
|
|
You could select the 16F87 which has the same pin count, more memory, UART/I2C/SPI interface and also costs LESS. It would be quite easy to have multiple ones connected to the I2C bus.
I have a device where I have a 16F87 communicating with a sensor. There are ten of these units that are connected to the I2C bus. They are each set up for Slave mode. The PIC communicates to the sensors thru descrete I/O pins. I also have an 18F452 set up as the Master to communicate with the ten slaves. The master displays the data on a LCD screen and also to our local network.
This took a bit of playing around with the code for both PIC's but it is quite doable. I used various posts, from this forum, to help with my code. There are a lot of knowledgeable people in here.
Ronald |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|