Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

PIC to PIC Communication

Status
Not open for further replies.

chevymn1964

Full Member level 2
Joined
Apr 1, 2006
Messages
120
Helped
2
Reputation
4
Reaction score
0
Trophy points
1,296
Location
Santa Rosa, Ca.
Activity points
2,551
interfacing 6n136 to max232

Hey everyone! Im working on the planning of a new project.... What I need to do is communicate betwen two circuits that each have a PIC ( 16F84 ). Should I use a comm chip or would it be ok to run one wire between an I/O pin on each PIC? The distance of the wire would be about 3 feet.... If I do need to run a comm chip, I would like to use one wire so, what chip should I use? both circuits would share the same ground..... Any ideas out there? thank you!
 

If you environment doesn't have a lot of EMI, you don't need transceiver chips (like MAX232) for 3ft. If PIC1 only transmits and PIC2 only receives, connect the TX of the PIC1 to the RX of the PIC2, an you're set. If yu want bidirectional communication, you'll need 2 wires. With cleverness and extra hardware, you can get away with one, but i my mind, it's just not worth it, when the distance is only 3ft.
 

okay, thank you kender... It looks like im on the right path then.... Why add the extra cost if you dont need it! lol thanks
 

Sometimes it is a must to have MAX232 for a PIC project because it allows you to connect the mcu to a PC for program debug, unless you are so sure the PIC program is bug free. Suppose you are connecting two PICs with their program running, but nothing happen as expected, which one of the boards / PICs goes wrong?

There is a very good program called Docklight for monitoring RS232 port.

There is also a good reference on Networking and Internetworking with Microcontrollers by Fred Eady. Nice book, good value.


John
 
Last edited by a moderator:

Oh, I think this is easy to communicate 2 PIC 16f84A. I remember that 16f84a has UART module, which use for communicate serial (like RS232). You do not need a MAX232 because you don't need to change the voltage (remember PC RS232 volatge logic is from -25V to 25V).
So, that's all. If Im wrong and 16f84a hasn't a UART module, you will need to use PIC16F88 .
Cheers!
 

wonbinbk - the 16F84A does not have a USART

I suggest you choose a PIC with USART/EUSART

make life easy!
refer to for good description and source code:

**broken link removed**

**broken link removed**
this gives hadware ideas aswell.


for short distances - 3ft - simple 0-5v can be used - no need for max232
if you talk to PC the UART in PC clips RS232 inputs to +5V - 0v.

regards Polymath
 

I would suggest you use another PIC like the 872 or so that supports communication. Then u can use SPI-the interface designed for communication by microchip. Offcourse it becomes a bit more complex than using th 16f14 but then the benefits and flexibility inceases. But if you have to use that one i see no reason as to why you would need to add a chip in between them as the distances are rather small and logig levels will not change over those. One consideration though is the two PICs should have a common power source as there might be problems with different grounds.
 

Hi,
You can also tr to use the I2C bus, that way you have 2way communications and only use 2 wires as opposed to the 3 wires SPI requires.
Cheers
Slayer
 

As was mentioned earlier, the simplest hardware solution is to use a single io on each pic. Tie them together and bit bang them. Enable the output only when transmitting so it will be bidirectional. If you plan to directly connect the io's in this manner, it might be worthwhile to insert a small series resistance as a crude form of circuit protection (perhaps 100Ω).

Don't Overlook the Grounds!
Unless both pics share a common power supply, you must have a ground connection between them somewhere. Make sure there is one and only one ground connection; multiple ground connections will most likely result in a ground loop, and this can destroy the pics if they have unbuffered io's.

Watch out if either pic is connected to other external circuitry. Currents from outside circuits can elevate the connected pic's ground with respect to the other pic. At best, this will cause perturbations in communications. At worst, it will irreparably damage the pics. If you plan to do this (and I expect you do), you can easily opto-isolate the inter-pic communications with a couple of 6N136 or similar devices.
 

Why not using one-wire protol if you need low data transfer rate ?!
 

go either for software based i2c ....it is good
 

can any one help simplest form of code ..how to communicate with rf sensors and rx ,tx ... in pic 16f84a
 

actually distance is not an issue, it is depend on your application, you may use pic 10F to drive servo motor (pic 1) and you have master controller (pic2) to do other job (modular systems). You may use program to perform serial communication, not necessary to use PIC with dedicated serial comm pin. Kander is correct you do not need max 232 transceiver chip, becasue you are at logic (TTL)level (pic to pic) and not at RS232 signal level.
If you environment doesn't have a lot of EMI, you don't need transceiver chips (like MAX232) for 3ft. If PIC1 only transmits and PIC2 only receives, connect the TX of the PIC1 to the RX of the PIC2, an you're set. If yu want bidirectional communication, you'll need 2 wires. With cleverness and extra hardware, you can get away with one, but i my mind, it's just not worth it, when the distance is only 3ft.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top