Example #1
0
void main()
{
	initVariables();
	
	DINT;
	ms_delay(1);
	InitAdc();
	SetupAdc();
	InitSysCtrl();
	InitPieCtrl();
	IER = 0x0000;
	IFR = 0x0000;
	MemCopy(&RamfuncsLoadStart, &RamfuncsLoadEnd, &RamfuncsRunStart);
	InitPieVectTable();
	easyDSP_SCI_Init();
	InitEPwm3();
	InitEPwm4();
	pwm_setup();
	initialize_mppt_timer();
	EALLOW;
	PieVectTable.TINT2 = &mppt_int;
	PieVectTable.EPWM3_INT = &pwm_int;
	PieCtrlRegs.PIEIER3.bit.INTx3 = 0x1;
	EDIS;
	IER |= M_INT3;
	IER |= M_INT14;
	EINT;
	ms_delay(1);
	InitEPwm3Gpio();
	//InitEPwm4Gpio();
//	EALLOW;
//	GpioCtrlRegs.GPADIR.bit.GPIO4 = 1;
//	GpioCtrlRegs.GPADIR.bit.GPIO5 = 1;
//	GpioCtrlRegs.GPADIR.bit.GPIO6 = 1;
//	GpioCtrlRegs.GPADIR.bit.GPIO7 = 1;
//
//	GpioDataRegs.GPASET.bit.GPIO4 = 1;
//	GpioDataRegs.GPASET.bit.GPIO5 = 1;
//	GpioDataRegs.GPACLEAR.bit.GPIO6 = 1;
//	GpioDataRegs.GPACLEAR.bit.GPIO7 = 1;
//	EDIS;
	ERTM;
	for(;;)
	{
////		Bus_Voltage_Q15 = ((long int) AdcResult.ADCRESULT1*VBUS_SCALE);
		if(delay_flag)
		{
			ms_delay(10000);
			delay_flag = 0;
		}
	}
}
Example #2
0
void InitEPwm(void){ // Function provided to initializes used ePWMs
	EALLOW;
	SysCtrlRegs.PCLKCR0.bit.TBCLKSYNC = 0;      // Stop all the TB clocks
	EDIS;
	InitEPwm1();
	InitEPwm2();
	InitEPwm3();
	InitEPwm4();
	InitEPwm5();
	EALLOW;
	SysCtrlRegs.PCLKCR0.bit.TBCLKSYNC = 1;         // Start all the timers synced
	EDIS;
}