Skip to main content
Visitor II
March 31, 2003
Question

Timers

  • March 31, 2003
  • 3 replies
  • 1199 views
Posted on March 31, 2003 at 12:43

Timers

    This topic has been closed for replies.

    3 replies

    el98650Author
    Visitor II
    March 31, 2003
    Posted on March 31, 2003 at 11:16

    Hello again,

    i have some questions regarding the increment of the timers. Is the Timer register incremented once a cycle?

    To generate a precies Tick every 50 ms with a clock at 20MHz is the required reload value 0x03E8?(20Mhz*50ms)?

    Thanks

    Vasilios

    el98650Author
    Visitor II
    March 31, 2003
    Posted on March 31, 2003 at 11:50

    OK here is the code bit which confused me:

    / * this. Timeout is set to 5 msec assuming a 20 MHz bus

    /// ---------------------------------------------------------------

    /// Configuration of CC1 timer 0:

    /// ---------------------------------------------------------------

    /// - timer 0 works in timer mode

    /// - prescaler factor is 8

    /// - timer 0 run bit is set

    T01CON = 0x0000; // load CAPCOM1 timer 0 and timer 1

    T0 = 0xCF2C; // load CAPCOM1 timer 0 register

    T0REL = 0xCF2C; // load CAPCOM1 timer 0 reload register

    According to the c167 users manual (is there any better document around?) the resolution with a 20Mhz clock is 400ns, so the loaded value would generate a 21ms delay wouldn't it?

    Thanks

    (The Value i think i need for 50ms is a prescaler of 16 and a register value of 0xF424) ...
    el98650Author
    Visitor II
    March 31, 2003
    Posted on March 31, 2003 at 12:43

    AHEM,

    counting upwards....

    Next time i make sure i read better before asking..

    Vasilios