I think the code is OK.
When I'll have a real pic I will try again. For now using T0CS instead is good for me.
Thank you.
Bye.
Code:
start
bsf STATUS,RP0 ; Set tmr0 as counter
movlw b'11100111' ; on rising edge with 1:255 prescaler.
movwf OPTION_REG ;
bcf TRISA,2 ; Set tmr0_pin as output.
bcf STATUS,RP0 ;
clrf TMR0
call toggletest
goto start
toggletest
movf TMR0,W
movwf temp
clrf count
toggle
incf count,F
bsf STATUS,RP0
bsf OPTION_REG,T0SE
bcf OPTION_REG,T0SE
bcf STATUS,RP0
movf TMR0,W
subwf temp,W
btfsc STATUS,Z
goto toggle
comf count,F
incf count,F
return
When I'll have a real pic I will try again. For now using T0CS instead is good for me.
Thank you.
Bye.