Hi people
got a question here hope you can help me out..
 
I am trying to measure a pulse train of 50 KHZ at 50% duty cycle without the icap funtion from the chip.
Is the following code capable? and to what extend??
 
language suite : microchip
prescaler <1:1>
TMR0 is program cycle triggered
edge2- edge1=period
 
LOOP1     BTFSC     PORTD,0     ;to ensure that the 
          GOTO      LOOP1       ;high state is capture
LOOP2     BTFSS     PORTD,0     ;after an edge  
          GOTO      LOOP2
          MOVF      TMR0,W
          MOVWF     EDGE1
LOOP3     BTFSC     PORTD,0
          GOTO      LOOP3
          MOVF      TMR0,W
          MOVWF     EDGE2
If i am not wrong error max 4 cycles 
2 at loop2 (at worse case)
2 at loop3 (at worse case)
Therefore the min period that can capture is
period = 10 cycles assuming 50% duty cycle
 
Any if any one have any better way of doing
this task please kindly mail it to me.
I am still very new to this .THANKS
 
regards
PSL