Ejemplo n.º 1
0
// Initialization function for device,
// Call Init_Device() from your main program
void Init_Device(void)
{Oscillator_Init();
    Timer_Init();
  //  UART_Init();
   
   // ADC_Init();
    Port_IO_Init();
	 SPI_Init();
    
   Timer2_Init();
    Interrupts_Init();
	 one = 0;
	 two = 0;
	 msek = 0;
	 TR2 = 1;           // Timer0 enabled
	// reset
	reset = 1;
	while (!one);
	// 100ucek 1
	reset = 0;
	while (!two);
	//  5 mcek 0
	_nop_();
	 TR2 = 0;

}
Ejemplo n.º 2
0
// Initialization function for device,
// Call Init_Device() from your main program
void Init_Device(void)
{
    Reset_Sources_Init();
    PCA_Init();
    Timer_Init();
    ADC_Init();
    Voltage_Reference_Init();
    Port_IO_Init();
    Oscillator_Init();
    Interrupts_Init();
}
Ejemplo n.º 3
0
// Initialization function for device,
// Call Init_Device() from your main program
void Init_Device(void)
{
    Reset_Sources_Init();
    Timer_Init();
    UART_Init();
    SPI_Init();
    ADC_Init(0);
    DAC_Init();
    EMI_Init();
    Voltage_Reference_Init();
    Port_IO_Init();
    Oscillator_Init();
    Interrupts_Init();
}
Ejemplo n.º 4
0
/*--------------------------------------------------------------------------------------------------------------------
        Function:         Main

        Description:      Main routine

        Revisions:

--------------------------------------------------------------------------------------------------------------------*/
void main(void)
{

	General_Init();
	Oscillator_Init();
	Timer_Init();
	Voltage_Reference_Init();
	DAC_Init();
	Interrupts_Init();




	initLCD();
	
	


	P2 = 0x0;
	
	while(1)
	{	
			//Allow user to change current gamestate. i.e. menu or playing
		Check_State_Change();																											//STILL NEEDED AS OF 5:41PM 4/5/15
			
			//Execute the current state chosen
			switch (gameState)
			{
				case 0: /* Volume Menu */
					//Clear any previous visuals
					printLCD("Volume Levels");
					blink();
					Change_Volume();
					Display_Volume();
					Change_Octave();
					break;
				case 1: /* Play Menu */
					PORT1_TO_PLAY_TONE();
					break;
			}
		}
		
		//This is a debug counter that should never, EVER execute. So, delete it when you have no issues at the end.
//		while(1)
//		{	
//			debugcounter +=1;
//		}

}
/*--------------------------------------------------------------------------------------------------------------------
        Function:         Main

        Description:      Main routine

        Revisions:

--------------------------------------------------------------------------------------------------------------------*/
void main(void)
{
  Oscillator_Init();
	General_Init();
	Timer_Init();
	//LCD_Init();	
	Interrupts_Init();	

	while(1)
	{	
		LD1 = ~LD1;
		delay_micro(100);
		servoWrite_microseconds(1200);
		// Do stuff

	}
}
Ejemplo n.º 6
0
int main(void)
{
	// Init all needed hardware
	IO_Init();
	VPRG_Off();
	DCPRG_Off();
	Layer_On(-1);
	TIM1_Config();
	TIM8_Config();
	HardwareSPI_init();
	Interrupts_Init();
	SysTick_Init();

	while (1)
	{
		;
	}
}
Ejemplo n.º 7
0
void Initialize_PIC() 
{
	int t;

	Interrupts_Init();

	STDERR = -1;				/// Set Standard Error an undefined serial port;

	memset(&Status,0,sizeof(Status));		// Clear all the values
	memset(&Abort,0,sizeof(Abort));


	TRISB=0x00;	// Set Direction of B
	TRISC=0x00; // Set Direction of C
	PORTC=0x00;	// Set all port C to low
	PORTB=0x00;	// Setall port B to low
	
	


	Delay1KTCYx(10);

}
Ejemplo n.º 8
0
void main(void)
{
	u32 cnt = 0;

	Init_Device();	  //use code generate by silicon tool.

	TI0 = 1; 			//make uart0 in send enable status
//-----------------------------------------
	event_init();
//-----------------------------------------add a timer event for printf
#if 0
{
   	timer_ev_unit_st xdata unit;
	timer_event_init();
	unit.event = EVENT_ID_TIMER_DEBUG;
	unit.time = TRIG_TIME;
	unit.callback = func_for_debug;
	timer_event_add(&unit);
}
#endif
//-----------------------------------------




	report_handler_init();

//	while(cnt++<65536);
//	config_sensor();

	test_func();

 	Usb_Init();
	
	Interrupts_Init();	   //open relative interrupt.

   	//g_panel_point.ID = 0;
 	//g_panel_point.x  = 0;
	//g_panel_point.y  = 0;

	while (1)
	{
		event_process();
		
		if(g_work_style == WORK_STYLE_PREVIEW)
		{
			get_frame_data();
			//while(EP_STATUS[1] != 0);
			send_debug_info_to_host(REPORT_ID_IN_DBGINFO);
		}
		else if(g_work_style == WORK_STYLE_CAL)
		{
		 
		}
		else if(g_work_style == WORK_STYLE_NOMAL)
		{ /*
		 	g_panel_point.x +=200;
			g_panel_point.y +=100;

			g_panel_point.x %= 1600;
			g_panel_point.y %= 900;

			fill_hid_packet(&g_panel_point,1); 
			send_debug_info_to_host(REPORT_ID_IN_MTOUCH);	
		   */
		}
		

	}

}
Ejemplo n.º 9
0
// Initialization function for device,
// Call Init_Device() from your main program
void Init_Device(void)
{
    ADC_Init();
    Oscillator_Init();
    Interrupts_Init();
}