View previous topic :: View next topic |
Author |
Message |
dos_santos_rj
Joined: 19 Sep 2006 Posts: 10
|
interrupt! |
Posted: Tue Sep 19, 2006 6:53 pm |
|
|
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
|
|
Posted: Tue Sep 19, 2006 8:48 pm |
|
|
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
|
|
Posted: Tue Sep 19, 2006 9:16 pm |
|
|
libor,
Thank your help!
I made the code already. _________________ Vlew
Charles Santos |
|
|
pattousai
Joined: 23 Aug 2006 Posts: 37
|
|
Posted: Wed Sep 20, 2006 8:27 pm |
|
|
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!! |
|
|
|