Other Parts Discussed in Thread: CONTROLSUITE
Thread 中讨论的其他器件:controlSUITE
我的代码用于 main(),如下所示:
#include "F28x_Project.h" // Device Header File and Examples Include File
#include "sgen.h"
#define SIGNAL_LENGTH 512
/* Create an instance of Signal generator module */
SGENT_1 sgen = SGENT_1_DEFAULTS;
#pragma DATA_SECTION(v, "SGENipcb");
int v[SIGNAL_LENGTH];
int xn,yn,i;
// external function prototypes
extern void InitSysCtrl(void);
extern void InitPieCtrl(void);
extern void InitPieVectTable(void);
// Prototype statements for functions found within this file.
void Gpio_select(void);
void Setup_ePWM1(void);
void Setup_ePWM2(void);
interrupt void ePWM_compare_isr(void);
void main(void)
{
InitSysCtrl(); // Basic Core Init from SysCtrl.c
EALLOW;
//SysCtrlRegs.WDCR= 0x00AF; // Re-enable the watchdog
EDIS; // 0x00AF to NOT disable the Watchdog, Prescaler = 64
DINT; // Disable all interrupts
Gpio_select(); // setting for ePWM Outputs
Setup_ePWM1(); // init of ePWM1A and ePWM1B
Setup_ePWM2(); // init of ePWM2A and ePWM2B
InitPieCtrl(); // basic setup of PIE table; from PieCtrl.c
InitPieVectTable(); // default ISR's in PIE ; from PieVect.c
EALLOW;
PieVectTable.32 = &ePWM_compare_isr;
EDIS;
//ENABLING ADC INERRUPT
PieCtrlRegs.PIEIER1.bit.INTx6 = 1;
IER |=1; // enable INT1 FOR ADC
EINT;
ERTM;
// Sync ePWM
EALLOW;
CpuSysRegs.PCLKCR0.bit.TBCLKSYNC = 1;
EDIS;
// Start ePWM
EPwm2Regs.TBCTL.bit.CTRMODE = 0; // Un-freeze and enter up-count mode
//while(1)
//{
//}
}
在构建时、此行中出现唯一错误#66预期为";":
第48行:PieVectTable.32 =&ePWM_COMPARE_ISR;
中断 void ePWM_COMPARE_ISR (void)中的内容如下:
sgen.offset=1;
sgen.gain=0x7fff; // gain=1
sgen.freq=5369; // freq = 50Hz
sgen.step_max=1000; /* Max Freq= (step_max * sampling freq)/65536 */
sgen.alpha=8192; /* phase_norm =(pi/4/(2*pi))*2^16=8192 */
for(i=0;i<SIGNAL_LENGTH;i++)
{
v[i]=0;
}
for(i=0;i<SIGNAL_LENGTH;i++)
{
sgen.calc(&sgen);
xn=sgen.out;
v[i]=xn;
EPwm1Regs.CMPA.bit.CMPA = v[i] ;
EPwm2Regs.CMPA.bit.CMPA = v[i] ;
}
// Return from interrupt
AdcaRegs.ADCINTFLGCLR.bit.ADCINT1 = 1; // Clear ADC INT1 flag
// Acknowledge this interrupt to receive more interrupts from group 3
PieCtrlRegs.PIEACK.all = PIEACK_GROUP1; // Acknowledge interrupt to PIE
}此函数在 main 之外执行。 我已经在这个论坛上搜索了这个解决方案、但我找不到我的问题的解决方案
此程序的控制台窗口如下所示:
________________________________________________________________
****项目 Lab3_cpu01的配置调试构建****
"C:\\ti\\ccsv7\\utils\\bin\\gmake"-k all
'生成文件:"../new_open_loop_WD_OFF_ADC_INTERRUPT.c"
'调用:C2000编译器'
"c:/ti/ccsv7/tools/compiler/ti-cgt-c2000_16.9.6.LTS/bin/cl2000 -v28 -ml -mt --vcu_support=vcu2 --tmu_support=tmu0 -cla_support=cla1 -float_support=fpu32 -opt_for_speed=2 -include_path="C:/ti/ccsv7/tools/compiler/ti-cgt-c2000_16.9.6.LTS/include -include_path="C:/ti/controlSUITE/libs/dsp/SGEN/v101/include -f37xD_new_board_suppremote_display_suppremote_display_display_new_over-f37xd_board.cpu_display_new_board.cpu_suppremote_display_suppremote_display_super -new_suppremote_display_over-f37xd_new_board.cp_board.cpue_display_new_suppage=v/new_board.cpue_display_over-d_suppremote_display_over-f37x_board_board.cpu_board_suppremote_display_suppage=v_suppage=v_board.cp_suppage=v28x_suppremote_display_suppremote_board
>>编译失败
subdir_rules.mk:72:目标'new_open_loop_WD_OFF_ADC_interrupt.obj'的配方失败
"./new_open_loop_WD_OFF_ADC_INTERRUPT.c"、第48行:错误#66:预期为";"
1在"../new_open_loop_WD_OFF_ADC_INTERRUPT.c"的编译中检测到错误。
gmake:***[new_open_loop_WD_OFF_ADC_INTERRUPT.obj]错误1
gmake:目标"全部"不会由于错误而重新生成。
****构建完成****
_________________________________________________________
提前感谢、