Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Why does TMR1 count twice?

Status
Not open for further replies.

x_ngine

Junior Member level 3
Joined
Feb 23, 2002
Messages
31
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
244
tmr-1

Hello everybody,

Since I want to learn Proteus, I'm developing simple circuits with pic 16f877a writing the firmware with Hi-tech Picc 9.50pl2.

Currently I'm trying to use TMR1 to create a 16-bit counter.
The circuit I designed is very simple: it consists in a push-button connected to RC0 with a pull-up resistor. My purpose is simply to see the increase of counts in TMR1L when I press the button.

In this situation I suppose the oscillator between RC0 and RC1 should be disabled, because I don't need to make something oscillates because I generate the "clock" by the means of the button.

The problem is that if I disable the oscillator setting T1CON=0b00000111 TMR1L is incremented twice everytime I press the button, while if I activare the oscillator setting T1CON=0b00001111 all is right.

What does the oscillator do? I can't see its role in the circuit... this is also because watching the internal scheme on 16f877a's datasheet it seems the pin RC0 is DIRECTLY connected to TMR1L without passing through the oscillator...

Help me please!!
 

I thought that in this case Proteus would have not made analog simulation on pins. I'll try your suggestion and I'll report the result.

Thank you.

Bye

Added after 2 hours 33 minutes:

I connected a capacitor of 100nF (I tryed even with bigger ones) from the pin to ground but the situation doesn't change or, to say the truth, it changes but only a little bit... I notice that now there is no a fixed rule for the increments: sometimes it's incremented by 2, other times by three...

Besides, if I look to the pin with the oscilloscope I can see the classical RC exponential waveform.

Like before, the problem disappears once I set on the internall oscillator.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top