![]() | ![]() | ![]() |
| |||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
![]() |
| | Tools |
| | #1 |
|
Hi all, i am new to PIC. I am trying to create a digital clock with 16F72 and Hitech C. I want to use timer1 in sleep mode with backup battery when the external power goes down.. I want to get precise timing for half a second to toggle second LED to make it blink once in a second. ie. half of a second in OFF condition and half of a second in ON condition so that i can see a proper blinking of 60 times in a minute. Please suggest a crystal speed that i can use for this requirement with its prescaler. I dont like to set the timer1 with a initial value because it will cause precision errors in time.. i would like to use bresenhams method for timer to get precise timing. Please suggest... | |
| |
| | #2 | |
| Quote:
| ||
| |
| | #3 |
|
I dont have any circuit as of now... My idea is to connect PORTB to 7segment display parallely and scan segment using PORTA. I know we can use 32.768KHz crystal, but it will take 8seconds delay to overflow. I want to use this low speed crystal because of power saving... I wanted to 0.5 second notification for second blinking...
| |
| |
| | #4 | |
| Quote:
| ||
| |
| | #5 |
|
With no prescaler it should take 2 seconds to overflow. You can bsf the top two bits on the timer register to cause overflow every 0.5sec bsf will not reset the prescaler. | |
| |
| | #6 |
|
Thanks blueroomelectronics for your help. Here i have some more doubts according to your method... 1. While setting top two bits, will i loose some instruction cycles and will it lead to precision errors..? 2. After each overflow, do i need to set the top two bit again.. meaning for each overflow, do i need to bsf two bits? | |
| |
| | #7 |
|
Hopefully your clock is interrupt driven, you won't loose cycles as it'll set them when the count is very low in that register.
Last edited by blueroomelectronics; 29th October 2009 at 07:38 PM. | |
| |
| | #8 |
|
Thanks a lot... I will try it and let u know.. As i am new to PIC, it will take me couple of days to complete the full pgm and circuit...
| |
| |
| | #9 |
|
Pic can use as little as 2ma -- no output ports, so you may not need sleep mode.
| |
| |
| | #10 |
|
In sleep a PIC uses much less than 2mA, think uA
| |
| |
| | #11 |
|
Hi, Now i am facing a issue with my code. I enabled the PIE1<0> bit to enable timer1 interrupt. I am getting the interrupts for only sometimes, after that its not giving interrupt. I have a simulator software, when i test in that, i can see the PIE1<0> bit is getting cleared after some time... How this bit gets cleared automatically.. ? Pls help.. | |
| |
|
| Tags |
| 16f72, clock, digital |
| Thread Tools | |
| Display Modes | |
| |
Similar | ||||
| Title | Starter | Forum | Replies | Latest |
| Digital Clock | junaid766 | Micro Controllers | 8 | 9th December 2008 11:12 PM |
| digital clock | xVorticity | General Electronics Chat | 5 | 28th October 2008 08:20 PM |
| Digital clock | amsung2 | Micro Controllers | 22 | 5th August 2008 04:51 PM |
| Digital Clock | Overclocked | Electronic Projects Design/Ideas/Reviews | 19 | 5th July 2006 10:06 AM |
| Digital Clock help | Tom McCurdy | General Electronics Chat | 3 | 14th July 2005 03:48 AM |