Straight to ground is fine.
Straight to ground is fine.
Dave
Always wear safety glasses while programming.
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...
Pull-down/Up may also be useful as test point or for future modification.
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
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.
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.
it's not a bad idea to refresh at least TRIS register while your program is running. ... at least for safety sake.
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
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.
Who's John?
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
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
Last edited by JohnH; - 4th May 2007 at 01:36.
Bookmarks