12.5.4 Main Clock Timebase
| Name: | MCLKTIMEBASE |
| Offset: | 0x6 |
| Reset: | 0x0 |
| Property: | - |
| Bit | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | |
| TIMEBASE[4:0] | |||||||||
| Access | R/W | R/W | R/W | R/W | R/W | ||||
| Reset | 0 | 0 | 0 | 0 | 0 | ||||
Bits 4:0 – TIMEBASE[4:0] Timebase
This bit field specifies the number of CLK_PER cycles that is equivalent to or larger than 1 μs. This is used for timing internal delays, such as the ADC start-up time.
The value must be rounded up to the closest integer. The following code snippet shows how
to do this using the
ceil
function.#include <math.h> #define CLK_PER 3333333ul // 20 MHz/6 = 3.333333 MHz #define TIMEBASE_VALUE ((uint8_t) ceil(CLK_PER*0.000001))
