/********************************************************************************************************
---------------------自带头文件-----------------------------*/
#include "DSP2833x_Device.h" // DSP2833x Headerfile Include File
#include "DSP2833x_Examples.h" // DSP2833x Examples Include File
/*--------------------自定义头文件----------------------------*/
#include "user_header.h" //变量常量定义
#include "user_macro.h" //宏函数 //工作控制
#include "math.h"
#include "Ad7606.h"
#include "DA5344.h"
#pragma CODE_SECTION(epwm1_isr, "ramfuncs");
#define AD_ASTART ((Uint16 *)0x100000) //片外AD的数据读取首地址
#define AD_BSTART ((Uint16 *)0x110000) //片外AD的数据读取首地址
#define AD_BSTART ((Uint16 *)0x110000) //片外AD的数据读取首地址
//定义AD7656转换启动和复位操作
#define AD_BUSY GpioDataRegs.GPADAT.bit.GPIO14
#define SET_ADRST GpioDataRegs.GPBSET.bit.GPIO60=1
#define CLEAR_ADRST GpioDataRegs.GPBCLEAR.bit.GPIO60=1
#define SET_ADCLK GpioDataRegs.GPASET.bit.GPIO15=1
#define CLR_ADCLK GpioDataRegs.GPACLEAR.bit.GPIO15=1
#define SET_ADRST GpioDataRegs.GPBSET.bit.GPIO60=1
#define CLEAR_ADRST GpioDataRegs.GPBCLEAR.bit.GPIO60=1
#define SET_ADCLK GpioDataRegs.GPASET.bit.GPIO15=1
#define CLR_ADCLK GpioDataRegs.GPACLEAR.bit.GPIO15=1
//四路DA通道的地址
#define DA_ADD0 ((Uint16 *)0x1B0000) //输出地址0
#define DA_ADD1 ((Uint16 *)0x1B0001) //输出地址1
#define DA_ADD2 ((Uint16 *)0x1B0002) //输出地址2
#define DA_ADD3 ((Uint16 *)0x1B0003) //输出地址3
#define CPU_CLK 150e6
#define PWM_CLK 20e3 // If diff freq. desired, change freq here.载波频率
#define BUF_SIZE 16
#define SCALE 10.0 //量程为10V
#define DA_ADD0 ((Uint16 *)0x1B0000) //输出地址0
#define DA_ADD1 ((Uint16 *)0x1B0001) //输出地址1
#define DA_ADD2 ((Uint16 *)0x1B0002) //输出地址2
#define DA_ADD3 ((Uint16 *)0x1B0003) //输出地址3
#define CPU_CLK 150e6
#define PWM_CLK 20e3 // If diff freq. desired, change freq here.载波频率
#define BUF_SIZE 16
#define SCALE 10.0 //量程为10V
int g=0,h=0,i=0,k=0;
int16 addat[16];
float ad_realvalue[6];
float exadc[6];
float SVPWM_FULL=CPU_CLK/2/PWM_CLK;
float Time=0;
float Phase=0,Phase_Old; //相位 母线电压相位
float Phase_Flag=0;
float Ualpha;
float Ubeta;
float Ud=10;
float Uq=0,Uq_last;
float Rms=20;
float dq_P=1,dq_I=0.00001,dq_Inter,dq_Out;
float Uac; // 交流母线侧电压
float Udc, Udc_ref=48, Udc_error, Udc_Inter=0, Udc_out, Udc_P=1, Udc_I=0.001;
float Iac, Iac_ref, Iac_
int16 addat[16];
float ad_realvalue[6];
float exadc[6];
float SVPWM_FULL=CPU_CLK/2/PWM_CLK;
float Time=0;
float Phase=0,Phase_Old; //相位 母线电压相位
float Phase_Flag=0;
float Ualpha;
float Ubeta;
float Ud=10;
float Uq=0,Uq_last;
float Rms=20;
float dq_P=1,dq_I=0.00001,dq_Inter,dq_Out;
float Uac; // 交流母线侧电压
float Udc, Udc_ref=48, Udc_error, Udc_Inter=0, Udc_out, Udc_P=1, Udc_I=0.001;
float Iac, Iac_ref, Iac_