/* * Greifautomat.c * * Created: 11.12.2023 09:35:12 * Author : jojo1 */ #define F_CPU 11059000UL /* evtl. bereits via Compilerparameter definiert */ #define BAUD 9600UL #include #include #include #include #include #include #include #include #include #include #include #define UBRR_VAL ((F_CPU+BAUD*8)/(BAUD*16)-1) // clever runden #define BAUD_REAL (F_CPU/(16*(UBRR_VAL+1))) // Reale Baudrate #define BAUD_ERROR ((BAUD_REAL*1000)/BAUD) // Fehler in Promille, 1000 = kein Fehler. #define EEPReadByte(addr) eeprom_read_byte((uint8_t *)addr) #define EEPWriteByte(addr, val) eeprom_write_byte((uint8_t *)addr, val) #define EEPUpdateByte(addr,update) eeprom_update_byte((uint8_t *)addr,update) #define EEPReadWord(addr) eeprom_read_word((uint16_t *)addr) #define EEWriteWord(addr,val) eeprom_write_word((uint16_t *)addr,val) #define EEPUpdateWord(addr,update) eeprom_update_word((uint16_t *)addr,update) int default_buffer[10] = {0x7E , 0xFF , 0x06 , 0x00 , 0x00 , 0x00 , 0x00 , 0xEF}; // Default Buffer int buffer_data[10] = {0x7E , 0xFF , 0x06 , 0x00 , 0x00 , 0x00 , 0x00 , 0xEF}; // Sending Buffer volatile struct{ unsigned led:1; }status; volatile uint8_t milliseconds=0; volatile uint8_t sekunden=0; ISR (TIMER1_COMPA_vect){ status.led^=1; milliseconds++; if(milliseconds==10){if(sekunden>0){sekunden--;}milliseconds=0;} } void send_buffer(void) { int i; for( i=0; i< 10; i++){ while (!(UCSRA & (1< Setzt UMSEL00 auf 0 UCSRC &= ~(1<> 8; UBRRL = UBRR_VAL & 0xFF; //UCSRB |= (1<