View previous topic :: View next topic |
Author |
Message |
mhaas8
Joined: 14 Jan 2007 Posts: 3
|
PIC16F872 - RB6 / RB7 |
Posted: Sun Jan 14, 2007 10:32 am |
|
|
I need to utilize pins Pins RB6 and RB7 as standard I/O on the PIC16F872. I tried utilizing the NOLVP as shown below.
#fuses HS,NOWDT,NOLVP,NOPROTECT
However, this did not solve my problem. Any assistance would be greatly appreciated. |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sun Jan 14, 2007 12:18 pm |
|
|
They should work. Are you using a debugger, such as CCS ICD-U40
or Microchip ICD2 ? If so, the debugger uses pins RB6 and RB7.
If you want to use them, then create a stand-alone program and
disconnect the debugger from your board. |
|
![](templates/subSilver/images/spacer.gif) |
mhaas8
Joined: 14 Jan 2007 Posts: 3
|
No debugger in use |
Posted: Sun Jan 14, 2007 4:47 pm |
|
|
Thank you for your reply. However, I am not using a debugger.
Pins RB6 and RB7 always go high and never change state.
As a note, I am using an older CCSC compiler, PCM 3.077, but that functionality is supported. |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sun Jan 14, 2007 5:38 pm |
|
|
I don't have a 16F872 to test, so I made the program shown below,
which runs on a 16F877. I installed PCM vs. 3.077 and compiled it
with MPLAB vs. 5.70.40 (because that old compiler won't run on vs.
7.xx of MPLAB). I then used the ICD2 (with the modern MPLAB)
to program the Hex file into my PicDem2-Plus. It works. I looked
at pins B6 and B7 with an oscilloscope and they're toggling.
I then re-compiled the program below for the 16F872, with vs. 3.077.
I compared the .LST files for the 16F877 and the 16F872. They're
very similar. There's a little bit of differences in the delay_ms()
routine code, but they're basically the same. The code that sets
the TRIS and writes to Port B pins B6 and B7 is identical.
So it's my belief that there's nothing wrong with the code generated by
vs. 3.077 of the compiler. I believe you probably have a hardware
problem. You probably have some external circuits on pins B6 and
B7 (maybe that you aren't aware of), that are causing the problem.
Or, maybe you have the DEBUG fuse enabled, or something like that.
The fact that those pins are normally used by the debugger is a very
bigg clue. You should investigate that issue completely.
Code: |
#include <16F877.H>
#fuses XT, NOWDT, NOPROTECT, BROWNOUT, PUT, NOLVP
#use delay(clock = 4000000)
//============================================
void main()
{
while(1)
{
output_high(PIN_B6);
output_high(PIN_B7);
delay_ms(500);
output_low(PIN_B6);
output_low(PIN_B7);
delay_ms(500);
}
} |
|
|
![](templates/subSilver/images/spacer.gif) |
mhaas8
Joined: 14 Jan 2007 Posts: 3
|
Thank you |
Posted: Sun Jan 14, 2007 8:23 pm |
|
|
I will have to do some additional investigation. However, please know that I do appreciate the insight. Thank you. |
|
![](templates/subSilver/images/spacer.gif) |
|