Пример #1
0
void Init_Periphs()			  
{

 Init_Clock_System();
 Init_PortA();
 Init_PortB();
 Init_PortC();
 #ifdef BLINK_ON_START
 	Blink_Leds(BLINK_NBR,DUREE_LENTE);
 #endif

 #ifdef USE_ADC
  Setup_Adc();
  Adc_On();
  Start_Conversion();
 #endif

 #ifdef USE_PWM
 Init_Timer2();
 Fixe_Rapport(0);
 #endif

 #ifdef USE_POSITION
 Init_Timer3();
 #endif

 #ifdef USE_SPEED
 Init_Timer4();
 #endif


}
Пример #2
0
void main(void)
{
	WDTCN = 0xDE;
	WDTCN = 0xAD;
	EA = 0;
	
	Init_Clock();
	Init_Port();

	Init_Timer0(SYSCLK);
	Init_Timer2(SYSCLK);
	Init_Timer3(SYSCLK);

	EA = 1;

	PIN_MOTOR_DIR = 0xFF;	//set motor direction to clockwise;

	while(1) { }
}
Пример #3
0
/**
**===========================================================================
**
**  Abstract: main program
**
**===========================================================================
*/
int main(void)
{
	if (SysTick_Config(SystemCoreClock / 1000))
	{
	    /* Capture error */
	    while (1);
	}

	/* Initialisiere SPI2 */
	D_SPI_Init();
	/* Initialisiere Display */
	lcd_reset();
	/* Hintergrundbeleuchtung einschalten */
	D_SPI_LEDHigh();
	/* SPI Speed auf Max einstellen */
	D_SPI_ChangeSPISpeed(SPI_BaudRatePrescaler_2);



	lcd_clear(COLOR_BLACK);

	/*
	// Beispiele für die TFT Lib
	lcd_fillRect(0,0,50,50, COLOR_RED);
	lcd_fillRect(55,0,105,50, COLOR_BLUE);
	lcd_fillRect(110,0,160,50, COLOR_GREEN);
	lcd_drawRect(165,0,215,100, COLOR_BLACK);


	lcd_verticalLine(10, 120, 60, COLOR_RED);
	lcd_verticalLine(20, 60, 120, COLOR_BLACK);

	lcd_horizontalLine(0, 130, 110, COLOR_BLUE);
	lcd_horizontalLine(0, 80, 60, COLOR_YELLOW);

	lcd_horizontalLine(0, 200, 110, COLOR_GREEN);
	lcd_horizontalLine(120, 200, 60, COLOR_YELLOW);

	lcd_drawLine(160, 120, 200, 90, COLOR_BLACK);

	lcd_drawCircle(160, 120, 55, COLOR_BLACK);
	lcd_fillCircle(250, 40, 20, COLOR_RED);

	lcd_drawChar(10, 6, 'H', FONT8X12, COLOR_WHITE, COLOR_RED);
	lcd_drawChar(18, 6, 'i', FONT8X12, COLOR_WHITE, COLOR_RED);
	lcd_drawChar(26, 6, ' ', FONT8X12, COLOR_WHITE, COLOR_RED);
	lcd_drawChar(34, 6, '!', FONT8X12, COLOR_WHITE, COLOR_RED);

	lcd_drawString(10, 18, "Seb is", FONT8X8, COLOR_WHITE, COLOR_RED);
	lcd_drawString(10, 26, "awesome", FONT8X8, COLOR_WHITE, COLOR_RED);

	lcd_drawInt(10, 34, -1234, FONT8X8, COLOR_BLUE, COLOR_RED);
	lcd_drawHex(10, 42, 4154, FONT8X12, COLOR_BLUE, COLOR_RED);
	*/

	sek = 0;
	min = 20;
	hour = 14;
	flag = 1;

	Init_Timer2();
	NVIC_Configuration();

	/* Infinite loop */
	while (1)
	{
		//Bildschirm wird refresht
		displayClock();
	}
}