12.5.7 Timebase
Name: | MCLKTIMEBASE |
Offset: | 0x06 |
Reset: | 0x00 |
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
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))