P pierlu New Member Oct 30, 2009 #21 I think the code is OK. 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.
I think the code is OK. 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.
Mike - K8LH Well-Known Member Oct 30, 2009 #22 You're setting the RA2 pin as an output. Is that the T0CKI pin for the PIC source code you're testing? T0CKI is on the RA4 pin on some PICs. Mike <added> I see now that your 16F630 has T0CKI on RA2... Last edited: Oct 30, 2009
You're setting the RA2 pin as an output. Is that the T0CKI pin for the PIC source code you're testing? T0CKI is on the RA4 pin on some PICs. Mike <added> I see now that your 16F630 has T0CKI on RA2...
V vsmGuy New Member Jul 8, 2010 #23 Did toggling the T0SE from firmware increment the prescaler? If so - this means we would need to have only the TMR0 pin connected to sample the signal leaving all other pins free!
Did toggling the T0SE from firmware increment the prescaler? If so - this means we would need to have only the TMR0 pin connected to sample the signal leaving all other pins free!
Mike - K8LH Well-Known Member Jul 8, 2010 #24 vsmGuy said: Did toggling the T0SE from firmware increment the prescaler? If so - this means we would need to have only the TMR0 pin connected to sample the signal leaving all other pins free! Click to expand... It does increment the prescaler but I doubt if that "feature" was ever intended and so it doesn't surprise me that the Simulator doesn't know about it (LOL)...
vsmGuy said: Did toggling the T0SE from firmware increment the prescaler? If so - this means we would need to have only the TMR0 pin connected to sample the signal leaving all other pins free! Click to expand... It does increment the prescaler but I doubt if that "feature" was ever intended and so it doesn't surprise me that the Simulator doesn't know about it (LOL)...
V vsmGuy New Member Jul 8, 2010 #25 Makes sense Di you try this out in a simulator? I am thinking of using TIMER1 in asynch mode - any working samples in C to read/start from?
Makes sense Di you try this out in a simulator? I am thinking of using TIMER1 in asynch mode - any working samples in C to read/start from?