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.

PIC16f877a- restting TMRIH and TMRIL registers

Status
Not open for further replies.

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?.

Resetting of Timer1 Register Pair
(TMR1H, TMR1L)
TMR1H and TMR1L registers are not reset to 00h on a
POR, or any other RESET, except by the CCP1 and
CCP2 special event triggers.
T1CON register is reset to 00h on a Power-on Reset,
or a Brown-out Reset, which shuts off the timer and
leaves a 1:1 prescale. In all other RESETS, the register
is unaffected.
 
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.
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top