#include "DSP28x_Project.h"
#include "HK_all_include.h"
extern Uint16 RamfuncsLoadSize;
void InitLED(void);
//Uint16 Error;
//Uint16 Tmp = 0;
void main(void)
{
InitSysCtrl();
DINT;
InitPieCtrl();
IER = 0x0000;
IFR = 0x0000;
InitPieVectTable();
memcpy(&RamfuncsRunStart, &RamfuncsLoadStart, (Uint32)&RamfuncsLoadSize);
//InitLED(); //LED初始化
//SCI_Init();
//open_uart_debug();
// printf("\r\n\r\nDSP is ready!\r\n");
//softResetIIC_BUS(); //软件复位IIC从设备
//InitI2C_Gpio(); //io 初始化为IIC
//I2CA_Init(); //HW IIC初始化,100KHz
//Timer0_init();
//ADC_Config();
//LigntVal = 0x71;//BIT6到BIT4为亮度调节,BIT0是 1 开启/0关闭
//TM1650_Send(CMD_SEG,LigntVal); //8级亮度,开启显示
//TM1650_Send(DIG1,SEG7Table[0]); //GID1
//TM1650_Send(DIG2,SEG7Table[0]); //GID2
//TM1650_Send(DIG3,SEG7Table[0]); //GID3
//TM1650_Send(DIG4,SEG7Table[0]); //GID4
// Running.showNum = PWM7BLED.PWMstep;
//Running.showNum = AdcResult.ADCRESULT2;
// Running.showhex[0]=SEGHexBLK;
// Running.showhex[1]=SEGHexBLK;
// Running.showhex[2]=SEGHexBLK;
// Running.showhex[3]=SEGHexBLK;
//InitEPwm7(); //初始化PWM7外设功能以及GPIO41作为PWM7B引脚输出
//PWM7BLED.dutyDir = LEDUP;
EALLOW;
SysCtrlRegs.PCLKCR0.bit.TBCLKSYNC = 0;
EDIS;
InitEPWM_AQ_DB();
EALLOW;
SysCtrlRegs.PCLKCR0.bit.TBCLKSYNC = 1;
EDIS;
PieCtrlRegs.PIECTRL.bit.ENPIE = 1; // Enable the PIE block
EINT; // Enable Global interrupt INTM
ERTM;
while(1)
{
asm ( " NOP" );
/*if(timer0Base.Mark_Para.Status_Bits.OnemsdFlag == 1)
{
timer0Base.Mark_Para.Status_Bits.OnemsdFlag = 0;
if(timer0Base.msCounter >= 1000) //ms
{
timer0Base.msCounter = 0;
if(k >= 400)
{
k = 0;
}
EPwm1Regs.CMPA.half.CMPA = TonC[k];
EPwm1Regs.CMPB = TonC[k];
k++;
// AdcRegs.ADCSOCFRC1.all = 0X000F; //软件触发AD 的 SOC0--SOC3采样
//ChangePWMDutyCycle();//改变占空比,进而改变PWM输出,控制D400
// EPwm1Regs.CMPA.half.CMPA = 500;
// EPwm2Regs.CMPA.half.CMPA = 500;
// EPwm3Regs.CMPA.half.CMPA = 500;
}
}
//SegScanTask(&Running); //数码管、三色LED、按键操作函数------关键函数
//handleScanKeyforPWM_LED(&Running);//PWM例程的扫描按键处理函数
}*/
}
}
/*void InitLED()
{
EALLOW;
D400MUX = 0; //GPIO功能
D400DIR = 1; //输出
D401MUX = 0;
D401DIR = 1;
D402MUX = 0;
D402DIR = 1;
RGB_R_MUX = 0;
RGB_R_DIR = 1;
RGB_G_MUX = 0;
RGB_G_DIR = 1;
RGB_B_MUX = 0;
RGB_B_DIR = 1;
EDIS;
}*/