CNCzone.com-The Largest Machinist Community on the net!



Home Page Mark Forums Read Today's Posts My Replies Classifieds Reviews Photo Gallery Web Links Share Files Advertise With Us Ad List
Go Back   CNCzone.com-The Largest Machinist Community on the net! > Electronics > PIC Programing / Design


PIC Programing / Design Discuss programing of PIC chips here and design of electronics using PIC chips.


Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Ban this user!
Old 11-06-2009, 10:28 AM
 
Join Date: Jul 2007
Location: Argentina
Posts: 77
patriciooholegu is on a distinguished road
what to do with unused pins on 16f84??

Hey people.
The past months i was trying to program and compile some pic programs for the well known 16f84a.
The question never really clear to my is...What to do with unused pins on it? Oh!, use pull-up/down resistors!!
Well but i don't now exactly which to use in different situations.
Right now i have almost finished my program but:
Port a play as input and 2 pins unused.
Port b play as output and 2 pins unused.
Assuming that i now there are build in pull-up resistors on port b, but want to use external parts anyway...
The questions are this:

1- when should i use pull-up resistors on port a?
2-When should i use pull-down resistor on port a?
3- when should i use pull-up resistors on port b?
4-When should i use pull-down resistor on port b?

Also: What values are suggested? Or there it is some formula for calculate this?. For direct connection to pc parallel port are 4k7, 5k, or 10k Ohm suggested? (Those values are the most commons i find on the web always).Wich is the best value?

Well that´s the questions. You may think that i´m a little newbie with this and you are right so forgive me. Also forgive the writing. I´m from Argentina and speak Spanish all days.
Reply With Quote

  #2  
Old 11-06-2009, 10:43 AM
Al_The_Man's Avatar
Community Moderator
 
Join Date: Dec 2003
Location: Canada
Posts: 16,544
Al_The_Man is on a distinguished road
Buy me a Beer?

You may find alot of answers on the ChipMicro User forum also.
http://www.microchip.com/forums/Default.aspx?
Al.
__________________
CNC, Mechatronics Integration and Machine Design.
“Logic will get you from A to B. Imagination will take you everywhere.”
Albert E.
Reply With Quote

  #3   Ban this user!
Old 11-06-2009, 10:53 AM
 
Join Date: Jul 2007
Location: Argentina
Posts: 77
patriciooholegu is on a distinguished road

well i have searched the topic all over the web but not find any direct answer to this direct questions i made before.

Again:
when to use pull-up or down on port a if it is in or out?
The same for port b.

I know there is a lot of info but not so direct like i need.
Let my remind that i´m a newbie on this of pic programing and already have my head rolling with the learning stage of it.
Thanks!!
Reply With Quote

  #4  
Old 11-06-2009, 11:25 AM
Al_The_Man's Avatar
Community Moderator
 
Join Date: Dec 2003
Location: Canada
Posts: 16,544
Al_The_Man is on a distinguished road
Buy me a Beer?

There is a nice tutorial on Nigel Goodwin site.
http://www.winpicprog.co.uk/pic_tutorial.htm
See the section on inputs and outputs.
Although he changed the tutorial from 16F84 to the cheaper 16F628.
The 16F84 sink and source as output for port A is source 80ma and sink 50ma.
For port B it is source 150ma sink 100ma.
So any pull up or pull down can be calculated at 5v.
Al.
__________________
CNC, Mechatronics Integration and Machine Design.
“Logic will get you from A to B. Imagination will take you everywhere.”
Albert E.
Reply With Quote

  #5   Ban this user!
Old 11-06-2009, 12:09 PM
 
Join Date: Jul 2007
Location: Argentina
Posts: 77
patriciooholegu is on a distinguished road

Okay man thanks for the link´s.
I read it but can´t find more than this 5 or 6 lines about in-out conditions. not too much about pull-up/down resistors... or i miss it.
If there is anyone who can reply these questions i made before i will be very happy.
It is for using a stepper driver board i savaged from a HP scanjet 5100c scanner.
For less than us$ 5 in components (pic 16f84, xtal, capacitors and all the rest) will make an interesting all-in-one stepper + driver + power supply. All of this in one board. Not to powerful but useful for small projects.
Wen finished and tested will upload the pack on cnczone (PCB layout, hex files, pictures).
Reply With Quote

Sponsored Links
  #6   Ban this user!
Old 11-06-2009, 12:39 PM
 
Join Date: Jun 2008
Location: Canada
Posts: 70
george4657 is on a distinguished road

