CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

PIC-to-PIC communication with one pin

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
valemike
Guest







PIC-to-PIC communication with one pin
PostPosted: Thu Mar 03, 2005 10:11 am     Reply with quote

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

View user's profile Send private message

PostPosted: Thu Mar 03, 2005 10:23 am     Reply with quote

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







PostPosted: Thu Mar 03, 2005 10:52 am     Reply with quote

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

View user's profile Send private message

PostPosted: Thu Mar 03, 2005 12:06 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Thu Mar 03, 2005 12:44 pm     Reply with quote

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

View user's profile Send private message Send e-mail

PostPosted: Thu Mar 03, 2005 1:02 pm     Reply with quote

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







PostPosted: Thu Mar 03, 2005 1:49 pm     Reply with quote

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.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group