#ifdef AVR32 #define UART 0 #define PORT_J2 #define INT_MODE 2 #define GPIO_DISP_DC PB22 #define Math //############################################################################## int gvApplikationsStatus, TimerZurAusgabe; //############################################################################## void main(void) { do if(gvApplikationsStatus==0) { App_AnfangsAppEinstellung(); } else { } while (1); } //############################################################################## void App_AnfangsAppEinstellung(void) { //Variablen_____ gvApplikationsStatus=1; TimerZurAusgabe=0; //Anschlüsse Display (Voreinstellung)_____ SPI_Enable(0, 1000000UL, 8, 0); //SPI-Konfiguration. SPI_SetChan(0); //Selektiert Schnittstelle. Port_Attribute(PA09, PORT_ATTR_OUTPUT); //RES P14 PA09 Port_Attribute(PA09, PORT_ATTR_INIT_HIGH); Thread_Delay(0.1); Port_Attribute(PA09, PORT_ATTR_INIT_LOW); Thread_Delay(0.1); Port_Attribute(PA09, PORT_ATTR_INIT_HIGH); Thread_Delay(10); Port_Attribute(PB22, PORT_ATTR_OUTPUT); //D/C P30 PB22 Port_Attribute(PB22, PORT_ATTR_INIT_HIGH); Port_Attribute(PB21, PORT_ATTR_OUTPUT); //CS P29 PB21 Port_Attribute(PB21, PORT_ATTR_INIT_LOW); //Initialisierungen_____ //TimerZurLCDAusgabe Irq_SetVect(INT_TIMER1, AusgabePruefung); Timer_Set(1, TIM_128, 25790, TIMFLG_IRQ); } //############################################################################## //############################################################################## void AusgabePruefung(void) { if(!Port_ReadBit(PC20)) { ssd1305_reset(); } TimerZurAusgabe++; Irq_GetCount(INT_TIMER1); if(!(TimerZurAusgabe%10)) { ssd1305_sendSingleByteCmd( 0xA5); } } //############################################################################## void ssd1305_sendSingleByteCmd (unsigned char cmd) { Msg_WriteText("Ausgabe erfolgt...\r\r"); Port_WriteBit( GPIO_DISP_DC, 0); SPI_Write( cmd); } //############################################################################## void ssd1305_reset(void) { Port_Attribute(PA09, PORT_ATTR_INIT_HIGH); Thread_Delay(0.1); Port_Attribute(PA09, PORT_ATTR_INIT_LOW); Thread_Delay(0.1); Port_Attribute(PA09, PORT_ATTR_INIT_HIGH); Thread_Delay(10); } //############################################################################## //############################################################################## //############################################################################## //############################################################################## #else #error "Only C-Control PRO AVR32-Bit" #endif