PDA

View Full Version : Unused pins



manxman
- 1st May 2007, 14:07
Sorry to go over old ground but I would appreciate some clarification. Various threads on this forum advise that all unused PIC pins should be configured as inputs and tied to ground to improve immunity to noise. However, can these pins be connected directly to ground or should it be via a (100K ?) resistor on each (unused) pin?

mackrackit
- 1st May 2007, 14:10
Straight to ground is fine.

skimask
- 1st May 2007, 15:39
Straight to ground is fine.

At the risk of starting another argument/discussion...
I don't know if I'd go straight to ground without a series resistor limiting the current to at least the pins current carrying capability, 25mA give or take. I'd throw at least a 200ohm resistor inline with it. I know the pin is set up as an input...but what happens if the program gets changed and the pin gets set up as an output with a logic high on it?
Assuming the program stays the way it should, then, yes, straight to ground on an input pin...I'm just thinking a bit out in left field...

mister_e
- 1st May 2007, 15:48
Pull-down/Up may also be useful as test point or for future modification.

peterdeco1
- 1st May 2007, 16:04
I have had port pins actually toggle their state from high to low, inputs to outputs, outputs to inputs and disable the HPWM because of spikes generated from a small hobby motor. NO, additional power conditioning did not help as the motor was completely isolated with it's own battery supply. All the PIC did was activate a relay. However, the PIC was only 1/2 inch from the case of the motor. Seems my problems went away by making all unused ports output low & leave them floating. I also repeated the tris command repeatedly in case a spike toggels it into an input to prevent a floating input situation.

manxman
- 1st May 2007, 16:04
So it seems the average answer is YES XOR NO! Yup, if I accidentally re-assign an unused grounded pin as output and make it high then we have a problem. To be safe I'll tie all unused pins low via 10K resistors.

Thanks guys.

mister_e
- 1st May 2007, 16:09
it's not a bad idea to refresh at least TRIS register while your program is running. ... at least for safety sake.

mackrackit
- 1st May 2007, 18:23
At the risk of starting another argument/discussion...


An argument is a statement (premise) or group of statements (premises) offered in support of another statement (conclusion).:D

I was not thinking about the pin changing to an output. A resistor is good insurance.

skimask
- 1st May 2007, 18:31
An argument is a statement (premise) or group of statements (premises) offered in support of another statement (conclusion).:D

Good point...let me rephrase myself...

At the risk of sounding like a complete idiot.............................. :)

peterdeco1
- 3rd May 2007, 19:43
Thank you for the suggestion John. At the time of the problem I tried EVERYTHING - caps, grounding the motor casing, separate battery supplies for PIC circuit and motor, etc. Seemed the the PIC was just too close to the motor itself (I had no control over this). But by repeating the commands constantly (especially the TRIS commands to keep inputs as inputs and outs as outs) and the HIGHs as HIGHs, etc., the problem vanished. I also had another motor problem where the HPWM was set to a specific duty cycle and intermittently become an output HIGH or output LOW. Again, after setting the HPWM, I constantly repeated the command in other parts where the program would go and that fixed it. Of course the program took more memory, but that wasn't an issue.

mister_e
- 3rd May 2007, 23:04
Who's John?

JohnH
- 4th May 2007, 00:25
Who's John?

That was me..

I sent peterdeco1 a private message regarding motor noise effecting A/D. My problem was solved by using .1uf caps from each motor lead to the motor's metal case. It seems to work with the small (noisy) hobby motors. I used shielded cable to the A/D inputs.


--John

mister_e
- 4th May 2007, 15:22
Welcome on the forum, and thanks to share your tips on the public area :D

JohnH
- 4th May 2007, 22:24
Welcome on the forum, and thanks to share your tips on the public area :D

Thanks Steve! I have learned a lot about Pic's from some of your posts and others here.

--John