je vien de faire la simulation d'un hygrometre d'humidité avec un HS1101 et pic16F876
j'ai pas d erreur sur mon programe mikroc mais la fréquence s affiche toujour 00 :'
j'ai vraiment bsoin d'aide
voici le programe
Code:Thread starter #3 // 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; } } void main() { long count; count=0; TMR1H=0; TMR1L=0; INTCON.GIE=1; INTCON.INTE=1; OPTION_REG.INTEDG=0; ADC_Init(); Lcd_Init(); freq=0; Lcd_Cmd(_LCD_CLEAR); Lcd_Cmd(_LCD_CURSOR_OFF); Lcd_Out(1,4,"FEGAS & "); Lcd_Out(2,6,"NAMANE"); delay_ms(1000); Lcd_Cmd(_LCD_CLEAR); for(;;) { data_converstion(); display1(); } }
-----