***************************************************************************************************************
Detailed Description:
Example shows implementation of Analog Comparator ‘45.7.5 Windowed mode (#s 5A & 5B)’ of S32K1XXRM using S32 SDK API.
The Comparator is configured to compare analog input 0(AIN0) with half the reference voltage generated with the internal DAC.
PDB is used to generate pulse output which is used as sampling windows of CMP block via TRGMUX. PDB period is 5ms, the first 2.5ms WINDOW=1 and the next 2.5ms WINDOW=0.
Pdb0PulseOut not only be TRGMUX to Cmp0Sample but also to TrgmuxOut0, so that we are able to observe WINDOW at TRGMUX_OUT0(PTA1) pin.
Based on the input from CMP0_IN0 (1kHz external triangle wave) the LEDs light by the following rules:
1) Vin < DAC voltage : RED on, GREEN off
2) Vin > DAC voltage : RED off, GREEN on
3) Unknown state : RED on, GREEN on
EVB connection:
Signal Function pin S32K144EVB-Q100
WINDOW TRGMUX_OUT0 PTA1 J5.5 2.5ms WINDOW=1 and 2.5ms WINDOW=0
Plus input CMP0_IN0 PTA0 J5.7 Need to connect external 1khz triangle wave
COUTA CMP0_OUT PTE3 J1.16
square wave PTC1 PTC1 J5.13 If there is no external triangle wave, a square wave(PTC1) is generated and output to CMP0 (PTA1)
*
* ------------------------------------------------------------------------------------------------------------------------
* Test HW: S32K144EVB-Q100
* MCU: S32K144UAVLL 0N47T
* Target: Debug_FLASH
* Compiler: S32DS3.4
* SDK release: S32SDK_S32K1XX_RTM_4.0.3
* Debugger: PEMicro OpenSDA
* ------------------------------------------------------------------------------------------------------------------------
Revision History:
Ver Date Author Description of Changes
1.0 Nov-9-2023 Robin Shen Initial version, based on cmp_dac_s32k144 and pdb_periodic_interrupt_s32k144
***************************************************************************************************************