This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MSPM0G1505: mspm0g3507

Part Number: MSPM0G1505

外部输入引脚使用的是PA0 输入为5V的4.852K方波 站控比49.87 但是捕获的是 高电平是8473 周期是16630 时钟是80Mhz,占空比是50.95,频率是4.8105khz

#define gLoadValue 65535

 NVIC_EnableIRQ(CAPTURE_0_INST_INT_IRQN);

void CAPTURE_0_INST_IRQHandler(void)
{
volatile float b=0;
switch (DL_TimerG_getPendingInterrupt(CAPTURE_0_INST))
{
case DL_TIMERG_IIDX_CC1_DN:
{
DL_TimerG_setTimerCount(CAPTURE_0_INST, gLoadValue);
pwmPeriod = gLoadValue - DL_TimerG_getCaptureCompareValue(CAPTURE_0_INST, DL_TIMER_CC_1_INDEX);
pwmDuty = ((gLoadValue - DL_TimerG_getCaptureCompareValue(CAPTURE_0_INST, DL_TIMER_CC_0_INDEX)));

b =_IQ15toF(_IQ15div(pwmDuty<<12,pwmPeriod));