Exemplo n.º 1
0
int main( void )
{
	//disable interrupts
	cli();	
	//INITS				
	hwInit();
//	uartInit();
	pwmInit();	
//	adcInit();
//	WdInit();
//	WdDisable();
	adcStartConversion();
	//enable interrupt
	Init_TWI();
	sei();
	//calibration des vitesses
//	adcCalibSeq();
	//attend que la sw Start soit appuyer 
	//pour lancer le reste du programme	
	SLWaitForTheStartSw();

//	WD_RESTART_WATCHDOG;
	
	
	while(1)
	{
		if(flag5ms)
		{
			count5ms++;
			if(count5ms>=10)
			{
				count5ms=0;
				Ping_sensor();
			}
		}
		SLCheckSwStatus(); //verifie la switch d'arret
		cPMainCmdParser(); //Machine à état communication
		CalculMoteur();	   //calculPWM et autre			
	}
}
Exemplo n.º 2
0
Arquivo: init.c Projeto: rngadam/mboot
int main(void)
{
	BTNDIS_P();
	Init_EMIF();
	Init_LEDS();
	Init_TIMER();
	Init_FPGA();
	Init_UART();
	Init_TWI(100000);
	
	mbootBanner();
	
	Init_RTC();
	Init_Media();
	Init_SHA204();
	Init_EMAC();
	SYS_UNRESET();
	
	mboot();

	while(1);
	// return 0;
}
Exemplo n.º 3
0
/*!
 * Der Mikrocontroller und der PC-Simulator brauchen ein paar Einstellungen, 
 * bevor wir loslegen koennen.
 */
void init(void){
	
	#ifdef MCU
		PORTA=0; DDRA=0;		//Alles Eingang alles Null
		PORTB=0; DDRB=0;
		PORTC=0; DDRC=0;
		PORTD=0; DDRD=0;
		
		// Watchdog aus!	
		wdt_disable();
		#ifdef DISPLAY_SCREEN_RESETINFO
			reset_flag = MCUCSR & 0x1F;	//Lese Grund fuer Reset und sichere Wert
			MCUCSR = 0;	//setze Register auf 0x00 (loeschen)
		#endif		
	#endif

	#ifdef UART_AVAILABLE
		uart_init();
	#endif

	#ifdef BOT_2_PC_AVAILABLE
		bot_2_pc_init();
	#endif


	#ifdef PC
		bot_2_sim_init();
	#endif

	#ifdef DISPLAY_AVAILABLE
		display_init();
		display_update=1;
	#endif

	#ifdef LED_AVAILABLE
		LED_init();
	#endif

	motor_init();
	bot_sens_init();
	bot_behave_init();
	
	#ifdef MCU
		#ifdef RC5_AVAILABLE
			ir_init();
		#endif
	#endif
			
	#ifdef MAUS_AVAILABLE
		maus_sens_init();
	#endif
	
	#ifdef DISPLAY_BEHAVIOUR_AVAILABLE
	    behaviour_page = 1;
	#endif

	#ifdef TWI_AVAILABLE
		Init_TWI();
		Close_TWI();
	#endif

}