Calculating Small time increments

I need to measure small portions of time (at least 500us) while using Keil's RTX51 with a System Slice of 20ms. I'm assuming that RTX51 already has a realtime counter that tracks clock ticks (or at least Timer0 overflows) since initialization. Does anyone know the variables/registers it uses for this. I cannot find any reference to tracking time that's less than one System Slice in the RTX manual

Normally I would set up another timer to do this tracking but Timer1 and Timer2 are already being used for UART and I2C functions. I have a fall back plan to use Timer1 (even while in use as a baud rate generator) but using system variables would be much cleaner

Parents
  • Unless you grab one of the other timers, this will typically mean you have to

    *) Stop RTX's multitasking, to free Timer0
    *) (Save its configuration)
    *) Set it up the way you need it
    *) do your timed thing
    *) (restore the saved configuration)
    *) Re-enable multitasking

    Or you could just look at the values of the Timer0 registers, and try to make sense out of them. But that will cause its own kinds of problems as soon as you come close to the time slice boundaries.

Reply
  • Unless you grab one of the other timers, this will typically mean you have to

    *) Stop RTX's multitasking, to free Timer0
    *) (Save its configuration)
    *) Set it up the way you need it
    *) do your timed thing
    *) (restore the saved configuration)
    *) Re-enable multitasking

    Or you could just look at the values of the Timer0 registers, and try to make sense out of them. But that will cause its own kinds of problems as soon as you come close to the time slice boundaries.

Children
More questions in this forum