TI中文支持网
TI专业的中文技术问题搜集分享网站

DSP2812例程BLDC3-1的一个疑惑

例程倒数第二个语句:

// Note: To be safe, use a mask value to write to the entire
 // EVAIFRB register.  Writing to one bit will cause a read-modify-write
 // operation that may have the result of writing 1's to clear // bits other then those intended.    EvaRegs.EVAIFRB.all = BIT0;

说是为了保证系统安全工作,屏蔽定时器T2,‘

我的问题是为什么要屏蔽呢,屏蔽了不是不能中断了吗

Susan Yang:请您在提问时给出具体的例程,BLDC3-1的例程还是很多的。只给出一段代码,我也记不住是具体哪个例程

例程倒数第二个语句:

// Note: To be safe, use a mask value to write to the entire
 // EVAIFRB register.  Writing to one bit will cause a read-modify-write
 // operation that may have the result of writing 1's to clear // bits other then those intended.    EvaRegs.EVAIFRB.all = BIT0;

说是为了保证系统安全工作,屏蔽定时器T2,‘

我的问题是为什么要屏蔽呢,屏蔽了不是不能中断了吗

user6007383:

回复 Susan Yang:

// ***************** LEVEL3 *****************#if (BUILDLEVEL==LEVEL3)
// ——————————————————————————//    Call the ADC04U_DRV read function.// ——————————————————————————   adc1.read(&adc1);
// ——————————————————————————//    Connect inputs of the RMP module and call the Ramp control//    calculation function.// ——————————————————————————      rc1.TargetValue = _IQ(SpeedRef);      rc1.calc(&rc1);
// ——————————————————————————//    Connect inputs of the HALL module and call the Hall sensor//    read function.// ——————————————————————————      hall1.HallMapPointer = (int16)mod1.Counter;       hall1.read(&hall1);
// ——————————————————————————//    Connect inputs of the MOD6 module and call the Modulo 6 counter//    calculation function.// ——————————————————————————      mod1.TrigInput =(int32)hall1.CmtnTrigHall;      mod1.Counter = (int32)hall1.HallMapPointer;       mod1.calc(&mod1);
// ——————————————————————————//    Connect inputs of the RMP2 module and call the Ramp control 2//    calculation function.// ——————————————————————————      rmp2.DesiredInput = (int32)DFuncDesired;      rmp2.calc(&rmp2);
// ——————————————————————————//    Connect inputs of the PID_REG3 module and call the PID speed controller//    calculation function.// ——————————————————————————        pid1_spd.Ref = rc1.SetpointValue;      pid1_spd.Fdb = speed1.Speed;      pid1_spd.calc(&pid1_spd);
// ——————————————————————————//    Set the speed closed loop flag once the speed is built up to a desired value. // ——————————————————————————      if (rc1.EqualFlag == 0x7FFFFFFF)  {         SpeedLoopFlag = TRUE;          rc1.RampDelayMax = 300;        }
// ——————————————————————————//    Connect inputs of the PWM_DRV module and call the PWM signal generation//    update function.// ——————————————————————————   // Switch from fixed duty-cycle or controlled Speed duty-cycle by SpeedLoopFlag variable      if (SpeedLoopFlag == FALSE)         pwm1.DutyFunc = (int16)rmp2.Out;           // fixed duty-cycle      else          pwm1.DutyFunc = (int16)_IQtoIQ15(pid1_spd.Out);   // controlled Speed duty-cycle
      pwm1.CmtnPointer = (int16)mod1.Counter;      pwm1.update(&pwm1);
// ——————————————————————————//    Connect inputs of the SPEED_PR module and call the speed calculation //    function.// ——————————————————————————        if ((mod1.Counter == 5)&(hall1.CmtnTrigHall == 0x7FFF)) {         speed1.TimeStamp = VirtualTimer;         speed1.calc(speed1);      }
// ——————————————————————————//    Connect inputs of the DATALOG module // ——————————————————————————      DlogCh1 = (int16)mod1.Counter;       DlogCh2 = (int16)mod1.TrigInput;      DlogCh3 = (int16)_IQtoIQ15(pid1_spd.Ref);      DlogCh4 = (int16)_IQtoIQ15(pid1_spd.Fdb);
// ——————————————————————————//    Connect inputs of the EN_DRV module and call the enable/disable PWM signal//    update function (for DMC1500 only).// ——————————————————————————          drv1.EnableFlag = EnableFlag;      drv1.update(&drv1);
#endif // (BUILDLEVEL==LEVEL3)
// ——————————————————————————//    Increase virtual timer and force 15 bit wrap around// —————————————————————————— VirtualTimer++; VirtualTimer &= 0x00007FFF;
// ——————————————————————————//    Call the DATALOG update function.// ——————————————————————————    dlog.update(&dlog);
#if (DSP_TARGET==F2808)// Acknowledge interrupt to recieve more interrupts from PIE group 1 PieCtrlRegs.PIEACK.all = PIEACK_GROUP1;#endif
#if (DSP_TARGET==F2812)// Enable more interrupts from this timer EvaRegs.EVAIMRB.bit.T2PINT = 1; // Note: To be safe, use a mask value to write to the entire // EVAIFRB register.  Writing to one bit will cause a read-modify-write // operation that may have the result of writing 1's to clear  // bits other then those intended.     EvaRegs.EVAIFRB.all = BIT0;*************************************就是这句******************************** // Acknowledge interrupt to recieve more interrupts from PIE group 3 PieCtrlRegs.PIEACK.all |= PIEACK_GROUP3;#endif}
您好,感谢您的回答,我有疑问的那句就在这段的倒数第6行

例程倒数第二个语句:

// Note: To be safe, use a mask value to write to the entire
 // EVAIFRB register.  Writing to one bit will cause a read-modify-write
 // operation that may have the result of writing 1's to clear // bits other then those intended.    EvaRegs.EVAIFRB.all = BIT0;

说是为了保证系统安全工作,屏蔽定时器T2,‘

我的问题是为什么要屏蔽呢,屏蔽了不是不能中断了吗

Susan Yang:

回复 user6007383:

您可以看一下TRM内的说明

Since EVxIFRx are readable registers, occurrence of an interrupt event can be monitored by software polling the appropriate bit in EVxIFRx when the interrupt is masked.

赞(0)
未经允许不得转载:TI中文支持网 » DSP2812例程BLDC3-1的一个疑惑
分享到: 更多 (0)