CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

PIC16F872 - RB6 / RB7

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
mhaas8



Joined: 14 Jan 2007
Posts: 3

View user's profile Send private message

PIC16F872 - RB6 / RB7
PostPosted: Sun Jan 14, 2007 10:32 am     Reply with quote

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.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Jan 14, 2007 12:18 pm     Reply with quote

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.
mhaas8



Joined: 14 Jan 2007
Posts: 3

View user's profile Send private message

No debugger in use
PostPosted: Sun Jan 14, 2007 4:47 pm     Reply with quote

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.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Jan 14, 2007 5:38 pm     Reply with quote

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);
  }

}
mhaas8



Joined: 14 Jan 2007
Posts: 3

View user's profile Send private message

Thank you
PostPosted: Sun Jan 14, 2007 8:23 pm     Reply with quote

I will have to do some additional investigation. However, please know that I do appreciate the insight. Thank you.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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