View previous topic :: View next topic |
Author |
Message |
Slick05
Joined: 05 Feb 2005 Posts: 14
|
My Port B does not want to work |
Posted: Mon Feb 14, 2005 7:40 pm |
|
|
For some reason on the PIC18F458, when I set PORT B to output and output 0xFF onto LEDs they all light up except B5,B6,and B7. However all of the pins on PORT B work fine as input.
I think I just thought of something, maybe PORT B5,6,7 need a zero in order to light the LEDs, I will try it out. I have tried writing
pullups_b(true)
however, that only keeps PORTB high, which does me no good. But I have two pics and both of them do the same thing, so I know for sure I am doing something incorrect.
So if anyone could explain the problem that would great. It may also be the reason why I cant my program to interrupt when there is a change on PORT B.
Anyways easy programming... |
|
![](templates/subSilver/images/spacer.gif) |
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Mon Feb 14, 2005 9:24 pm |
|
|
Post a small test program. They only need a zero if you are sinking the current. PortB Pullups are for inputs, not outputs. |
|
![](templates/subSilver/images/spacer.gif) |
ckielstra
Joined: 18 Mar 2004 Posts: 3680 Location: The Netherlands
|
|
Posted: Tue Feb 15, 2005 2:11 am |
|
|
The functionality for many pins of the PIC processors can be configured from a choice of possible functions. Very likely the pins RB5, RB6 and RB7 in your setup are not configured for digital I/O but for another purpose.
RB5:
Is default configured for Low Voltage In-Circuit-Serial-Programming (ICSP). Add NOLVP to your #fuses statement if you want to use this pin for I/O. (and make sure to have removed any LVP option from this same line....)
RB6/RB7:
May be used for an In-Circuit Debugger.
Add NODEBUG to your #fuses statement (and remove any DEBUG option from this same line....)
Also check this option is not activated by a '#device ICD=true' statement in your code. |
|
![](templates/subSilver/images/spacer.gif) |
|