frequency meter timer value

Status
Not open for further replies.

neelam29

New Member
hi m using this program to make a frequency counter using pic16f628a and external interrupt is on pin rb0 . method m using is measuring time betwenn two rising pulses. one the rising edge comes i start the timer and on another i stop it .and then calculate the frequency.code is as shown below.

m not getting the correct timer values.
Code:
;===================================================================== 
;      INTERRUPT SERVICE ROUTINE 
;===================================================================== 

OVFL_ISR 
      movwf   TEMP              ;Store the value of w temporarily 

      btfss   INTCON, INTF      ;check if it's a external interrupt or not! 
         retfie         ;else check other interuppt or return 

      bcf      INTCON, INTF 
       
      MOVLW   B'00000001' 
      XORWF   T1CON, F 
      BTFSC   T1CON, TMR1ON 
         RETFIE 
       
      MOVF   TMR1H, W 
      MOVWF   TIMER1_HIGH 
      MOVF   TMR1L, W 
      MOVWF   TIMER1_LOW 
       
      CLRF   TMR1H 
      CLRF   TMR1L    
      movfw   TEMP                  
      retfie 
;=====================================================================

please let me know is my code correct?
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…