#define F_CPU 4000000UL #include #include #include uint8_t uart_receive(void); void uart_send(uint8_t byte); void uart_string(char *); void natuve(void); void natuvex(void); int main(void) { uint8_t rec = 0; uart_string("[AVR] RUN FirstTest\r\n"); while (1) { wdt_reset(); if((USART0.STATUS & USART_RXCIF_bm)) { rec = USART0.RXDATAL; switch(rec) { case '0': while(1); case 't': uart_string("[AVR] FirstTest_APP\r\n"); break; case 'n': natuve(); break; default: uart_string("[AVR] Empfangen: "); uart_send(rec); uart_string("\r\n"); } } } } uint8_t uart_receive(void) { while(!(USART0.STATUS & USART_RXCIF_bm)); return USART0.RXDATAL; } void uart_send(uint8_t byte) { while (!(USART0.STATUS & USART_DREIF_bm)); USART0.TXDATAL = byte; } void uart_string(char *s) { while (*s) { uart_send(*s); s++; } } __attribute__((section(".APPDATA"))) void natuve(void) { for(uint8_t x = 0; x < 5; x++)uart_send('H'); natuvex(); } __attribute__((section(".APPDATA"))) void natuvex(void) { for(uint8_t x = 0; x < 5; x++)uart_send('X'); }