Hi,
I am connected a missing pulse detector to pin2(RA0) of a PIC16f877a.
Basically the missing pulse detector will always given high output, and change to low output if sense missing pulse.It will change back to high after a short period. I need to write a program when the output change to low, the LCD will display number = 1. And the number will increase by one every time the output change to low. Below is the program i wrote, but it doesn't work.
the next problem is below code didn't show any response in the LCD.
Thanks for the help
I am connected a missing pulse detector to pin2(RA0) of a PIC16f877a.
Basically the missing pulse detector will always given high output, and change to low output if sense missing pulse.It will change back to high after a short period. I need to write a program when the output change to low, the LCD will display number = 1. And the number will increase by one every time the output change to low. Below is the program i wrote, but it doesn't work.
Code:
#include <16f877a.h>
#use delay(clock=20000000)
#fuses hs,noprotect,nowdt,nolvp
#define use_portb_lcd TRUE
#include <lcd.c>
#define PWR_LED Pin_A5
#define IR1 Pin_A0
void main()
{
int interrupt = 0;
lcd_init();
{
if (input(IR1) == True) /this code is used for check H or L using a LED
output_high(PWR_LED);
else
output_low(PWR_LED);
lcd_putc("\fAutomatic Room");
lcd_putc("\nLight Controller");
delay_ms(5000);
lcd_putc("\f");
lcd_gotoxy(1,1);
lcd_putc("People in = \n");
if(input(IR1)==0) / if the input is low
{
interrupt+=1; increment by one
lcd_gotoxy(13,1); display on first row,13th column
lcd_putc(interrupt);
}
}while(1);
}
the problem i facing is the above code couldn't work if combine with the LCD code. It could work if the code compile separately.if (input(IR1) == True) /this code is used for check High or Low using a LED
output_high(PWR_LED);
else
output_low(PWR_LED);
the next problem is below code didn't show any response in the LCD.
if(input(IR1)==0) / if the input is low
{
interrupt+=1; increment by one
lcd_gotoxy(13,1); display on first row,13th column
lcd_putc(interrupt);
}
}while(1);
Thanks for the help