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 between #INT_EXT and #INT_RB

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



Joined: 30 Jan 2008
Posts: 197

View user's profile Send private message

Problem between #INT_EXT and #INT_RB
PostPosted: Wed Feb 05, 2014 7:05 pm     Reply with quote

Hi, anyone can help me with this,

I'm trying to use the #INT_EXT and #INT_RB but each with different edge on which the edge interrupt should trigger, #INT_EXT is rise edge (L to H) and #INT_RB is fall edge (H to L), but when two interrupts are enabled #INT_EXT only active with fall edge, but when I disable #INT_RB, #INT_EXT works OK, it is activated by the rising edge ... what is the problem?

Here is my code:
Code:
#include <18F4520.h>
#fuses HS,NOWDT,NOPROTECT,NOLVP,NOBROWNOUT
#use delay(clock=20000000)
#use rs232(baud=19200, xmit=PIN_C6, rcv=PIN_C7, timeout=5000)// RS232 Estándar

int Clear_PORTB;

#INT_EXT
void Int_CALL(){

output_toggle(PIN_D0);
}

#INT_RB
void Int_DOOR(){

   output_toggle(PIN_D3);

Clear_PORTB = input_b();

}

void main() {

    ext_int_edge(L_TO_H);
    clear_interrupt(INT_EXT);
    enable_interrupts(int_ext);            
            
    ext_int_edge( H_TO_L );
    clear_interrupt(INT_RB);
    enable_interrupts(int_rb);   
   
    enable_interrupts(global);
      
while(TRUE) {

   delay_ms(100);
   }
}
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Feb 05, 2014 8:15 pm     Reply with quote

Quote:
ext_int_edge(L_TO_H);
clear_interrupt(INT_EXT);
enable_interrupts(int_ext);

ext_int_edge( H_TO_L );
clear_interrupt(INT_RB);
enable_interrupts(int_rb);

The function in bold is not used for INT_RB. It's only for INT_EXT.
The 18F4520 doesn't have the ability to select the edge for INT_RB.
pilar



Joined: 30 Jan 2008
Posts: 197

View user's profile Send private message

PostPosted: Thu Feb 06, 2014 8:03 am     Reply with quote

Hi PCM programmer,

Thank you... Embarassed the error is so obvious!!!
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