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 CCS Technical Support

I get get MCLR/B3 pin to function as an output with PIC12F51

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








I get get MCLR/B3 pin to function as an output with PIC12F51
PostPosted: Sun Mar 18, 2007 3:27 pm     Reply with quote

It's been a long time since I've been programming PICs and the CCS compiler is a new environment for me, so bear with me. I've been having problems getting the comparator and outputs working correctly so, for test purposes I wrote this:

Code:
#include <12f510.h>

#fuses INTRC, NOWDT, NOPROTECT, NOMCLR
#use delay(clock=4000000)


void main() {
setup_adc(ADC_OFF);
setup_adc_ports(NO_ANALOGS);
setup_comparator(VR_A0_OUT_ON_A2);   


while (TRUE)
   {
      
      if (!C1OUT)
         {output_high(PIN_B4);
          output_high(PIN_B3);
         }
      else
         {output_low(PIN_B4);   
          output_low(PIN_B3);
         }
      if (C1OUT)
         output_high(PIN_B5);
      else output_low(PIN_B5);


   }
   
}


Everything works correctly now except for the MCLR/B3 pin stays low regardless of the condition of C1OUT.

This should be easy but it's driving me nuts. Any help would be greatly appreciated.

Bullgator
Bullgator



Joined: 18 Mar 2007
Posts: 2

View user's profile Send private message Send e-mail

PostPosted: Sun Mar 18, 2007 3:30 pm     Reply with quote

Man, my first post and I screw up the title. Obviously it should read, "I can't get..." Embarassed
Ttelmah
Guest







PostPosted: Sun Mar 18, 2007 3:37 pm     Reply with quote

Read the data sheet.
Section 5.4.
What can RB3 do?...
Bullgator



Joined: 18 Mar 2007
Posts: 2

View user's profile Send private message Send e-mail

PostPosted: Sun Mar 18, 2007 4:02 pm     Reply with quote

Wow, I feel like an idiot but at least I know the answer now. Thanks for the quick reply.
Ttelmah
Guest







PostPosted: Mon Mar 19, 2007 3:29 am     Reply with quote

There are so many 'caveats' of this sort with the PIC, especially given the number of chip variants, and peripherals attached to pins that can interfere with the operation as well, that it is a common type of problem...
At leats it was a simple problem!... Smile

Best Wishes
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