I have not had any problem leaving a pin floating if it did not matter to the program.
A floating input can read as 1 or zero.
If you are not trying to squeeze out the very minimum current drain then to be safe tie pins to ground with 10k resistors. The difference in current draw will be very small.
When developing a new project I run unused pins to an external pioint as I later will find a use for it and want to tie into it for testing new feature.
I always run out of pins before running out of new features
George
Reply With Quote

  #7  
Old 11-06-2009, 01:19 PM
Al_The_Man's Avatar
Community Moderator
 
Join Date: Dec 2003
Location: Canada
Posts: 16,544
Al_The_Man is on a distinguished road
Buy me a Beer?

....As George said.
This is the link for general use of I/O.
http://www.winpicprog.co.uk/pic_tutorial_extras.htm
Al.
__________________
CNC, Mechatronics Integration and Machine Design.
“Logic will get you from A to B. Imagination will take you everywhere.”
Albert E.
Reply With Quote

  #8   Ban this user!
Old 11-06-2009, 01:21 PM
 
Join Date: Jul 2007
Location: Argentina
Posts: 77
patriciooholegu is on a distinguished road

Thanks George. For what i have read so far the best is to tie unused pins to ground with 10k resistor in the middle, right?
The unused output pins will always be 0 and the inputs will not have any signal to go hight, so all of them should go to PULL-DOWN with 10k resistors.
Like this:
ground---10k resistor---unused input pin port a
ground---10k resistor---unused input pin port b

The --- means wire...

I will use portA pins 0,1,2 as input, and portB 0,1,2,3,4,5 as output, but unused portA pins 3,4 and portB pins 6,7 will by pulled-down.
Is that correct?
Reply With Quote

  #9   Ban this user!
Old 11-06-2009, 02:07 PM
 
Join Date: Jun 2008
Location: Canada
Posts: 70
george4657 is on a distinguished road

ground---10k resistor---unused input pin port a
ground---10k resistor---unused input pin port b

That's right
Reply With Quote

  #10   Ban this user!
Old 11-06-2009, 11:49 PM
 
Join Date: Aug 2005
Location: U.S.A
Posts: 52
Megahertz is on a distinguished road

Microchip PICs use FET transistors. FET transistors draw the most current when they are switching states from high to low (or reverse). Therefore, to stop the extra quiescent current draw from floating and unused INPUTS; They should be tied either high or low with a resistor. The default configuration for pins are input. You do not need to pull-up or pull-down OUTPUT pins.

Just my opinion.
Reply With Quote

Sponsored Links
  #11   Ban this user!
Old 11-07-2009, 07:10 AM
 
Join Date: Jul 2007
Location: Argentina
Posts: 77
patriciooholegu is on a distinguished road

Originally Posted by Megahertz View Post
Microchip PICs use FET transistors. FET transistors draw the most current when they are switching states from high to low (or reverse). Therefore, to stop the extra quiescent current draw from floating and unused INPUTS; They should be tied either high or low with a resistor. The default configuration for pins are input. You do not need to pull-up or pull-down OUTPUT pins.

Just my opinion.
"You do not need to pull-up or pull-down OUTPUT pins" you say?

Thats right. output pins dont need pull-up/down resistors because they are at 0 volts all the time and will be like that ALWAYS.
So the the other question in my mind as beign answered?:
unused input pins should be pulled down with 10k resistors, and NO NEED FOR ANYTHING ON OUTPUT PINS?
Reply With Quote

  #12   Ban this user!
Old 11-24-2009, 02:13 PM
RPCElectronics's Avatar  
Join Date: Jul 2009
Location: USA
Posts: 144
RPCElectronics is on a distinguished road

Personally, I leave all of my un-used PIC pins floating. If I am not polling them in firmware for a state change to cause somthing to happen, I don't care what they are doing. If you never check the state, you should'nt have them affect anything. I also avoid pulling them high or low in cases where I might have for example the lower nibble of PORTB used and the upper nibble unused and I just want to read the entire port with somthing like:

Code:
unsigned  char x;

x = PORTB;
If any of the upper nibble were pulled high, I would get a value from PORTB that was higher than 16. THIS IS JUST AN EXAMPLE. Of course, I could mask those top nibble bits, but that is another line of code

Just my $0.02
__________________
Jason
RPC Electronics, LLC - www.rpc-electronics.com
Reply With Quote

Reply




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need Help!- 16F84 7 segment display Razer PIC Programing / Design 8 06-10-2009 11:27 AM
DAKENG u-2 16f84 stepper translator vacpress PIC Programing / Design 2 12-13-2005 07:58 AM
New unused DC Servo Controller... Dave's_Not_Here Servo Motors and Drives 4 06-07-2005 03:32 PM




All times are GMT -5. The time now is 03:49 AM.





Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
Content Relevant URLs by vBSEO
Template-Modifications by TMS

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361