View previous topic :: View next topic |
Author |
Message |
open_my
Joined: 23 Sep 2011 Posts: 2
|
v4.124 interrupts errors |
Posted: Fri Sep 23, 2011 9:08 am |
|
|
yes, i use code
Code: | #include <16F887.h>
#fuses HS,NOWDT,NOPROTECT,NOLVP
#use delay(clock=20000000)
#INT_RB
void rb_isr()
{
output_toggle (PIN_D2) ;
IF (input (PIN_B0) )
{
output_toggle (PIN_D0) ;
}
}
void main()
{
enable_interrupts(INT_RB);// turn on interrupts
enable_interrupts(GLOBAL);
WHILE (TRUE)
{
output_toggle (PIN_D1);
delay_ms (100) ;
}
}
|
is work, but
Code: | #include <16F887.h>
#fuses HS,NOWDT,NOPROTECT,NOLVP
#use delay(clock=20000000)
#INT_RB
void rb_isr()
{
output_toggle (PIN_D2) ;
//! IF (input (PIN_B0) )
//! {
//! output_toggle (PIN_D0) ;
//! }
}
void main()
{
enable_interrupts(INT_RB);// turn on interrupts
enable_interrupts(GLOBAL);
WHILE (TRUE)
{
output_toggle (PIN_D1);
delay_ms (100) ;
}
}
|
interrupts loop, never return to main.
What is this error ? code or compilers ?
please help. |
|
|
FvM
Joined: 27 Aug 2008 Posts: 2337 Location: Germany
|
|
Posted: Fri Sep 23, 2011 9:43 am |
|
|
Read the datasheet. You have to read port B once to reset the input mismatch condition, otherwise, the interupt will be executed permanently.
input(PIN_B0) does it. |
|
|
open_my
Joined: 23 Sep 2011 Posts: 2
|
|
Posted: Fri Sep 23, 2011 9:58 am |
|
|
FvM wrote: | Read the datasheet. You have to read port B once to reset the input mismatch condition, otherwise, the interupt will be executed permanently.
input(PIN_B0) does it. |
thank.
forget datasheet, this stupid |
|
|
|