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.

Need Help Programming a Timer 16f887

Status
Not open for further replies.

rkond2

Newbie level 1
Joined
Nov 8, 2012
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,289
I am writing a program that will use the 16f887 microcontroller and use it to run a timer that would count down from 60 (or more) seconds to 0. It must be put on the LCD Display as: XX:YZ. Where XX is seconds, Y is 1/10 second and Z is 1/100 of a second. I have my initializing of T1CON - 0x30 (pre-scale 1:8), TMR1IF = 0, TMR1IE = 1, and TMR1ON = 1.

I am not really sure on the interrupt function, but I believe that is what. I need to do. Any help, advice, etc?
 

Rkond2, please use google for search, this example is very simple,
you may found very usefull info for your project on www.mikroe.com,
regards
 

An overflow interrupt would do the job but a 16-bit timer is not enough to count up to 1 sec even with the prescaler for xtal frequencies in the MHz range. So you may decrease the frequency or use a countdown variable in the ISR to time 1 sec then minute then hour etc... For example if your timer overflows at every 25ms then a countdown of 40 will time exactly 1 sec.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top