c - PIC18F timer for minutes and hours -


#include<p18f452.h> void t0_init();  void main() {     trisc=0;        // configure portb output port.     latc=0x01;     t0con=0x07;     // prescaler= 1:256, 16-bit mode, internal clock     t0_init();     while(1)     {             // initialize timer0             latc=0x00;             t0_init();      //delay 1 sec             latc=0x01;             t0_init();     //again delay 1 sec     } }  void t0_init() {     int a=0;      //while(a<2)   // {     tmr0h=0xf0;    // values calculated 1 second delay 4mhz crystal     tmr0l=0xbd;    //4/4mhz =1us=1us*prescaler=256us=1sec/256u=0xf42-(ffff)=f0bd     t0conbits.tmr0on=1;         // timer0 on     while(intconbits.tmr0if==0);        // wait until tmr0if gets flagged     t0conbits.tmr0on=0;                 // timer0 off     intconbits.tmr0if=0;                // clear timer0 interrupt flag     //   a++;     //  } } 

it accurate delay , doing work want longer delays of hours or minutes. , longer delays. tried using counter increments on every flagged, not work.

i'm not experienced programmer , not sure want use delays in, had tried make lengthy delay pic18f4550 didnt work, i.e. minutes , hours. have considered using ic like, cd4060 or ds1307. can follow link cd4060: http://dmohankumar.wordpress.com/2012/05/13/design-your-circuit-part-ii-cd-4060-timer/. ds1307 can check in studentcompanion site: http://www.studentcompanion.co.za/post/digital-clock-using-pic-microcontroller-and-the-ds1307-real-time-clock-xc8-compiler/. wish success, thanks


Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -