Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
There are several ways to improve RTC accuracy. One method I use is a simple soft 'trim' routine on the 1.0-msec Timer 2 interrupts to adjust the 1-second "heartbeat" to within plus or minus 250-nsecs (with my 16-MHz xtal). This provides much finer frequency adjustment compared to a ceramic trim capacitor in the crystal oscillator circuit.Ayne said:I want to make Real time clock using PIC16F877A.( Clock Frequency 20 MHz.)
I want to ask that TMR0 or TMR1 or TMR2 interrupt is not enough accurate for time(1 Second)...
Or What is the best way for making an accurate time delay???
Thanks.
;
; ISR_Trim routine is used to adjust the RTC 1-second period to
; within plus or minus 250-nsecs to make up for a crystal which
; may be slightly off frequency. The routine adds or subtracts
; one 250-nsec count (1 Tcy) from Timer 2 for the first 'CCTR'
; number of 1-msec interrupts each second. Theoretical accuracy
; to within 8.0 secs/year, not including temperature drift and
; crystal aging.
;
; variables: CCNT, correction count from EEPROM [00 to FF]
; CVAL, correction value from EEPROM [FF or 01]
; CCTR, correction counter reloaded from 'CCNT'
; variable each 1-second period
;
; range: ±255 250-nsec counts/second (±63.75 usecs/sec)
;
ISR_Trim
movf CCTR,W ; correction counter 0? |B0
bz ISR_Sw_Input ; yes, branch, else |B0
decf CCTR,f ; decrement counter |B0
movf CVAL,W ; get correction value FF or 01 |B0
addwf TMR2,f ; apply 1 Tcy timer correction |B0
;
; reload timer Trim correction counter once-per-second
;
movf CCNT,W ; reload correction counter var |B0
movwf CCTR ; |B0
Ayne said:I want to make Interrup on every 1 Second using Timer1.. Plz guied me in this way.
Thanks
The code is close to finished but still untested because I haven't finished wiring up the prototype board. The transistors and half of the display are wired up but I haven't touched it for many weeks now. I will try to get to it soon.Ayne said:Mike, K8LH
Plz share the code here (if u don't mind).
I want to make clock similar to this but with big 7-Segment Display.
I will make my self a Big 7 Segment Display with LEDs.
Thanks.