Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

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.

Latest threads

New Articles From Microcontroller Tips

Back
Top