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

Problem with Interrupt

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








Problem with Interrupt
PostPosted: Wed Feb 27, 2008 8:59 am     Reply with quote

Hi,
I have a little problem with interrupt.
I want to set PIN_A5 to low for 4 minutes. Then I want to set PIN_A5 to lhigh for 6 minutes. Unfortunately it doesn't work. I use a PIC 16F818. Below a part of my code:
Code:
#define INTS_PER_SECOND 61                   // (8000000/(4*128*256))
#int_rtcc                                    // This function is called every time
void clock_isr() {                           // the RTCC (timer0) overflows (255->0).
                                             // For this program this is apx 61 times
    if(--int_count==0) {                     // per second.
      ++seconds;
      int_count=INTS_PER_SECOND;
    }

}

void main() {

   int_count=INTS_PER_SECOND;
   set_timer0(0);
   setup_counters( RTCC_INTERNAL, RTCC_DIV_128 | RTCC_8_BIT);
   enable_interrupts(INT_RTCC);
   enable_interrupts(GLOBAL);

output_low(PIN_A5);

while(TRUE)
      {

        if(seconds == 240)
         {
          output_high(PIN_A5);               
         }

        if(seconds == 600)
         {
          output_low(PIN_A5);               
          seconds = 0;
         }

      }
}

Thanks!
tipoldo



Joined: 01 Feb 2006
Posts: 14
Location: Palma Mallorca

View user's profile Send private message

PostPosted: Wed Feb 27, 2008 9:40 am     Reply with quote

Do you set the watchdog time dissable?
Humberto



Joined: 08 Sep 2003
Posts: 1215
Location: Buenos Aires, La Reina del Plata

View user's profile Send private message

PostPosted: Wed Feb 27, 2008 9:50 am     Reply with quote

Quote:

I want to set PIN_A5 to low for 4 minutes. Then I want to set PIN_A5 to lhigh for 6 minutes. Unfortunately it doesn't work. I use a PIC 16F818.


In this device PIN_A5 is an INPUT pin ONLY.
Use another pin with I/O capability.


Humberto
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