![]() |
S32 SDK
|
The comparator (CMP) module is an analog comparator integrated in MCU.
Features of the CMP module include:
The user can configure the CMP in many ways: -CMP_DRV_Init - configures all CMP features -CMP_DRV_ConfigDAC - configures only DAC features -CMP_DRV_ConfigTriggerMode - configures only trigger mode features -CMP_DRV_ConfigComparator - configures only analog comparator features -CMP_DRV_ConfigMUX - configures only MUX features
Also the current configuration can be read using: -CMP_DRV_GetConfigAll - gets all CMP configuration -CMP_DRV_GetDACConfig - gets only DAC configuration -CMP_DRV_GetMUXConfig - gets only MUX configuration -CMP_DRV_GetInitTriggerMode - gets only trigger mode configuration -CMP_DRV_GetComparatorConfig - gets only analog comparator features
When the MCU exits from STOP mode CMP_DRV_GetInputFlags can be used to get the channel which triggered the wakeup. Please use this function only in this use case. CMP_DRV_ClearInputFlags will be used to clear this input change flags.
CMP_DRV_GetOutputFlags can be used to get output flag state and CMP_DRV_GetOutputFlags to clear them.
The main structure used to configure your application is cmp_module_t. This structure includes configuration structures for trigger mode, MUX, DAC and comparator: cmp_comparator_t, cmp_anmux_t, cmp_dac_t and cmp_trigger_mode_t
The next example will compare 2 external signals (CMP input 0 an CMP input 1). The output can be measured on port E, pin 4.
Modules | |
Comparator Driver | |
Comparator Peripheral Driver. | |
Comparator HAL | |
Comparator Hardware Abstraction Layer. | |