/********************************************************************
* File: DefaultIsr_nonBIOS.c										*
* Devices: TMS320F2806x												*
* Author: NRD														*
* Modify : 21 June 2014												*
*********************************************************************/

#define xdc__strict

//#include "F2806x_Device.h"     // F2806x Headerfile Include File
//#include <ti/sysbios/BIOS.h>
//#include <ti/sysbios/knl/Task.h>
//#include <ti/sysbios/family/c28/Hwi.h>
//#include <math.h>
//#include "F2806x_EPwm_defines.h"             // Macros used for PWM examples.
//#include "C28x_FPU_fastRTS.h"
//#include <xdc/std.h>
#include "DSP28x_Project.h"
//#include <xdc/runtime/System.h>
//#include <ti/sysbios/knl/Clock.h>
//#include <xdc/cfg/global.h>
//#include <xdc/runtime/Log.h>
#include <xdc/std.h>
#include <xdc/runtime/System.h>
#include <ti/sysbios/BIOS.h>
//#include "F2806x_Device.h"     // F2806x Headerfile Include File
#include <ti/sysbios/knl/Task.h>
//#include <ti/sysbios/family/c28/Hwi.h>
#include <ti/sysbios/family/c28/Hwi.h>
#include <math.h>
//#include "F2806x_SWPrioritizedIsrLevels.h"
#include "F2806x_EPwm_defines.h"             // Macros used for PWM examples.
//#include "F2806x_examples.h"
#include "C28x_FPU_fastRTS.h"
#include <xdc/runtime/Log.h>
#include <ti/uia/events/UIAEvt.h>

int i = 0;
#define OPT1 GpioDataRegs.GPBDAT.bit.GPIO58





//---------------------------------------------------------------------
void EPWM3_TIM_ISR(void)						// PIE3.3 @ 0x000D64  EPWM3_INT
{
	
   	// Set interrupt priority:
//	volatile Uint16 TempPIEIER = PieCtrlRegs.PIEIER3.all;
//	IER |= M_INT3;
//	IER	&= MINT3;	  	                // Set "global" priority
//	PieCtrlRegs.PIEIER3.all &= MG33;   // Set "group"  priority
//	EINT;
	i++;
	if(i>=400)i=0;
	OPT1 = ~OPT1;
   	EPwm3Regs.ETCLR.bit.INT = 1;			   // Clear INT flag for this timer
	//PieCtrlRegs.PIEACK.all = PIEACK_GROUP3;		// Must acknowledge the PIE group
	
	// Restore registers saved:
	//DINT;
//	PieCtrlRegs.PIEIER3.all = TempPIEIER;
	
}

/************************************************************************************************
* This interrupt routine is used to measure frequency											*	
*************************************************************************************************/

