Page 1 of 1

PIC to PIC Comms

Posted: Sun Nov 09, 2014 10:36 pm
by jbs4wd
Hi,
This may have already been addressed but can't find it so please point me in the right direction.
I am using 18F46K22. My project is simple at this stage just trying to get two pic to talk to each other via I2C. I want Pic A to send a request to Pic B for an ADC value and to display this value on an LCD. Then if this value is a certain value Pic A to send a request to Pic B to turn on an LED. What I am asking is, is there a I2C tutorial or the like to get two PICs talking to each other?

Cheers
JOHN

Re: PIC to PIC Comms

Posted: Mon Nov 10, 2014 12:31 am
by kersing
Check this blog post (Slave is available in the current release)

Re: PIC to PIC Comms

Posted: Mon Nov 17, 2014 12:41 am
by jbs4wd
Thanks, am now trying to work on RS232. Again to no avail. Could someone please have a look at my progs and tell me what I'm doing wrong. Hardware wise the two pics are connected together via TX1 and RX1 (25 & 26), and yes Tx-Rx.
Cheers
John

Re: PIC to PIC Comms

Posted: Mon Nov 17, 2014 6:13 pm
by QMESAR
Hi
I made a small example for you which show how you can use the RS232(UART) component to make two PIC's talk

you will see that PICA reads a analog signal at AN0 (a byte) then send it to PICB over UART ,PICB receives the byte in the UART Rx Interrupt and disiplay the value of the AN0 signal on PORTB .
as you change the signal on PICA AN0 the leds on PICB will follow the Analog to digital conversion done by PICA.

You need only to change the devices selected to your devices and do the configuration
my Projects use PICA = PIC18F45K22, PICB = PIC18F4585

The Connections between the 2 PIc's is as follows

PICA PICB
Rx --> Tx
Tx --> Rx
Gnd Gnd

this is how it look on my test board

Hope this helps you :D

Re: PIC to PIC Comms

Posted: Mon Nov 17, 2014 11:32 pm
by jbs4wd
That helped heaps. Thanks.

Re: PIC to PIC Comms

Posted: Tue Nov 18, 2014 5:39 pm
by QMESAR
you are welcome :D