View previous topic :: View next topic |
Author |
Message |
Ringo42
Joined: 07 May 2004 Posts: 263
|
why do I need a resistor on B6 |
Posted: Sun Apr 20, 2008 9:41 pm |
|
|
I'm using an 18f2455 but I have seen this on an 18f452 and a 16F877a.
If I don't have a pull resistor (up or Down) on pin B6 then the pic starts and stops erratically. Pulling it one way or the other fixes it. I have port B pullups turned on, but that does not help. I have tried setting it high, low and as an input in the code but it does not help. I'm using 4.07 now but have seen it in the past on 3.x (3.249 maybe).
I now put the resistor there by habit, but I just made a board with the 2455 and left it off and it acts weird, starting and stopping randomly. Adding a resistor fixes it. I just want to know why I need it, and if there is a fuse or something to fix it.
Thanks
Ringo _________________ Ringo Davis |
|
|
andrewg
Joined: 17 Aug 2005 Posts: 316 Location: Perth, Western Australia
|
|
Posted: Mon Apr 21, 2008 12:45 am |
|
|
You've probably got low voltage programming enabled. Did you mean B5 instead of B6? Some (many?) versions of the CCS compiler default to it being on, while hardly anybody uses it and it just causes problems like you've described.
Look for "#fuses lvp" and change it to "#fuses nolvp" and see what happens. _________________ Andrew |
|
|
Humberto
Joined: 08 Sep 2003 Posts: 1215 Location: Buenos Aires, La Reina del Plata
|
|
Posted: Mon Apr 21, 2008 5:08 am |
|
|
If ICD is enabled at programming time, (#define ICD=TRUE) Pin_B6 lose all other functions and
becomes an input.
It would be good to know a better description of your application, the seen error and the codes
involved regarding the setup of such pin.
Humberto |
|
|
Ringo42
Joined: 07 May 2004 Posts: 263
|
|
Posted: Mon Apr 21, 2008 5:34 am |
|
|
It is definitely B6, not B5. I am not using LVP or ICD. Here are my Fuses.
#fuses HSPLL,NOWDT,NOPROTECT,NOLVP,NODEBUG,USBDIV,PLL5,CPUDIV1,VREGE
This is a simple little USb board, I plug it in and it blinks an led on B7 at a rate of about 2.5hz and prints out some stuff. It is basically the code from the USb mouse example that comes with the USB kit. With the resistor on B6 the leds blinks at a steady rate and the printing is nice and smooth. without the resistor the blinking is erratic and the printing stops and starts.
Ringo _________________ Ringo Davis |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Apr 21, 2008 12:16 pm |
|
|
1. Describe the external circuits that connected to pin B6 (other than
the pull-up resistor).
2. Are you using a bootloader ? If so, post the manufacturer, name,
and version of the bootloader. If possible, post a link to the website.
3. Are you doing anything unusual with regard to your development
environment ? In other words, the two most common environments
are the CCS IDE + ICD-U40, or MPLAB + ICD2. Are you doing anything
different ?
4. Are you running this PIC with a debugger ?
Or are you running it as a stand-alone board, with no debugger or
bootloader cable attached to the board ?
5. Post a very short program that shows the problem. Just something
that blinks an LED in a loop. Post the #include, #fuses, and #use delay
statements. It should be compilable. Test it, and verify that it shows
the "pin B6" problem. |
|
|
|