Proton BASIC Compiler - Correcting timing errors

  • PicŪ Basic

  • Correcting timing errors

    I got this one from Olivier

    When writing a timer routine it is often very difficult to get accuracy. If timing correction is attempted at the lowest level in say the OSC freq selection or the interrupt routine reload value, even though the error may be very small it can accumulate over time to become quite large. A 1 us error every 100hz will add up to 8.64 seconds per day.

    A way to reduce those errors is to time the code over a reasonable period i.e. 24 hours. Then at the appropriate section in the routine, you can compensate for the measured error by adding or subtracting in the necessary correction factor.

    Even crude loop counters can be made pretty accurate over extended periods.

    contributed by Timothy Box.
  • Recent Activity


    UART and USB Issues with PIC18F97J94

    Thread Starter: mitch

    I am having trouble getting UART3, UART4 and the USB to work on a PIC18F97J94.. I am migrating a project from the 18F47J53 to an 18F97J94 as I...

    top204 Today, 13:36 Go to last post