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

Problem with interrupts of PIC16LF1936

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



Joined: 18 May 2010
Posts: 1

View user's profile Send private message

Problem with interrupts of PIC16LF1936
PostPosted: Tue May 18, 2010 5:09 am     Reply with quote

Hi:

I have this simple code to generate an interrupt of the PIN_B4 when his value is low:
Code:

void main() {

   set_tris_C(0x00);
   setup_timer_1(T1_INTERNAL|T1_DIV_BY_8);
   clear_interrupt(INT_RB);
   IOCBN=0x10; //enables negative edge interrupt on B4
   IOCBP=0; //Disable all positive edge interrupts
   IOCBF=0;
   enable_interrupts(INT_RB);
   enable_interrupts(GLOBAL);
   set_tris_B(0x10);
   set_timer1(cycle_time);
  TMR1IF = 1;
   while(1){

     if ( TMR1IF)
    {     
          TMR1IF = 0;
     }
}

#int_rb
void changed(void) {
   if (IOCBF & (0x10)) {
   output_toggle(PIN_RC6);
   }
   IOCBF=0;
}

However, pin_RB4 doesn't interrupt. I have problems with " enable_interrupts(GLOBAL);" function because neither of my inputs work well (when I don't use this function my imputs work well but PIN_RB4 doesn't interrupt). I have replaced this function for using bit GIE but it doesn't interrupt.

What have I do wrong?

Thank you

PD: I have tried to interrupt the timer 1 and I can't do it, either.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue May 18, 2010 1:32 pm     Reply with quote

Post your compiler version. This is a new series of PICs for CCS and
we (forum members) know there have been bugs about it in recent
versions. I'll compare the .LST file code in your version to the latest
version.
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