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

Dual external interrupt problem

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



Joined: 08 Apr 2015
Posts: 77

View user's profile Send private message

Dual external interrupt problem
PostPosted: Tue Jun 13, 2017 7:26 am     Reply with quote

I'm trying to use both external interrupts (on 18f4550 and vs5.008) EXT1 and EXT2 but when i add the line
Code:
enable_interrupts(INT_EXT1);
the program acts erratically without even the push of the button(with pull-up resistor).
If i exclude this line the interrupt on RB2 works fine.
Code:
enable_interrupts(GLOBAL);
ext_int_edge(1, H_TO_L);
ext_int_edge(2, H_TO_L);
clear_interrupt(INT_EXT1);
//enable_interrupts(INT_EXT1);
clear_interrupt(INT_EXT2);
enable_interrupts(INT_EXT2);


What am i missing?

thanks
Ttelmah



Joined: 11 Mar 2010
Posts: 19545

View user's profile Send private message

PostPosted: Tue Jun 13, 2017 7:49 am     Reply with quote

Without seeing what is in your INT_EXT1 interrupt handler, we can't help.

Odds are you have something in it, that is resulting in something like the classic compiler warning 'interrupts disabled to prevent re-entrancy', or just resulting in the code being stuck inside the EXT1 handler.
irmanao



Joined: 08 Apr 2015
Posts: 77

View user's profile Send private message

PostPosted: Tue Jun 13, 2017 8:50 am     Reply with quote

Just a simple add function
Code:
#INT_EXT1
void ext_int1 (void){
minutes++;
if (minutes>59)
hours--;
}

#INT_EXT2
void ext_int2 (void){
hours++;
}


Both work on their own but not together.. there is no warning from the compiler.
temtronic



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

View user's profile Send private message

PostPosted: Tue Jun 13, 2017 8:56 am     Reply with quote

hmm.. v5.008 was really 'young' and may not be compiling correct code.You should make the smallest program possible, compile, test and dump the listing to see what is being created.
Post here so we can see it...

Jay
irmanao



Joined: 08 Apr 2015
Posts: 77

View user's profile Send private message

PostPosted: Tue Jun 13, 2017 9:48 am     Reply with quote

How do i test and dump the listing...?
Never done this before..
I actually fixed the issue. It was a faulty push button, changed it and everything is stable now. I would like to know how to do the test thingy.

thanks for your time
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Jun 14, 2017 3:02 am     Reply with quote

Look in your project folder. This the folder that has your C source file(s)
for the project. After a successful compilation with no errors, you will see
a .LST file in your project directory. It will have the same name as your
main C source file, but the file extension will be .LST. It has the ASM
code listing for the program.

There is compiler option to make the .LST file in "Symbolic" mode.
I suggest that you use that option. The ASM code will be easier to read.
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