PIC16f877a- restting TMRIH and TMRIL registers

crush

New Member
Hi all,
trying to reset the values on TMRIH and TMRIL to 0x00.

Cant seem to do this.
I tried TMR1L, TMR1H =0x00;
i tried turnin timer1 on and off by setting the TMRION.

i want to rest the registers as i am using the capture function (CCP1) which reads the values from the Timer1 registers when an event occurs(falling edge).

I am trying to find the time between two falling edges, so im loading the values captured at each event into two variables and calculating the time between them

I want to rest the registers to remove the hassle of having to account for the overflow.

any ideas?
 
Have you tried reading the datasheet?.

 
Nigel Goodwin said:
Have you tried reading the datasheet?.

Yup i did read the datasheet and the part u mention. And as it says it cannot be reset, even on a power on reset.
And though i am using the CCP1, im not using the special event, so it wont reset it.

I was wondering if there was a programming trick around it??
 
I think you are getting confused by the data sheet.

The ASM commands to reset these regs are just:

CLRF TMR1L
CLRF TMR1H

(It is always best to clear TMR1L first as shown so that TMR1H cannot increment due to a TMR1L overflow whilst you are clearing them.)
 
gramo said:
can someone give a brief descroption on the TMR1 on pics, not the full datasheet copy and paste, just a general description of what it does and how to use it

I would suggest downloading the 'Midrange Reference Manual' from MicroChip, or even just the Timer section - that should explain all you need to know.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…