|
|
View previous topic :: View next topic |
Author |
Message |
Kit Guest
|
when do we need port_b_pull-ups()? |
Posted: Tue Aug 09, 2005 12:54 am |
|
|
I am not sure what is the purpose of using port_b_pull-ups().
Is it either all pins are pull up? can I pull up individual pin?
I am using PCM 3.180, PIC16F628A. |
|
|
Ttelmah Guest
|
|
Posted: Tue Aug 09, 2005 5:29 am |
|
|
Key thing is that a pin set as an input, can float to any voltage. Now if you are attempting to read a signal that only 'drives' the line part of the time (for instance a switch, which will only drive the line when 'closed'), then there is no guarantee what value the signal will go to, when the switch is open. The solution is to add a very large value resistor, which draws just enough current to take the line to a 'determined' value (either high, or low). Now the pull up 'resistors', are not actually resistors, but current sources, but the behaviour is basically the same. The behaviour of thse changes from chip to chip, with some offering 'per pin' settings, and others only offering a global 'on/off'. On the 16F628, the pull-ups all turn on together. However the current involved is very low (200uA/pin), so this is not normally a problem.
Best Wishes |
|
|
Kit Guest
|
|
Posted: Wed Aug 10, 2005 4:08 am |
|
|
Could i say, the general rule is setting the port_b pullup to true. Is that saying, setting portb pulls up to true no matter in what situation is no harm at all? |
|
|
eaton2 Guest
|
|
Posted: Wed Aug 10, 2005 4:57 am |
|
|
not necessarily. I have had a situation where the pull-up interfered with an incoming signal. Even though the enable is global, If you set a pin as an output the pull-up is disabled. If you are using pins for inputs from switches the pull-ups are great. They reduce your parts count on the PCB. I have found that it is wise to fully test circuit operation with the pull-ups enabled before commiting to it in a prouction ckt.
regards |
|
|
|
|
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
|