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

PIN_B2 in PIC12F508 is not toggling

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



Joined: 12 Jan 2016
Posts: 26
Location: Bengaluru

View user's profile Send private message

PIN_B2 in PIC12F508 is not toggling
PostPosted: Wed Apr 13, 2016 3:14 am     Reply with quote

Hi...
I have used pic12f508 for one of my project but pin_b2 and pin_b3 are not going high nor low but other i/o's are working fine.
My code:
Code:
#include <suction_12f508.h>

#define START_STOP  PIN_B1
#define SENSOR      PIN_B0
#define MOTOR       PIN_B5
#define SOLENOID    PIN_B4
#define BUZZER      PIN_B2

int8 SOLENOID_ON=0;
int16 i=0;
int8 M_ON=0;
int16 delay=0;


void main()
{

   
   //Switch OFF MOTOR & SOLENOID TRIACs
   output_high(MOTOR);
   output_high(SOLENOID);
   
   while(1)
   {
      output_high(BUZZER);
      delay_ms(1000);
      output_low(BUZZER);
      delay_ms(1000);
   }
}

#include <12F508.h>

#FUSES NOWDT                    //No Watch Dog Timer
#FUSES INTRC                    //Internal RC Osc
#FUSES PROTECT                  //Code not protected from reading
#FUSES NOMCLR                   //Master Clear pin enabled

#use delay(int=4000000)

thanks in advance.
_________________
KaalaayaTasmaiNamah:
temtronic



Joined: 01 Jul 2010
Posts: 9221
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Wed Apr 13, 2016 5:12 am     Reply with quote

I see GP2 is used to control a 'buzzer'. To me a 'buzzer' is an EN device needing a lot of current and cannot be driven from a PIC I/O pin. Please try an LED and 470r on GP2 and see if it functions properly. If the LED doesn't flash odds are you've damaged the PIC by trying to draw too much current using the 'buzzer'.

GP3 can ONLY be used as an INPUT not as an output. Please read the datasheet again, page 13. Little PICs are fun BUT you can quickly run out of pins ! You may be able to use GP3 for the 'sensor', and then GP0 for the output.

Also, you should NOT enable the Fuse 'Protect' unless you're actually selling the product and this is the final program for the PIC. There is no need to 'protect' the PIC until then. I don't even bother with client's PICs,not really necessary.

Jay
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Apr 13, 2016 9:09 am     Reply with quote

Quote:

pin_b2 and pin_b3 are not going high nor low but other i/o's are working fine.

For PIN_B2, see this thread:
http://www.ccsinfo.com/forum/viewtopic.php?t=53002
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