#include "adc.h"#include "board.h"Defines | |
| #define | TRGEN (0x1) |
| Hardware triggering. | |
| #define | TRGSEL (0x0) |
| Use a Timer output signal (on rising edge) from TIOA0 (for this example). | |
| #define | LOWRES (0x1) |
| 8-bit result output | |
| #define | SLEEP (0x0) |
| Normal Mode. | |
| #define | PRESCAL (0x2) |
| AD CLK = 8 MHz. | |
| #define | STARTUP (0xf) |
| This time period must be higher than 20 µs and not 20 ms;. | |
| #define | SHTIM (0x2) |
| Sample & Hold time. | |
Functions | |
| void | ADCInit (void) |
| #define SHTIM (0x2) |
Sample & Hold time.
Must be higher than 3 ADC clock cycles but depends on output impedance of the analog driver to the ADC input.
Sample & Hold Time = (SHTIM+1) / ADCClock
| #define STARTUP (0xf) |
This time period must be higher than 20 µs and not 20 ms;.
Startup Time = (STARTUP+1) * 8 / ADCClock
| void ADCInit | ( | void | ) |
Init A/D converter
1.5.9