View previous topic :: View next topic |
Author |
Message |
MikeValencia
Joined: 04 Aug 2004 Posts: 238 Location: Chicago
|
Is this a valid circuit? (picture attached) |
Posted: Thu Aug 11, 2005 8:58 am |
|
|
Currently, I don't have pin ECCP attached, but only CCP1 is attached. However, i'm finding that I need the other ECCP attached. (This is just a slice of a bigger picture, in case you were wondering why i'd want to do such a thing).
Basically, my question is: Can I have two PIC pins shorted together, while taking care that no two are ever outputs at the same time? One will be an input (thus Hi-Z) while the other is an output, and vice versa.
Or are there any precautions I must take?
Reason why i want to do this hw kludge is because 1) it is too late to change the hw, and 2) it'll save me a few more resistors and opto.
|
|
|
asmallri
Joined: 12 Aug 2004 Posts: 1634 Location: Perth, Australia
|
|
Posted: Thu Aug 11, 2005 9:10 am |
|
|
Yes this is a valid config. What is R1 meant to do? _________________ Regards, Andrew
http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!! |
|
|
MikeValencia
Joined: 04 Aug 2004 Posts: 238 Location: Chicago
|
|
Posted: Thu Aug 11, 2005 9:39 am |
|
|
asmallri wrote: | Yes this is a valid config. What is R1 meant to do? |
Actually, my opto is an H11L1M schmitt trigger output.
R2 is a current limiting resistor, while R1 just keeps it pulled up to prevent the opto from firing 'by itself'.
You're right, i probably don't need the R1 pullup, since an opto can never turn on 'by itself'. If the pic pins are inputs (hi-z), the opto's led will never conduct, and if a pic pin is an output, then R1 is useless.
Now, perhaps a pulldown resistor would be necessary if that was my intended default value, right? |
|
|
MikeValencia
Joined: 04 Aug 2004 Posts: 238 Location: Chicago
|
|
Posted: Thu Aug 11, 2005 10:06 am |
|
|
Is there ever an event (except a programming error) that can turn both pins simultaneously into outputs? If so, then i can potentially fry the PIC pins effectively shorting 5V to Gnd? Perhaps a 220ohm current limiting resistor should be placed between the two pins.
But like i said, i'd be hand-soldering a jumper between the two pins on a previously manufactured board, and anything else would sooner require a new board spin (and tooling charges! ), not to mention a bunch of scrapped boards! |
|
|
asmallri
Joined: 12 Aug 2004 Posts: 1634 Location: Perth, Australia
|
|
Posted: Thu Aug 11, 2005 10:57 am |
|
|
Quote: | while R1 just keeps it pulled up to prevent the opto from firing 'by itself'. |
In this case you do not need R1.
Quote: | Is there ever an event (except a programming error) that can turn both pins simultaneously into outputs? If so, then i can potentially fry the PIC pins effectively shorting 5V to Gnd? Perhaps a 220ohm current limiting resistor should be placed between the two pins. |
None I can think of and this configuration is actually not unusual. It is not much different than driving a bi directional data bus with a PIC IO port. Even if you configured both ports as an output with one driving low and the other driving high you are very unlikely to damage the PIC - they are pretty rugged beasts. Now connect a pin to -0.8 volts or more and thats another story :-)
[/code] _________________ Regards, Andrew
http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!! |
|
|
|