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

interrupt!

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



Joined: 19 Sep 2006
Posts: 10

View user's profile Send private message

interrupt!
PostPosted: Tue Sep 19, 2006 6:53 pm     Reply with quote

I need two interrupts in my code...
this is a piec of part of my interrupt code:
Code:

ext_int_edge(l_to_h ); //when pin change 0 to 1, go to ....
INT_EXT!
enable_interrupts(global);
enable_interrupts(INT_EXT);

///the first interrupt (L_to_H) I did it, but I wanted another (H_to_L) that makes a diferent function from the first one..but I couldn�t make it


HELP
using pic16f628a
_________________
Vlew
Charles Santos
libor



Joined: 14 Dec 2004
Posts: 288
Location: Hungary

View user's profile Send private message

PostPosted: Tue Sep 19, 2006 8:48 pm     Reply with quote

Code:
short edge_flag;

INT_EXT
void ext_isr() {
  if (edge_flag) {
    ...do l_to_h things
  } else {
    ...do h_to_l things
  }
}

enable_interrupts(global);
enable_interrupts(INT_EXT);
ext_int_edge(l_to_h);
edge_flag = 1;         //set flag, so l_to_h code is executed in interrupt

or

ext_int_edge(h_to_l);
edge_flag = 0;        //clear flag, so h_to_l code is executed in interrupt


or checking the port itself would be also an option, no flag needed,
though might result false result when a short glitch occurs

Code:
INT_EXT
void ext_isr() {
  if (input(PIN_B0)) {
    ...do l_to_h things
  } else {
    ...do h_to_l things
  }
}
[/code]
dos_santos_rj



Joined: 19 Sep 2006
Posts: 10

View user's profile Send private message

PostPosted: Tue Sep 19, 2006 9:16 pm     Reply with quote

libor,
Thank your help!
I made the code already.
_________________
Vlew
Charles Santos
pattousai



Joined: 23 Aug 2006
Posts: 37

View user's profile Send private message

PostPosted: Wed Sep 20, 2006 8:27 pm     Reply with quote

hi, sorry for bothering.
I'm doing a project that i want to use the exact same interrupt (pin change 0 to 1), but i don't quite understand it.

if someone can help me i'll be appreciated.

dos_santos_rj:
can you post or send me the whole code, or just quite enough for i understand how this interrupt goes??


thanks!!
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