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.

16F72 digital clock

Status
Not open for further replies.

GreenBeret

New Member
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...
 

sahu

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

can u provied it ckt dia.?
 

GreenBeret

New Member
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...
 

sahu

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

i have F84 Miniature Real-Time Controller, but it is no usefull for u.
 

blueroomelectronics

Well-Known Member
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.
 

GreenBeret

New Member
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?
 

blueroomelectronics

Well-Known Member
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:

GreenBeret

New Member
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...
 

GreenBeret

New Member
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..
 
Status
Not open for further replies.

EE World Online Articles

Loading
Top