lgeorge123
Full Member level 2
pic #int_ext
I use PIC16F84 to measure the time width of TV remote of 9th pulse, it is 1.7ms.
The circuit is OK and the time width is displayed. IR receiver output is connected to pin b0. But after the code is measured, pin b0 of 16f84(external interrupt) is always low, so it cannot trigger more than two times. I am sure the 16f84 is good , the code is as follows :
#include <16f84.h>
#fuses XT,NOWDT,NOPROTECT
#use delay( clock=4000000)
#include "lcd.c"
int time,count,time1;
int32 data1;
#INT_EXT
int_isr()
{
while(!input(pin_b0));
set_rtcc(0);
while(input(pin_b0));
time=get_rtcc();
count++;
if (count==9)
{
lcd_putc('\n');
printf(lcd_putc,"%LX",time);
count=0;
data1=0;
time=0;
}
}
main()
{
count=0;
data1=0;
lcd_init();
printf(lcd_putc,"hello");
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_2);
enable_interrupts(int_ext);
enable_interrupts(global);
WHILE(1)
{
}
}
is it the proporties of 16f84 or anything else ???
Any comment is welcome !!!
I use PIC16F84 to measure the time width of TV remote of 9th pulse, it is 1.7ms.
The circuit is OK and the time width is displayed. IR receiver output is connected to pin b0. But after the code is measured, pin b0 of 16f84(external interrupt) is always low, so it cannot trigger more than two times. I am sure the 16f84 is good , the code is as follows :
#include <16f84.h>
#fuses XT,NOWDT,NOPROTECT
#use delay( clock=4000000)
#include "lcd.c"
int time,count,time1;
int32 data1;
#INT_EXT
int_isr()
{
while(!input(pin_b0));
set_rtcc(0);
while(input(pin_b0));
time=get_rtcc();
count++;
if (count==9)
{
lcd_putc('\n');
printf(lcd_putc,"%LX",time);
count=0;
data1=0;
time=0;
}
}
main()
{
count=0;
data1=0;
lcd_init();
printf(lcd_putc,"hello");
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_2);
enable_interrupts(int_ext);
enable_interrupts(global);
WHILE(1)
{
}
}
is it the proporties of 16f84 or anything else ???
Any comment is welcome !!!