1. folorunsoa

    Thread Starter New Member

    Aug 11, 2014
    3
    0
    I am working on traffic-light-controller project using PIC18F4550 and cascaded three 74LS164 shift-registers with CCS C programming. I am having a problem with the timing. When I use timer2, as can be seen in the code below, my circuit looses 10mins within 24 hours daily. When I changed to timer0, it lost one hour daily. Can anyone in the forum help with appropriate timer setup configuration? Thank you.
    folorunsoa.

    //set_timer2(0);
    //setup_timer_2(T2_DIV_BY_4,100,10);
    //enable_interrupts(INT_TIMER2 );
    setup_timer_0(RTCC_INTERNAL|RTCC_DIV_32); //1.0 s overflow
    enable_interrupts(INT_TIMER0);
    enable_interrupts(INT_RB );
    enable_interrupts(global);
     
    Last edited: Aug 11, 2014
  2. MrChips

    Moderator

    Oct 2, 2009
    12,437
    3,360
    You're off to a bad start.

    Think about it. How does a subject title such as "please help" help anyone?

    Next time please use a more descriptive subject title.
     
    Eric007 likes this.
  3. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,386
    1,605
    What is the timer source?

    What frequency?

    What accuracy?
     
  4. BobTPH

    Active Member

    Jun 5, 2013
    782
    114
    If you are not using a crystal, 10 minutes a day is better than you can expect.

    Bob
     
Loading...