j ai un probleme avec mon program pic16f876 qui n'arrive pas a affiché fréqence
elle s'affcihe toujour 0
I have a problem with my program pic16f876 that can not get displayed Frequency
she is still showing 0
// Lcd pinout settings
sbit LCD_RS at RB7_bit;
sbit LCD_EN at RB6_bit;
sbit LCD_D7 at RB2_bit;
sbit LCD_D6 at RB3_bit;
sbit LCD_D5 at RB4_bit;
sbit LCD_D4 at RB5_bit;
// Pin direction
sbit LCD_RS_Direction at TRISB7_bit;
sbit LCD_EN_Direction at TRISB6_bit;
sbit LCD_D7_Direction at TRISB2_bit;
sbit LCD_D6_Direction at TRISB3_bit;
sbit LCD_D5_Direction at TRISB4_bit;
sbit LCD_D4_Direction at TRISB5_bit;
int val,freq,hum;
char humid[7];
void data_converstion(void){
IntToStr(hum,humid);
}
void display1(void)
{
lcd_out(1,1,"hum=");
lcd_out(1,13,Ltrim(humid));
lcd_Chr_Cp('%');
lcd_Chr_Cp(' ');
}
void interrupt(void)
{
if(T1CON.TMR1ON==0)
{
T1CON.TMR1ON=1;
INTCON.INTF=0;
}
else if(T1CON.TMR1ON==1)
{
T1CON.TMR1ON=0;
val=(TMR1H<<8)|(TMR1L);
INTCON.INTE=0;
freq=(50/val);
hum=565-freq/13;
TMR1H=0;
TMR1L=0;
INTCON.INTE=1;
INTCON.INTF=0;
}
}
Je ne sais pas comment résoudre ce problème, si vous voulez me faire la bonne formule, et pour 100hz c'est juste un exemple même avec une autre fréquence ça reste toujours 0
I do not know how to solve this problem, if you want to make me the right formula, and for 100hz it is just an example even with another frequency it remains always 0