Help with TMR0 on a 16F876A

For questions and comments on programming in general. And for any items that don't fit into the forums below.

Moderators: Benj, Mods

Post Reply
spryderweb
Posts: 14
Joined: Tue Jul 22, 2008 6:25 am
Has thanked: 4 times
Been thanked: 2 times

Help with TMR0 on a 16F876A

Post by spryderweb »

Hello,
I am trying to create a simple interrupt to keep track of time. I enable TMR0 and my clock source is set to Internal. I am using a prescaler of 1:256.
I am using a 4MHz clock on the osc1/ocs2 pins.
The problem is that the macro for the interrupt never gets called. The interrupt is enabled. I guessing it is something to do with the clocks.
Suggestions???
Thanks

kersing
Valued Contributor
Valued Contributor
Posts: 2045
Joined: Wed Aug 27, 2008 10:31 pm
Location: Netherlands
Has thanked: 553 times
Been thanked: 1081 times

Re: Help with TMR0 on a 16F876A

Post by kersing »

Have you checked the controller is running as expected using a one second flasher? (Loop: Pin on, delay 1 s, Pin off, delay 1 s)

If the 1 second flasher works, please post your flowchart for us to have a look at. Now we have to guess what might be wrong.
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

medelec35
Matrix Staff
Posts: 9521
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times

Re: Help with TMR0 on a 16F876A

Post by medelec35 »

My guess (and it can only be that as you have not posted a flowchart) is your configuration settings are wrong.
First check yout timing is correct. Just create a 1 second flash test.
If it's not working then check configuration settings.
Here is a place to start.
If still having problems than you should post a flowchart.
What version of Flowcode have you got?


Martin

Edit: Kersing has posted while I was typing.
So i'm probably duplicating information.
Martin

spryderweb
Posts: 14
Joined: Tue Jul 22, 2008 6:25 am
Has thanked: 4 times
Been thanked: 2 times

Re: Help with TMR0 on a 16F876A

Post by spryderweb »

Thanks for help guys. The one second flasher you wanted me to try did work properly. Turns out I was making it way to complicated. Used an easier method and it works fine now

Thanks

Post Reply