12.5.7 Timebase

Name: MCLKTIMEBASE
Offset: 0x06
Reset: 0x00

Bit 76543210 
    TIMEBASE[4:0] 
Access R/WR/WR/WR/WR/W 
Reset 00000 

Bits 4:0 – TIMEBASE[4:0] Timebase

This bit field specifies the count of CLK_PER cycles that is equivalent to or larger than 1 µs. This is used for timing internal delays such as 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))