#define PWM_CH 9 // # of PWM chanels
#define STATUS_SUCCESS 1
#define STATUS_FAIL 0
#define AUTOCONVERT 0 // 1 = Turn auto-conversion ON, 0 = Turn auto-conversion OFF
// Declare your function prototypes here
//---------------------------------------------------------------
void HRPWM_Config(int);
void error(void);
// General System variables - useful for debug
Uint16 UpdateFine, DutyFine, status, CMPA_reg_val, CMPAHR_reg_val, CMPB_reg_val, CMPBHR_reg_val;
int MEP_ScaleFactor; // Global variable used by teh SFO library
volatile struct EPWM_REGS *ePWM[PWM_CH] =
{ &EPwm1Regs, &EPwm1Regs, &EPwm2Regs, &EPwm3Regs, &EPwm4Regs, &EPwm5Regs, &EPwm6Regs, &EPwm7Regs, &EPwm8Regs};
void main(void)
{ // Local variables
int i;
Uint32 temp, temp1;
EALLOW;
InitSysCtrl();
EDIS;
InitEPwmGpio(); // EPWM1A EPWM1B thru EPWM9
DINT; // Disable CPU interrupts *** PIE PIE PIE PIE PIE PIE PIE PIE
InitPieCtrl();
// Disable CPU interrupts and clear all CPU interrupt flags:
EALLOW;
IER = 0x0000;
IFR = 0x0000;
InitPieVectTable();
UpdateFine = 1;
DutyFine = 0;
status = SFO_INCOMPLETE;
// Enable global Interrupts and higher priority real-time debug events:
EINT; // Enable Global interrupt INTM
ERTM; // Enable Global realtime interrupt DBGM
while (status== SFO_INCOMPLETE){ // Call until complete
status = SFO();
if (status == SFO_ERROR) {
error(); // SFO function returns 2 if an error occurs & # of MEP steps/coarse step
} // exceeds maximum of 255.
}
void error (void) {
ESTOP0; // Stop here and handle error
}
编译通过,但是调试会出现
Can't find a source file at "E:/git_device_support2/device_support/f2837x/F2837x_internal_testcases/EPwm/SFO_v7_fpu_lib_build/c28/SFO_v7_fpu_lib_build_c28.c"
Locate the file or edit the source lookup path to include its location.
咨询后说可以直接跳过。
但是我单步调试的时候会出现,还无法反馈SFO的值
卡在 while (status== SFO_INCOMPLETE){ // Call until complete
status = SFO();
if (status == SFO_ERROR) {
error(); // SFO function returns 2 if an error occurs & # of MEP steps/coarse step
} // exceeds maximum of 255.
}
也就是SFO();没有变化。