Communication between 2 microchips
Moderator: Benj
- Jan Lichtenbelt
- Posts: 797
- Joined: Tue Feb 17, 2009 8:35 pm
- Location: Haren GN, the Netherlands
- Has thanked: 128 times
- Been thanked: 264 times
- Contact:
Communication between 2 microchips
I have two inputs/ouputs left (E0 and E1 of PIC16F877A) and need to send an address and a data byte to an other microchip. What kind of communication do you advise?
- 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:
Re: Communication between 2 microchips
Hello Jan
I would advise using the RS232 in software mode.
There is no buffering for the software mode so you will need to ensure that the receiver is listening by keeping the main loop fairly clear or using flow control or using a INT interrupt pin to flag that an incoming byte is being received. Option 1 or 2 are probably the easiest to implement.
I would get this working using a new set of programs and then once you are happy with the results try and plug it into your existing program.
I would advise using the RS232 in software mode.
There is no buffering for the software mode so you will need to ensure that the receiver is listening by keeping the main loop fairly clear or using flow control or using a INT interrupt pin to flag that an incoming byte is being received. Option 1 or 2 are probably the easiest to implement.
I would get this working using a new set of programs and then once you are happy with the results try and plug it into your existing program.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
- Jan Lichtenbelt
- Posts: 797
- Joined: Tue Feb 17, 2009 8:35 pm
- Location: Haren GN, the Netherlands
- Has thanked: 128 times
- Been thanked: 264 times
- Contact:
Re: Communication between 2 microchips
The alternative is I2C. Is that not easier? What are the advantages/disadvantages?
- 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:
Re: Communication between 2 microchips
Yes I2C is an alternative however I suggest using RS232 as there is currently no I2C slave component for Flowcode and therefore you would have to manipulate the I2C registers using C code to put it into a slave mode. This could be fairly tricky to get working unless you have a good understanding of C.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
electronix
- Posts: 58
- Joined: Sat Aug 22, 2009 5:45 pm
- Has thanked: 17 times
- Been thanked: 7 times
- 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:
Re: Communication between 2 microchips
RXINT only works with hardware UARTs using RS232. If your in software mode then you have to monitor the input either using flowcontrol or by using a pin interrupt to detect the start bit of the transaction and then collect the data manually.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel