ACMP (模拟比较器)
简介
ET6001芯片内置 4个Dual-ACMP 比较器模块,每个 Dual-ACMP比较器模块包含 2个ACMP (分别称为高电平 ACMP 和低电平 ACMP)。每个高电平 ACMP 包括一个下斜坡(RAMP)产生器,只能产生下斜坡波形,输入到高电平 ACMP 内部的 DAC。每个 ACMP 包含 1 个内部 DAC,1个 CMP 和对应的 CMP 数字滤波模块。
CMP比较器在每个模块内用“+”或“-”表示输入信号源,其中“+”和“-”分别表示输入量和参考量。比较器产生一个数字量输出,指示正输入上的电压是否大于负输入上的电压。同时,可在有噪声信号时避免发生意外输出转换。比较器的正输入和负输入可以选择外部引脚或DAC驱动或内部输入。
ACMP适用于功率应用,如峰值电流模式控制 (例如:电荷控制的LLC)、软开关电路处理(例如:CrM模式PFC)、OCP、OVP、OTP等保护功能,功率因数校正、电压跳闸监测,与XBAR (内部互联总线模块)外设联手,实现复杂的硬件控制逻辑。
功能概述
可选的参考端和比较端的模拟输入;
Daul-ACMP可以配置两个DAC,模拟比较器和数字模块成对工作;
高电平ACMP支持产生RAMP波形输入到内部DAC;
模拟比较器针对输出窄脉冲具有消隐功能;
模拟比较器具有数字输出滤波处理;
模拟比较器具有失调校正功能;
模拟比较器内置 DAC 基准可选择内部参考电压或者引脚外灌输入基准电压;
备注
ACMP中的CDAC的外部参考电压与BDAC共用一个引脚输入,但是cDAC的内部参考电压源为VDDA,不是内部参考Vref(2p5V); DAC的输出电压校准包括偏置和增益,默认使用出厂的校准设置值;
配置流程说明
基础比较功能:
调用
ACMP_configComparator()对比较器进行单独配置,比较器的正负端源进行选择;如果负端源选择内部DAC则需要执行下一步的DAC配置,如果不是可以跳过DAC配置;调用
ACMP_configDAC()对比较器内的DAC进行单独配置,需要配置DAC的加载模式、DAC信号触发源、DAC触发延迟时间、DAC参考信号源选择等;调用
ACMP_configOutputs()配置ACMP的输出源选择;如果需要将ACMP的输出到IO上,要在XBAR模块进行配置;调用
ACMP_enableModule()使能ACMP模块。DAC在初始化配置后,需要结合输出波形对码值进行配置;
比较器输出增加附加配置:
调用
ACMP_setHysteresis()配置ACMP的迟滞功能,包括迟滞大小和迟滞作用方向。调用
ACMP_configBlanking()配置ACMP输出的消隐功能,包括消隐窗口宽度和消隐延时;调用
ACMP_enableBlanking()进行使能。调用
ACMP_initFilter()和ACMP_configFilter()配置ACMP输出的数字滤波功能。ACMP的负端选择DAC源,DAC源选择内部的RAMP波形:
在第一个基础比较功能中的DAC初始化中将DAC的源选择为内部RAMP通路 ACMP_DAC_H_srcSel;
调用 ACMP_configRamp() 配置RAMP波形的最大复位值和步进值。
备注
ACMP模块中仅高电平比较器可以选择RAMP波形;
迟滞功能说明
ACMP模块内置迟滞功能,可以配置迟滞大小和迟滞作用方向。当比较器输出发生转换时,迟滞功能会在输入信号上添加一个迟滞电压,以防止输入信号的微小波动引起比较器输出的频繁切换。
调用 ACMP_setHysteresis() 配置迟滞功能。迟滞大小可以通过配置迟滞电压的值来设置,迟滞作用方向可以选择正向或反向。
消隐功能说明
ACMP模块内置消隐功能,可以配置消隐窗口宽度和消隐延时。当比较器输出发生转换时,消隐功能会在输入信号上添加一个消隐电压,以防止输入信号的微小波动引起比较器输出的频繁切换。 消隐触发源来自SRPWM,SRPWM的事件输出作为消隐触发源,对应触发源配置在SRPWM驱动文件中查看。
配置流程如下:
调用
ACMP_configBlanking()配置消隐功能。消隐窗口宽度可以通过配置消隐窗口电压的值来设置,消隐延时可以通过配置消隐延时的值来设置。调用
ACMP_enableBlanking()进行使能。调用
ACMP_configOutputs()配置输出。并将ctripout 源选择为同步输出。
RAMP波配置流程说明
以峰值电流控制为例:
控制环路如下:
实现方案图如下:
上图中的Ramp为配置ACMP产生的RAMP波,IL则为外部输入信号。通常
软件配置流程如下: 配置SRPWM0作为ACMP的触发源,以1kHz的频率触发。通过ACMP作为保护信号,并输出给XBAR,再通过XBAR输出给SRPWM1进行A路封波。
ACMP 配置:
调用
ACMP_configComparator()对比较器进行单独配置,选择比较器的正负端源。调用
ACMP_setRampClkPrescale()设置分频系数。调用
ACMP_configRamp()配置RAMP波形的最大复位值、步进值和延迟值。备注
最大复位值(斜波初始值)和步进值需要左移四位后写入。 RAMP的下降斜率为:
\[K_{ramp} = \frac{\text{RAMP初始值}}{\text{递减频率}}\]调用
ACMP_configDAC()对比较器内的DAC进行单独配置,需要配置DAC的加载模式、DAC信号触发源、DAC触发延迟时间、DAC参考信号源选择等。备注
config.loadMode = ACMP_DAC_LOADMODE_SHADOWconfig.dacHsrcSel = ACMP_DAC_H_RAMP_OUTPUT;config.tdatSel = ACMP_DAC_TDAT_EXTERNAL;
调用
ACMP_enableModule()使能ACMP模块。
触发源配置及输出封波配置:
使用SRPWM0作为触发源;使用SRPWM1作为输出封波。
SRPWM相关配置参考: 高精度脉宽调制器 (SRPWM)
XBAR配置:
XBAR相关配置参考: 信号互联配置 (XBAR)
应用示例
BDAC-CDAC比较,结果经XBAR传递到GPIO示例: ACMP/ACMP_bDAC_cDAC_DMA_input_XBAR_output。
IO-CDAC比较,结果经XBAR传递到GPIO示例: ACMP/ACMP_io_cDAC_input_XBAR_output。
比较器触发中断示例: ACMP/ACMP_output_interrupt。
窗口比较器使用,同时使用高低电平比较器,结果输出到XBAR并或上传递到IO输出示例: ACMP/ACMP_io_cDAC_input_XBAR_Windows_output。
RAMP波与外部IO电压与相比较,比较结果通过XBAR连接,作为SRPWM的封波信号: ACMP/ACMP_ramp_PWM_sealing。
CMP消隐示例: ACMP/ACMP_Blanking。
输出数字滤波示例: ACMP/ACMP_digital_filter。
API Reference
Header File
Functions
-
void ACMP_enableModule(ACMP_Type *ACMPx, uint8_t channel)
Enable ACMP.
- 参数:
ACMPx – select ACMP device
ACMP0
ACMP1
ACMP2
ACMP3
channel – select channel in ACMP
ACMP_CHANNEL_H
ACMP_CHANNEL_L
-
void ACMP_disableModule(ACMP_Type *ACMPx, uint8_t channel)
Disable ACMP.
- 参数:
ACMPx – select ACMP device
ACMP0
ACMP1
ACMP2
ACMP3
channel – select channel in ACMP
ACMP_CHANNEL_H
ACMP_CHANNEL_L
-
void ACMP_configComparator(ACMP_Type *ACMPx, uint8_t channel, ACMP_Comparator *config)
Configure the comparator of the ACMP module.
- 参数:
ACMPx – select ACMP device
ACMP0
ACMP1
ACMP2
ACMP3
channel – select channel in ACMP
ACMP_CHANNEL_H
ACMP_CHANNEL_L
config – Pointer to the configuration structure ACMP_Comparator
-
void ACMP_configOutputs(ACMP_Type *ACMPx, uint8_t channel, ACMP_TripOut *config)
Output configuration.
- 参数:
ACMPx – select ACMP device
ACMP0
ACMP1
ACMP2
ACMP3
channel – select channel in ACMP
ACMP_CHANNEL_H
ACMP_CHANNEL_L
config – Pointer to the configuration structure ACMP_TripOut
ctripOut XBAR
ctrip PWM
-
uint32_t ACMP_getStatus(ACMP_Type *ACMPx)
Get ACMP output status.
- 参数:
ACMPx – select ACMP device
ACMP0
ACMP1
ACMP2
ACMP3
- 返回:
uint32_t all interrupt status masks
-
void ACMP_configDAC(ACMP_Type *ACMPx, uint8_t channel, ACMP_DAC_Config *config)
Sets the configuration for the internal comparator DACs.
- 参数:
ACMPx – Pointer to the ACMP peripheral instance.
ACMP0
ACMP1
ACMP2
ACMP3
channel – The channel to configure
ACMP_CHANNEL_H
ACMP_CHANNEL_L
config – Pointer to the configuration structure for the DAC
-
void ACMP_setDACValue(ACMP_Type *ACMPx, uint8_t channel, uint16_t data)
Sets the value of the internal DAC for the specified channel.This function sets the value of the internal Digital-to-Analog Converter (DAC) for the specified channel of the Analog Comparator (ACMP) module.
- 参数:
ACMPx – Pointer to the ACMP peripheral instance.
ACMP0
ACMP1
ACMP2
ACMP3
channel – The channel to configure
ACMP_CHANNEL_H
ACMP_CHANNEL_L
data – The 16-bit data value to set for the DAC.
-
uint16_t ACMP_getDACValue(ACMP_Type *ACMPx, uint8_t channel)
Gets the current value of the internal DAC.
This function reads the value of the internal DAC for the specified ACMP channel.
备注
The caller should ensure that the ACMP peripheral is properly initialized before calling this function.
- 参数:
ACMPx – Pointer to the ACMP peripheral instance.
ACMP0
ACMP1
ACMP2
ACMP3
channel – The channel to configure
ACMP_CHANNEL_H
ACMP_CHANNEL_L
- 返回:
uint16_t The current value of the internal DAC
-
void ACMP_configureSyncSource(ACMP_Type *ACMPx, uint8_t channel, uint16_t syncSource)
Configures sync source for comparator.
- 参数:
ACMPx – Pointer to the ACMP peripheral instance.
ACMP0
ACMP1
ACMP2
ACMP3
channel – The channel to configure
ACMP_CHANNEL_H
ACMP_CHANNEL_L
syncSource – The synchronization source to set for the comparator.
ACMP_DAC_TRIGGER_SEL_SW
ACMP_DAC_TRIGGER_SEL_STIM
ACMP_DAC_TRIGGER_SEL_ETIM
ACMP_DAC_TRIGGER_SEL_SRPWM
ACMP_DAC_TRIGGER_SEL_SELF_TX_DONE
ACMP_DAC_TRIGGER_SEL_ACOMP
ACMP_DAC_TRIGGER_SEL_DMA
-
void ACMP_setHysteresis(ACMP_Type *ACMPx, uint8_t channel, ACMP_HysteresisValue value, ACMP_HysteresisDirection dir)
Sets the comparator hysteresis settings.
- 参数:
ACMPx – Pointer to the ACMP peripheral instance.
ACMP0
ACMP1
ACMP2
ACMP3
channel – The channel to configure
ACMP_CHANNEL_H
ACMP_CHANNEL_L
value – hysteresis value to set for the comparator.
HYSTERESIS_VALUE_0MV
HYSTERESIS_VALUE_7MV
HYSTERESIS_VALUE_14MV
HYSTERESIS_VALUE_23MV
HYSTERESIS_VALUE_36MV
HYSTERESIS_VALUE_43MV
HYSTERESIS_VALUE_52MV
HYSTERESIS_VALUE_62MV
dir – The direction of the hysteresis
ACMP_HYSTERESIS_UP
ACMP_HYSTERESIS_DOWN
-
void ACMP_enableLatchResetOnSYNC(ACMP_Type *ACMPx, uint8_t channel)
Enables reset of comparator digital filter output latch on SYNC.
- 参数:
ACMPx – Pointer to the ACMP peripheral instance.
ACMP0
ACMP1
ACMP2
ACMP3
channel – The channel to configure
ACMP_CHANNEL_H
ACMP_CHANNEL_L
-
void ACMP_disableLatchResetOnSYNC(ACMP_Type *ACMPx, uint8_t channel)
Disables reset of comparator digital filter output latch on SYNC.
- 参数:
ACMPx – Pointer to the ACMP peripheral instance.
ACMP0
ACMP1
ACMP2
ACMP3
channel – The channel to configure
ACMP_CHANNEL_H
ACMP_CHANNEL_L
-
void ACMP_SWTriggerDAC(ACMP_Type *ACMPx, uint8_t channel)
Software trigger the specified DAC.
- 参数:
ACMPx – Pointer to the ACMP peripheral instance.
ACMP0
ACMP1
ACMP2
ACMP3
channel – The channel to configure
ACMP_CHANNEL_H
ACMP_CHANNEL_L
-
void ACMP_configBlanking(ACMP_Type *ACMPx, uint8_t channel, uint16_t blankingWidth, uint16_t blankingDelay)
Sets the ePWM module blanking signal that holds trip in reset.
- 参数:
ACMPx – Pointer to the ACMP peripheral instance.
ACMP0
ACMP1
ACMP2
ACMP3
channel – The channel to configure
ACMP_CHANNEL_H
ACMP_CHANNEL_L
blankingWidth – The width of the blanking signal.
blankingDelay – The delay of the blanking signal.
-
void ACMP_enableBlanking(ACMP_Type *ACMPx, uint8_t channel)
Enables an ePWM blanking signal to hold trip in reset.
- 参数:
ACMPx – Pointer to the ACMP peripheral instance.
ACMP0
ACMP1
ACMP2
ACMP3
channel – The channel to configure
ACMP_CHANNEL_H
ACMP_CHANNEL_L
-
void ACMP_disableBlanking(ACMP_Type *ACMPx, uint8_t channel)
Disables an ePWM blanking signal from holding trip in reset.
- 参数:
ACMPx – Pointer to the ACMP peripheral instance.
ACMP0
ACMP1
ACMP2
ACMP3
channel – The channel to configure
ACMP_CHANNEL_H
ACMP_CHANNEL_L
-
void ACMP_setBlankingHold(ACMP_Type *ACMPx, uint8_t channel)
Enables an ePWM blanking signal to hold trip in reset.
- 参数:
ACMPx – Pointer to the ACMP peripheral instance.
ACMP0
ACMP1
ACMP2
ACMP3
channel – The channel to configure
ACMP_CHANNEL_H
ACMP_CHANNEL_L
-
void ACMP_clearBlankingHold(ACMP_Type *ACMPx, uint8_t channel)
Disables an ePWM blanking signal from holding trip in reset.
- 参数:
ACMPx – Pointer to the ACMP peripheral instance.
ACMP0
ACMP1
ACMP2
ACMP3
channel – The channel to configure
ACMP_CHANNEL_H
ACMP_CHANNEL_L
-
void ACMP_initFilter(ACMP_Type *ACMPx, uint8_t channel)
Initializes the digital filter.
- 参数:
ACMPx – Pointer to the ACMP peripheral instance.
ACMP0
ACMP1
ACMP2
ACMP3
channel – The channel to configure
ACMP_CHANNEL_H
ACMP_CHANNEL_L
-
void ACMP_clearFilterLatch(ACMP_Type *ACMPx, uint8_t channel)
This function clears the latch of the digital filter for the specified channel of the Analog Comparator (ACMP) module. It first checks if the provided ACMP peripheral is valid.
- 参数:
ACMPx – Pointer to the ACMP peripheral instance.
ACMP0
ACMP1
ACMP2
ACMP3
channel – The channel to configure
ACMP_CHANNEL_H
ACMP_CHANNEL_L
-
void ACMP_configFilter(ACMP_Type *ACMPx, uint8_t channel, uint16_t samplePrescale, uint16_t sampleWindow, uint16_t threshold)
Configures the digital filter of the high comparator.
- 参数:
ACMPx – Pointer to the ACMP peripheral instance.
ACMP0
ACMP1
ACMP2
ACMP3
channel – The channel to configure
ACMP_CHANNEL_H
ACMP_CHANNEL_L
samplePrescale – The prescale value for the sample clock.
sampleWindow – The window size for the digital filter.
threshold – The threshold value for the digital filter.
-
void ACMP_enableFilter(ACMP_Type *ACMPx, uint8_t channel)
Enable Filter for ACMP.
- 参数:
ACMPx – Pointer to the ACMP peripheral instance.
ACMP0
ACMP1
ACMP2
ACMP3
channel – The channel to configure
ACMP_CHANNEL_H
ACMP_CHANNEL_L
-
void ACMP_disableFilter(ACMP_Type *ACMPx, uint8_t channel)
Disable Filter for ACMP.
- 参数:
ACMPx – Pointer to the ACMP peripheral instance.
ACMP0
ACMP1
ACMP2
ACMP3
channel – The channel to configure
ACMP_CHANNEL_H
ACMP_CHANNEL_L
-
void ACMP_configRamp(ACMP_Type *ACMPx, uint16_t maxRampVal, uint16_t decrementVal, uint16_t delayVal)
Configures ramp parameters.
- 参数:
ACMPx – Pointer to the ACMP peripheral instance.
ACMP0
ACMP1
ACMP2
ACMP3
maxRampVal – The maximum value for the ramp generator.
decrementVal – The decrement value for the ramp generator.
delayVal – The delay value for the ramp generator.
-
void ACMP_setRampClkPrescale(ACMP_Type *ACMPx, uint16_t value)
Sets the ramp generator clock prescale value.
- 参数:
ACMPx – Pointer to the ACMP peripheral instance.
ACMP0
ACMP1
ACMP2
ACMP3
value – The 16-bit prescale value to set for the ramp generator clock.
-
void ACMP_setMaxRampValue(ACMP_Type *ACMPx, uint16_t value)
Sets the ramp generator maximum reference value.
- 参数:
ACMPx – Pointer to the ACMP peripheral instance.
ACMP0
ACMP1
ACMP2
ACMP3
value – The 16-bit value to set as the maximum reference for the ramp generator.
-
uint16_t ACMP_getMaxRampValue(ACMP_Type *ACMPx)
Gets the ramp generator maximum reference value.
- 参数:
ACMPx – Pointer to the ACMP peripheral instance.
ACMP0
ACMP1
ACMP2
ACMP3
- 返回:
maxvalue The maximum reference value for the ramp generator.
-
void ACMP_setRampDecValue(ACMP_Type *ACMPx, uint16_t value)
Sets the ramp generator decrement value.
- 参数:
ACMPx – Pointer to the ACMP peripheral instance.
ACMP0
ACMP1
ACMP2
ACMP3
value – The 16-bit value to set as the decrement value for the ramp generator.
-
uint16_t ACMP_getRampDecValue(ACMP_Type *ACMPx)
Gets the ramp generator decrement value.
- 参数:
ACMPx – Pointer to the ACMP peripheral instance.
ACMP0
ACMP1
ACMP2
ACMP3
- 返回:
stepvalue The current decrement value of the ramp generator.
-
void ACMP_selectRampLoad(ACMP_Type *ACMPx, ACMP_RAMP_LoadSel value)
Select the rampsts load.
- 参数:
ACMPx – Pointer to the ACMP peripheral instance.
ACMP0
ACMP1
ACMP2
ACMP3
value – The load selection.
-
void ACMP_setRampDelayValue(ACMP_Type *ACMPx, uint16_t value)
Sets the ramp generator delay value.
- 参数:
ACMPx – Pointer to the ACMP peripheral instance.
ACMP0
ACMP1
ACMP2
ACMP3
value – The 16-bit value to set as the delay for the ramp generator.
-
uint16_t ACMP_getRampDelayValue(ACMP_Type *ACMPx)
Gets the ramp generator delay value.
- 参数:
ACMPx – Pointer to the ACMP peripheral instance.
ACMP0
ACMP1
ACMP2
ACMP3
- 返回:
dealyvalue The current delay value of the ramp generator.
-
uint16_t ACMP_getRampClkCountValue(ACMP_Type *ACMPx)
Gets the ramp generator clock counter value.
- 参数:
ACMPx – Pointer to the ACMP peripheral instance.
ACMP0
ACMP1
ACMP2
ACMP3
- 返回:
value return the ramp clk counter value
-
uint16_t ACMP_getRampStatus(ACMP_Type *ACMPx)
Gets the ramp generator counter value.
- 参数:
ACMPx – Pointer to the ACMP peripheral instance.
ACMP0
ACMP1
ACMP2
ACMP3
- 返回:
status return the ramp status
-
uint32_t ACMP_getErrorStatus(ACMP_Type *ACMPx)
Get ACMP error status.
- 参数:
ACMPx – Pointer to the ACMP peripheral instance.
ACMP0
ACMP1
ACMP2
ACMP3
- 返回:
errstatus error status masks
-
void ACMP_clearErrorStatus(ACMP_Type *ACMPx, uint32_t errorStatus)
Clear the error status of the specified ACMP channel.
This function clears the error status of the specified ACMP channel. The error status mask is used to indicate which error status needs to be cleared.
备注
The caller should ensure that the ACMP peripheral is properly initialized before calling this function.
- 参数:
ACMPx – Pointer to the ACMP peripheral instance.
ACMP0
ACMP1
ACMP2
ACMP3
errorStatus – Error status mask, indicating which error status needs to be cleared
-
FlagStatus ACMP_getLatchStatus(ACMP_Type *ACMPx, uint8_t channel)
Gets the latch output value of comparator.
This function reads the latch output value of the comparator for the specified ACMP channel.
备注
The caller should ensure that the ACMP peripheral is properly initialized before calling this function.
- 参数:
ACMPx – Pointer to the ACMP peripheral instance.
ACMP0
ACMP1
ACMP2
ACMP3
channel – The channel to configure
ACMP_CHANNEL_H
ACMP_CHANNEL_L
- 返回:
FlagStatus The latch output status of comparator
-
FlagStatus ACMP_getDACTransferStatus(ACMP_Type *ACMPx, uint8_t channel)
Get the specified DAC txd end report.
- 参数:
ACMPx – Pointer to the ACMP peripheral instance.
ACMP0
ACMP1
ACMP2
ACMP3
channel – The channel to configure
ACMP_CHANNEL_H
ACMP_CHANNEL_L
- 返回:
FlagStatus the status of ACMP DAC output
-
void ACMP_clearDACTransferStatus(ACMP_Type *ACMPx, uint8_t channel)
Clear the specified DAC txd end report.
- 参数:
ACMPx – Pointer to the ACMP peripheral instance.
ACMP0
ACMP1
ACMP2
ACMP3
channel – The channel to configure
ACMP_CHANNEL_H
ACMP_CHANNEL_L
-
void ACMP_setInterruptMask(ACMP_Type *ACMPx, uint32_t interruptMask)
Set Interrupt Mask for ACMP.
- 参数:
ACMPx – Pointer to the ACMP peripheral instance.
ACMP0
ACMP1
ACMP2
ACMP3
interruptMask – interrupt masks
-
void ACMP_clearInterruptMask(ACMP_Type *ACMPx, uint32_t interruptMask)
Set Interrupt Mask for ACMP.
- 参数:
ACMPx – Pointer to the ACMP peripheral instance.
ACMP0
ACMP1
ACMP2
ACMP3
interruptMask – interrupt masks
-
void ACMP_enableInterrupt(ACMP_Type *ACMPx, uint32_t interruptMask)
Enable Interrupt for ACMP.
- 参数:
ACMPx – Pointer to the ACMP peripheral instance.
ACMP0
ACMP1
ACMP2
ACMP3
interruptMask – interrupt masks
-
void ACMP_forceInterrupt(ACMP_Type *ACMPx, uint32_t interruptMask)
Force Interrupt for ACMP.
- 参数:
ACMPx – Pointer to the ACMP peripheral instance.
ACMP0
ACMP1
ACMP2
ACMP3
interruptMask – interrupt masks
-
void ACMP_disableInterrupt(ACMP_Type *ACMPx, uint32_t interruptMask)
Disable Interrupt for ACMP.
- 参数:
ACMPx – Pointer to the ACMP peripheral instance.
ACMP0
ACMP1
ACMP2
ACMP3
interruptMask – interrupt masks
-
void ACMP_clearInterruptStatus(ACMP_Type *ACMPx, uint32_t interruptMask)
Clear IT for ACMP.
- 参数:
ACMPx – Pointer to the ACMP peripheral instance.
ACMP0
ACMP1
ACMP2
ACMP3
interruptMask – interrupt masks
-
uint32_t ACMP_getInterruptStatus(ACMP_Type *ACMPx)
Get IT mask for ACMP.
- 参数:
ACMPx – Pointer to the ACMP peripheral instance.
ACMP0
ACMP1
ACMP2
ACMP3
- 返回:
uint32_t interrupt masks
-
uint32_t ACMP_getInterruptStatusRaw(ACMP_Type *ACMPx)
Get IT RAW mask for ACMP.
- 参数:
ACMPx – Pointer to the ACMP peripheral instance.
ACMP0
ACMP1
ACMP2
ACMP3
- 返回:
uint32_t interrupt masks
-
void ACMP_setDACOSADJ(ACMP_Type *ACMPx, uint8_t channel, int16_t value)
Set the specified DAC offset adjust value.
- 参数:
ACMPx – Pointer to the ACMP peripheral instance.
ACMP0
ACMP1
ACMP2
ACMP3
channel – The channel to configure
ACMP_CHANNEL_H
ACMP_CHANNEL_L
value – ACMP DAC offset adjust value
-
int16_t ACMP_getDACOSADJ(ACMP_Type *ACMPx, uint8_t channel)
Get the specified DAC os adjust value.
- 参数:
ACMPx – Pointer to the ACMP peripheral instance.
ACMP0
ACMP1
ACMP2
ACMP3
channel – The channel to configure
ACMP_CHANNEL_H
ACMP_CHANNEL_L
- 返回:
int16_t ACMP DAC offset adjust value
-
void ACMP_setDACGainADJ(ACMP_Type *ACMPx, uint8_t channel, int16_t value)
Set the specified DAC gain adjust value.
- 参数:
ACMPx – Pointer to the ACMP peripheral instance.
ACMP0
ACMP1
ACMP2
ACMP3
channel – The channel to configure
ACMP_CHANNEL_H
ACMP_CHANNEL_L
value – ACMP DAC gain adjust value
-
int16_t ACMP_getDACGainADJ(ACMP_Type *ACMPx, uint8_t channel)
Get the specified DAC gain adjust value.
- 参数:
ACMPx – Pointer to the ACMP peripheral instance.
ACMP0
ACMP1
ACMP2
ACMP3
channel – The channel to configure
ACMP_CHANNEL_H
ACMP_CHANNEL_L
- 返回:
int16_t ACMP DAC gain adjust value
-
void ACMP_enableDMA(ACMP_Type *ACMPx, uint8_t channel)
Enable the specified DAC DMA handshake.
- 参数:
ACMPx – Pointer to the ACMP peripheral instance.
ACMP0
ACMP1
ACMP2
ACMP3
channel – The channel to configure
ACMP_CHANNEL_H
ACMP_CHANNEL_L
-
void ACMP_disableDMA(ACMP_Type *ACMPx, uint8_t channel)
Disable the specified DAC DMA handshake.
备注
Calling this function only when DMA channel is in idle state. this function cause all comparing channel reset in whole ACMP module
- 参数:
ACMPx – Pointer to the ACMP peripheral instance.
ACMP0
ACMP1
ACMP2
ACMP3
channel – The channel to configure
ACMP_CHANNEL_H
ACMP_CHANNEL_L
Structures
-
struct ACMP_Comparator
-
struct ACMP_TripOut
-
struct ACMP_DAC_Config
-
struct ACMP_Filter_ConfigType
Macros
-
ACMP_CHANNEL_H
-
ACMP_CHANNEL_L
-
BLK_WIDTH_MAX
-
BLK_WIDTH_MIN
-
BLK_WIDTH_NONE
-
ACMP_ERROR_STATUS_NONE
-
CHANNEL_H_CMP_BLK_REPT
-
CHANNEL_L_CMP_BLK_REPT
-
CHANNEL_H_DAC_TXDN_REPT
-
CHANNEL_L_DAC_TXDN_REPT
-
CHANNEL_H_DAC_TRG_REPT
-
CHANNEL_L_DAC_TRG_REPT
-
CHANNEL_H_DAC_DMAREQ_REPT
-
CHANNEL_L_DAC_DMAREQ_REPT
-
FILTER_WIDTH_MAX
-
FILTER_WIDTH_MIN
-
FILTER_WIDTH_NONE
-
ACMP_IT_NONE_MASK
-
CHANNEL_H_DAC_TXDN_IT_MASK
-
CHANNEL_L_DAC_TXDN_IT_MASK
-
CHANNEL_H_AFTER_FILTER_IT_MASK
-
CHANNEL_L_AFTER_FILTER_IT_MASK
-
CHANNEL_H_BEFORE_FILTER_IT_MASK
-
CHANNEL_L_BEFORE_FILTER_IT_MASK
-
ACMP_IT_ALL_MASK
-
TRIGGER_DLY_MAX
-
TRIGGER_DLY_MIN
-
TRIGGER_DLY_NONE
Enumerations
-
enum ACMP_InputSrcSelect
Values:
-
enumerator ACMP_INPUT_MUX_SELECT_0
ACMP input src select 0
-
enumerator ACMP_INPUT_MUX_SELECT_1
ACMP input src select 1
-
enumerator ACMP_INPUT_MUX_SELECT_2
ACMP input src select 2
-
enumerator ACMP_INPUT_MUX_SELECT_3
ACMP input src select 3
-
enumerator ACMP_INPUT_MUX_SELECT_4
ACMP input src select 4
-
enumerator ACMP_INPUT_MUX_SELECT_5
ACMP input src select 5
-
enumerator ACMP_INPUT_MUX_SELECT_0
-
enum ACMP_RefSrcSelect
Values:
-
enumerator ACMP_REF_MUX_DAC
ACMP reference internal DAC
-
enumerator ACMP_REF_MUX_SELECT_0
ACMP reference select 0
-
enumerator ACMP_REF_MUX_SELECT_1
ACMP reference select 1
-
enumerator ACMP_REF_MUX_SELECT_2
ACMP reference select 2
-
enumerator ACMP_REF_MUX_DAC
-
enum ACMP_HysteresisValue
Values:
-
enumerator HYSTERESIS_VALUE_0MV
-
enumerator HYSTERESIS_VALUE_7MV
-
enumerator HYSTERESIS_VALUE_14MV
-
enumerator HYSTERESIS_VALUE_23MV
-
enumerator HYSTERESIS_VALUE_36MV
-
enumerator HYSTERESIS_VALUE_43MV
-
enumerator HYSTERESIS_VALUE_52MV
-
enumerator HYSTERESIS_VALUE_62MV
-
enumerator HYSTERESIS_VALUE_0MV
-
enum ACMP_TriggerSel
Select dac trigger.
备注
when dac trigger is selected as follow:
DAC_TRIGGER_SEL_STIM DAC_TRIGGER_SEL_ETIM DAC_TRIGGER_SEL_SRPWM DAC_TRIGGER_SEL_SELF_TX_DONE DAC_TRIGGER_SEL_ACOMP DAC load mode should be select [DAC_LODE_SHADOW]
Values:
-
enumerator ACMP_DAC_TRIGGER_SEL_SW
-
enumerator ACMP_DAC_TRIGGER_SEL_STIM
-
enumerator ACMP_DAC_TRIGGER_SEL_ETIM
-
enumerator ACMP_DAC_TRIGGER_SEL_SRPWM
-
enumerator ACMP_DAC_TRIGGER_SEL_SELF_TX_DONE
-
enumerator ACMP_DAC_TRIGGER_SEL_ACOMP
-
enumerator ACMP_DAC_TRIGGER_SEL_DMA
-
enumerator ACMP_DAC_TRIGGER_SEL_SW
-
enum ACMP_TripSrcSel
Values:
-
enumerator ACMP_TRIPSRC_ASYNC_COMP
asynchronous comparator output
-
enumerator ACMP_TRIPSRC_SYNC_COMP
synchronous comparator output
-
enumerator ACMP_TRIPSRC_FILTER
output of the digital filter
-
enumerator ACMP_TRIPSRC_LATCH
latched output of the digital filter
-
enumerator ACMP_TRIPSRC_ASYNC_COMP
-
enum ACMP_DAC_LoadMode
DAC Load Mode enumeration.
Values:
-
enumerator ACMP_DAC_LOADMODE_IMMEDIATE
DAC load mode immediate
-
enumerator ACMP_DAC_LOADMODE_SHADOW
DAC load mode shadow
-
enumerator ACMP_DAC_LOADMODE_IMMEDIATE
-
enum ACMP_DAC_OutputDataFormat
Values:
-
enumerator ACMP_DAC_OUTPUT_DIRECT
-
enumerator ACMP_DAC_OUTPUT_INVERTED
-
enumerator ACMP_DAC_OUTPUT_DIRECT