Exemplo n.º 1
0
void main(void)
{ 

	InitSysCtrl();
	InitXintf();
	InitXintf16Gpio();
	ADInit();
	DINT;
	InitPieCtrl();
	IER = 0x0000;
	IFR = 0x0000;
	InitPieVectTable();
   EALLOW;  // This is needed to write to EALLOW protected registers
   PieVectTable.TINT0 = &ISRTimer0;
   EDIS;    // This is needed to disable write to EALLOW protected registers
   InitCpuTimers();   // For this example, only initialize the Cpu Timers
   ConfigCpuTimer(&CpuTimer0, 100, 987); //在定时器内进行采样,采样率1.5KHz
	
    IER |= M_INT1;
    PieCtrlRegs.PIECTRL.bit.ENPIE = 1;
    PieCtrlRegs.PIEIER1.bit.INTx7 = 1; 
	EINT; 
	ERTM;  
/*EALLOW;
GpioCtrlRegs.GPAMUX1.bit.GPIO0 = 0; // GPIO0 = GPIO0
GpioCtrlRegs.GPADIR.bit.GPIO0 = 1; 
EDIS;
GpioDataRegs.GPADAT.bit.GPIO0 = 0;*/
	SET_ADRST;  
	DELAY_US(100000);
	CLEAR_ADRST; 
	StartCpuTimer0();
	while(1);

}
Exemplo n.º 2
0
void main(void)
//-----------------------------------------------------------------------------------------------------
//  Purpose:	The MCU will come here after reset. 
//  
//
//  Rev:    1.5a     TEMPLATE RELEASE
//  
//  Notes:          None    
//-----------------------------------------------------------------------------------------------------
{
	
	//Initialization function calls 
	init_ports();
	motors_init();
	system_clock_init();
	InitDisplay("FHBTEST    "); //Start-up splash changed to unity ID
	InitUART();
	ADInit();	
	ENABLE_SWITCHES;	
	/* LED initialization - macro defined in qsk_bsp.h */
 	ENABLE_LEDS	


	//Polling for switch presses 
	while(TRUE) 
	{
		if(S1 == PRESSED)
		{
			BNSPrintf(LCD,"\tTEST          \n        ");
			project2ADemo(); 		
		}
		else if (S2 == PRESSED)
		{
			BNSPrintf(LCD,"\tOff            \n        ");
		}
		else if (S3 == PRESSED)
		{
			BNSPrintf(LCD,"\tFigure 8              \n        ");
			DoFigureEight();
		}
		else
		{
       		BNSPrintf(LCD,"\tTeam 2                 \n        ");
        }
		
	}
}