DolphinV4 API
1.6.1.0
|
The ULP timer oscillators error can be reduced using the calibration values stored in the chip MOD area. The calibration values act as a correction to the timer deviation from the ideal timing:
WatchdogTimer calibration:
The example below shows how to use the 16 bit integer calibration value stored in the mod area by the factory. The timer correction factor is gModArea.val.u16CalibWatchdog/WATCHDOG_CALIB_CONST. The constant WATCHDOG_CALIB_CONST is used to speed up the end value calculation. The division with WATCHDOG_CALIB_CONST is interpreted by the compiler as shifting, because 2048 = 2^11. Valuable time is saved in comparison to a float division.
FlywheelTimer calibration:
The example below shows how to use the 32 bit float calibration value:
ShortTermTimer calibration:
The example below shows how to use the 16 bit integer calibration value: Instead of a division with 32bit float a 16 bit value together with a constant SHORT_TERM_CALIB_CONST is used to speed up the end value calculation. The division with SHORT_TERM_CALIB_CONST is interpreted by the compiler as shifting, because 2^11 = 2048, so valuable time is saved in comparison to a float division.