Hi all, Recently I am trying to capture pulse duration using Capture module on CCP1 port and print the frequency to lcd. Configuration, timer settings, interrupt monitoring etc, everything works as expected except one thing ; LCD shows ridiculous values for example it gives '11869' value for a 1kHz PWM input. It is responsive to changes in the frequency of the applied pwm but not accurate/consistent. This is the crippled code not to pollute around ; I am currently using MPLAB C18 with a target of 18f2550. I can post the entire code as well but the mistake lies in this section I suppose ; void main(void) { unsigned char config1=3D0x00,timer_value =3D 0x00; TRISC =3D 0; //all c ports are output TRISCbits.RC2 =3D 1; //ccp1 input SetTmrCCPSrc(T1_SOURCE_CCP); //Set Timer 1 as source for input capture mo= dule config1 =3D CAP_EVERY_RISE_EDGE | CAPTURE_INT_OFF ; //configure input capture for capture on every rising edge and its interrupt off OpenCapture1(config1 ); =09 OpenTimer1(0); //start the timer=09 while(!PIR1bits.CCP1IF); // Wait for event INCAPResult =3D (int)ReadCapture1(); // read result display((int)INCAPResult); // print result on lcd while(1); =09 CloseCapture1(); =09 } Connections and configurations are all triple checked and they work. But as I mentioned LCD is not returning correct values. Went over the code for lots of times without no luck! Any ideas ? Have a nice day. --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .