salut a tous,
comme c'est marqué dans le titre je souhaite mesuré la période d'un signal carré. j'utilise le mode CCP du pic, mais le probleme c'est que mon programme marche pas !!!
Plus précisement je vais recevoir ou non un signal carré, et lorsque ce dernier sera présent je veux mesurer sa période, et si cette periode est comprise entre 2 valeurs, alors j'allume une led et j'active un buzzer. je vous joint mon code en C. si voulez plus de precision ou si vous avez une autre methode (qui marche...) je suis preneur.
merci d'avance
a+

#include <16F628A.h>

#FUSES NOWDT //No Watch Dog Timer
#FUSES HS //High speed Osc (> 4mhz for PCM/PCH) (>10mhz for PCD)
#FUSES NOPUT //No Power Up Timer
#FUSES NOPROTECT //Code not protected from reading
#FUSES NOBROWNOUT //No brownout reset
#FUSES NOMCLR //Master Clear pin used for I/O
#FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES NOCPD //No EE protection

#use delay(clock=12000000)
#use rs232(baud=9600,parity=N,xmit= PIN_A3,rcv=PIN_A2,bi ts=9)

#byte PORTB=6
#byte TRISB=0x86
#bit led_rouge=PORTB.1
#bit buzzer=PORTB.0

signed int32 T2, compt;
float periode;
int front, mesure_term;


#int_TIMER1
TIMER1_isr()
{
compt++;
}

#int_CCP1
CCP1_isr()
{
front++;

if (front==1)
{
set_timer1(0);
compt=0;
front=1;
}

else if (front==2);
{
T2=CCP_1;
periode= (T2*0.0000002) + ((compt*65536)*0.0000002);
set_timer1(0);
compt=0;
front=1;
}

}


void main()
{

setup_timer_0(RTCC_INTERNAL|RT CC_DIV_1);
setup_timer_1(T1_INTERNAL|T1_D IV_BY_1);
setup_timer_2(T2_DISABLED,0,1) ;
setup_ccp1(CCP_CAPTURE_RE);
setup_comparator(NC_NC_NC_NC);
setup_vref(FALSE);
enable_interrupts(INT_TIMER1);
enable_interrupts(INT_CCP1);
enable_interrupts(GLOBAL);
setup_oscillator(False);

TRISB=0b11111100;

led_rouge=0;
compt=0;
front=0;
buzzer=0;
set_timer1(0);

do
{
if (0.005<periode<0.010);
{
led_rouge=1;
buzzer=1;
}
}
while(1);

}