View previous topic :: View next topic |
Author |
Message |
AKA TENDO
Joined: 25 Jan 2023 Posts: 47
|
Communication PIC16F to PIC16F with i2c and CCS |
Posted: Thu Jan 26, 2023 4:06 am |
|
|
Hi everybody, im working on a project wher i have to make 2 pic16f communicate. I've found some examples on internet but no one with pic16f this is why im posting on this forum. This is the link of the only good example that i have :
http://hades.mech.northwestern.edu/index.php/I2C_communication_between_PICs
Any ideas are welcome.
Best regards. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19520
|
|
Posted: Thu Jan 26, 2023 4:09 am |
|
|
There are examples for master and slave communication in the examples
folder for the compiler. The '16F' makes no difference at all, provided the
PIC's you are using have the MSSP peripheral. A slave requires the hardware
peripheral, so cannot be done on a PIC that does not have this. |
|
|
AKA TENDO
Joined: 25 Jan 2023 Posts: 47
|
|
Posted: Thu Jan 26, 2023 7:49 am |
|
|
Ttelmah wrote: | There are examples for master and slave communication in the examples
folder for the compiler. The '16F' makes no difference at all, provided the
PIC's you are using have the MSSP peripheral. A slave requires the hardware
peripheral, so cannot be done on a PIC that does not have this. |
i found it, thank you. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19520
|
|
Posted: Thu Jan 26, 2023 8:24 am |
|
|
Also look in the code library. There is at least one example pair there. |
|
|
AKA TENDO
Joined: 25 Jan 2023 Posts: 47
|
|
Posted: Thu Jan 26, 2023 8:27 am |
|
|
Ttelmah wrote: | Also look in the code library. There is at least one example pair there. |
Excuse me but what do you mean by "code library"? |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19520
|
|
Posted: Thu Jan 26, 2023 11:17 am |
|
|
Aaargh!.....
You do realise this is not the only part of this forum.
Above the top bar of the forum itself, to the right of the button 'new topic',
there is a label 'CCS Forum Index'. Click on this, and you have a list of
half a dozen forum sections. The second one down is the Code Library.
Here people post code 'of interest' to members. Select this. There are some
of the most important code pieces here. For example PCM's I2C bus scanner
program (vital when working with I2C), and the Flex LCD driver.
In there, there is an I2C Master and Slave example. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9229 Location: Greensville,Ontario
|
|
Posted: Thu Jan 26, 2023 11:24 am |
|
|
in the FAQ section of the CCS manual there's an easy way to connect 2 PICs using 1 wire, or of course 'RS232' can be used...
Hmm do you HAVE to use I2C ? I just offered other ways it can be done, but if the teacher says 'I2C', then you'll need to use I2C.
Be sure to have the I2C bus pullup resistors. usually 4k7 if VDD is 5 volts.
Last edited by temtronic on Thu Jan 26, 2023 3:09 pm; edited 1 time in total |
|
|
AKA TENDO
Joined: 25 Jan 2023 Posts: 47
|
|
Posted: Thu Jan 26, 2023 12:56 pm |
|
|
Thank you guys for your answers ^^, excuse me for my stupid questions but this is my first time on this forum.
We reached to send data to slave but i think your answers will help me to improve the code. I will check tomorrow if we need something else then i might post again, thanks you guys. Best regards. |
|
|
|