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 support@ccsinfo.com

v4.124 interrupts errors

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



Joined: 23 Sep 2011
Posts: 2

View user's profile Send private message

v4.124 interrupts errors
PostPosted: Fri Sep 23, 2011 9:08 am     Reply with quote

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

View user's profile Send private message

PostPosted: Fri Sep 23, 2011 9:43 am     Reply with quote

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

View user's profile Send private message

PostPosted: Fri Sep 23, 2011 9:58 am     Reply with quote

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 Embarassed
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