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

can't setup timer2 of PIC12F1822

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



Joined: 06 Feb 2006
Posts: 468
Location: Bali

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

can't setup timer2 of PIC12F1822
PostPosted: Thu Nov 24, 2022 12:02 am     Reply with quote

Hi
PIC12F1822
Compiler: CCS PCM C Compiler, Version 5.062

Code:
void main()
{
   PORT_A_PULLUPS(0b00110100);//RA2;RA4;RA5
   SETUP_TIMER_0(T0_INTERNAL|T0_DIV_256);
   enable_interrupts(INT_TIMER0);
   SETUP_TIMER_1(T1_DISABLED);
   disable_interrupts(INT_TIMER1);
//   SETUP_TIMER_2(T2_DIV_BY_1);
//   SETUP_TIMER_2(T2_DISABLED);
   disable_interrupts(INT_TIMER2);
   disable_interrupts(INT_IOC_A3_H2L);
   CLEAR_INTERRUPT(INT_IOC_A3_H2L);
   disable_interrupts(INT_TBE);
   disable_interrupts(INT_RDA);
   powerupF=1;//to go to sleep at powerup
   enable_interrupts(GLOBAL);
   while(TRUE)
   {
      DG();
   }
}


If the setup timer 2 not out-commented I am getting error:
Quote:
Expect comma

According to the CCS header file both are legit constants used for SETUP_TIMER_2

Please help
Joe
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Nov 24, 2022 12:17 am     Reply with quote

The 12F1822.h file says:
Quote:
setup_timer_2(int8 mode, int8 period, int8 postscale);

So you have to put in 3 parameters, not just 1.
gjs_rsdi



Joined: 06 Feb 2006
Posts: 468
Location: Bali

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

PostPosted: Thu Nov 24, 2022 1:05 am     Reply with quote

Thank you PCM programmer
You make my day Very Happy

Best wishes
Joe
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