主题中讨论的其他器件:C2000WARE
你(们)好
我将从输入 XBAR (TZ1或 TZ2)跳闸 EPWM 模块、并希望连接输出 XBAR GPIO 引脚、从而在不进行任何 CPU 交互的情况下提供跳闸状态(或两个输入的逻辑)。
为此、我决定使用 GPIO24、但我一直坚持配置所需的条件、以便直接从输入中输出跳闸状态。 我在 C:\ti\c2000\C2000Ware_4_00_00_00\driverlib\f28002x\examples\cmpss 中找到了示例、在这里、比较器子模块配置了斜坡发生器和所有内容。 这对于输入还是输入而言确实是必要的?
这是我目前为止的代码、但它还不起作用:
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Select the value for CMPHNMXSEL.
ASysCtl_selectCMPHNMux(ASYSCTL_CMPHNMUX_SELECT_1);
// Select the value for CMPLNMXSEL.
ASysCtl_selectCMPLNMux(ASYSCTL_CMPLNMUX_SELECT_1);
// Select the value for CMPHPM[object Object]SEL.
ASysCtl_selectCMPHPMux(ASYSCTL_CMPHPMUX_SELECT_1,0U);
// Select the value for CMPLPM[object Object]SEL.
ASysCtl_selectCMPLPMux(ASYSCTL_CMPLPMUX_SELECT_1,0U);
//myCMPSS0 initialization
// Sets the configuration for the high comparator.
CMPSS_configHighComparator(CMPSS1_BASE,(CMPSS_INSRC_DAC));
// Sets the configuration for the high comparator.
CMPSS_configLowComparator(CMPSS1_BASE,(CMPSS_INSRC_DAC));
// Sets the configuration for the internal comparator DACs.
CMPSS_configDAC(CMPSS1_BASE,(CMPSS_DACVAL_SYSCLK | CMPSS_DACREF_VDDA | CMPSS_DACSRC_SHDW));
// Sets the value of the internal DAC of the high comparator.
CMPSS_setDACValueHigh(CMPSS1_BASE,2048U);
// Sets the value of the internal DAC of the low comparator.
CMPSS_setDACValueLow(CMPSS1_BASE,0U);
// Configures the digital filter of the high comparator.
CMPSS_configFilterHigh(CMPSS1_BASE, 0U, 1U, 1U);
// Configures the digital filter of the low comparator.
CMPSS_configFilterLow(CMPSS1_BASE, 0U, 1U, 1U);
// Sets the output signal configuration for the high comparator.
CMPSS_configOutputsHigh(CMPSS1_BASE,(CMPSS_TRIPOUT_ASYNC_COMP | CMPSS_TRIP_ASYNC_COMP));
// Sets the output signal configuration for the low comparator.
CMPSS_configOutputsLow(CMPSS1_BASE,(CMPSS_TRIPOUT_ASYNC_COMP | CMPSS_TRIP_ASYNC_COMP));
// Sets the comparator hysteresis settings.
CMPSS_setHysteresis(CMPSS1_BASE,0U);
// Configures the comparator subsystem's ramp generator.
CMPSS_configRamp(CMPSS1_BASE,0U,0U,0U,1U,true);
// Disables reset of HIGH comparator digital filter output latch on PWMSYNC
CMPSS_disableLatchResetOnPWMSYNCHigh(CMPSS1_BASE);
// Disables reset of LOW comparator digital filter output latch on PWMSYNC
CMPSS_disableLatchResetOnPWMSYNCLow(CMPSS1_BASE);
// Sets the ePWM module blanking signal that holds trip in reset.
CMPSS_configBlanking(CMPSS1_BASE,1U);
// Disables an ePWM blanking signal from holding trip in reset.
CMPSS_disableBlanking(CMPSS1_BASE);
// Configures whether or not the digital filter latches are reset by PWMSYNC
CMPSS_configLatchOnPWMSYNC(CMPSS1_BASE,false,false);
// Enables the CMPSS module.
CMPSS_enableModule(CMPSS1_BASE);
// Delay for CMPSS DAC to power up.
DEVICE_DELAY_US(500);
uint16_t gp = 24;
GPIO_setPinConfig(GPIO_24_OUTPUTXBAR1);
GPIO_setDirectionMode(gp, GPIO_DIR_MODE_OUT);
GPIO_setPadConfig(gp, GPIO_PIN_TYPE_STD);
GPIO_setQualificationMode(gp, GPIO_QUAL_ASYNC);
XBAR_setOutputLatchMode(OUTPUTXBAR_BASE, XBAR_OUTPUT1, false);
XBAR_invertOutputSignal(OUTPUTXBAR_BASE, XBAR_OUTPUT1, false);
XBAR_setOutputMuxConfig(OUTPUTXBAR_BASE, XBAR_OUTPUT1, XBAR_OUT_MUX01_INPUTXBAR1);
XBAR_enableOutputMux(OUTPUTXBAR_BASE, XBAR_OUTPUT1, XBAR_MUX00);
XBAR_setEPWMMuxConfig(XBAR_TRIP4, XBAR_EPWM_MUX00_CMPSS1_CTRIPH);
XBAR_enableEPWMMux(XBAR_TRIP4, XBAR_MUX00);
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////

