View previous topic :: View next topic |
Author |
Message |
valemike Guest
|
PIC-to-PIC communication with one pin |
Posted: Thu Mar 03, 2005 10:11 am |
|
|
I've got two pics. I plan to connect them to each other the following way:
PIC1_pin --- 470 ohm series resistor --- PIC2_pin
PIC1 will drive the pin high and low as an output. PIC2 will always be configured as an input.
Is there anything potentially unsafe by doing this? I've heard it is safest to use an open drain output (RA4), but this connection was an afterthought of a current design, and i don't have RA4 free to use at the moment. I figure the 470 ohm resistor is sufficient to guard against the PICs source/sink current tolerances in case a malfunction accidentally turns them both into outputs. |
|
|
young
Joined: 24 Jun 2004 Posts: 285
|
|
Posted: Thu Mar 03, 2005 10:23 am |
|
|
I did see any problem with your design, because I used a lot of this kind of setup. In order to prevent them to become input as output, you can just simply set control register of that pin as input. |
|
|
valemike Guest
|
|
Posted: Thu Mar 03, 2005 10:52 am |
|
|
Young, it's not the initial setup of the TRIS registers of input and output that i'm concerned about. What worries me is when some sort of noise gets into the line, corrupts my TRIS registers for a moment, and inputs become outputs. That is why you hear of some people periodically reconfiguring the TRIS registers during runtime. |
|
|
Humberto
Joined: 08 Sep 2003 Posts: 1215 Location: Buenos Aires, La Reina del Plata
|
|
Posted: Thu Mar 03, 2005 12:06 pm |
|
|
valemike wrote:
Quote: |
PIC1 will drive the pin high and low as an output. PIC2 will always be configured as an input.
|
If you think that this configuration is unsafe, all you need to do
periodically is reconfiguring only PIC2 TRIS registers as
INPUT during runtime and connect both PICs
without any resistor.
Quote: |
What worries me is when some sort of noise gets into the line, corrupts my TRIS registers for a moment.
|
Mmm.. dont�worry. Good grounds paths, low impedance
power supply, decoupling capacitors, optoisolators, line filters, etc
are the tools to fight with. I have a lot of applications running in
industrial enviromentals and I never detect this kind of risk.
My $0.02
Humberto |
|
|
SherpaDoug
Joined: 07 Sep 2003 Posts: 1640 Location: Cape Cod Mass USA
|
|
Posted: Thu Mar 03, 2005 12:44 pm |
|
|
Assuming the two PICs have the same ground and VCC, I would not think the resistor in necessary. But it does no harm (besides the cost of a resistor) and is a little bit of extra insurance. If you use Standard I/O the input pin will be reset to input each time it is read.
When I use Fast I/O I tend to reset the I/O configuration each time through the main loop, which is usually several times a second unless I am performing an action, which means I just got a command, so the input must be working! _________________ The search for better is endless. Instead simply find very good and get the job done. |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Thu Mar 03, 2005 1:02 pm |
|
|
Put the resistor in there. And I have seen tris registers become corrupt during some of our ESD testing. I usually like to solve the problem with the suggestions like Humberto gave you. Then I stick the extra precaution of resetting the tris in the main loop. |
|
|
valemike Guest
|
|
Posted: Thu Mar 03, 2005 1:49 pm |
|
|
okay thanks guys, your comments give me a sense of assurance.
As was mentioned about ESD testing and corrupted TRIS registers, this may become an issue for me. I am using the ECCP in full bridge mode. Thus anything that corrupts the ECCP module or TRISD register can potentially have the harmful effect of "shoot-through", which would short 100VDC to ground!
Is there anything robust that can prevent this? One thing i thought of was to use logic gates to prevent shoot-through. But then I figured, "If latchup will happen to the PIC, it can likely happen to a logic gate too", so i didn't put any logic protection at all." Perhaps, the same condition might even cause the logic gate to malfunction and give me shootthrough, but the PIC itself didn't malfunction, thus the logic protection would be more of a nuisance than a help. |
|
|
|