ALIJAMSHED131
Joined: 22 Nov 2013 Posts: 1
|
rpm counter |
Posted: Fri Nov 22, 2013 10:23 am |
|
|
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 ? |
|