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

rpm counter

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



Joined: 22 Nov 2013
Posts: 1

View user's profile Send private message

rpm counter
PostPosted: Fri Nov 22, 2013 10:23 am     Reply with quote

Code:

#include <16F877.h>

#fuses HS,NOWDT,NOPROTECT,NOLVP
#use delay(clock=20000000)
#include <ce_lcd.c>

unsigned long int a=0,b=0,d=0;

#int_ext           //////////////////error is here in this function
void ir (void)  {

b++;
output_toggle(pin_d0);
   
}                 ///////////////////////////error ends here

#int_timer0
void rpm (void)   {

a++;
set_timer0(5);
}


void main (void)
{
enable_interrupts (global | int_timer0 | int_ext);
ext_int_edge (l_to_h);
setup_timer_0 (RTCC_DIV_256);
set_timer0 (5);

lcd_init ();

   while(true) {
         
          if (a == 78)  {
         
          d=(b*60); 
         
          a=0;
          b=0;
          }
   
   printf (lcd_putc,"\fRPM = %ld", d);
   }
   
}

In this code the INT of pic 16f877 is being used to detect rising edge. But the problem is that after detecting first rising edge, the INT pin remains high. I think that interrupt flag needs to be cleared, but in C language how could this be done ?
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Fri Nov 22, 2013 12:28 pm     Reply with quote

Code:
enable_interrupts (global | int_timer0 | int_ext);
First this line. See the manual.
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