#include #include // for WinAVR-Compiler #include #include #include #include #include ////////////////////////////////////////////////////////////////////////////////////////// // Defines ////////////////////////////////////////////////////////////////////////////////////////// #define F_CPU 16000000 /* 16Mhz */ // COM Interface #define COM_BAUD_RATE 38400 /* 38400 baud */ #define COM_BAUD_SELECT (F_CPU/(COM_BAUD_RATE*16l)-1) #define STX 0x02 #define BARECODE_MUSTER_SIZE 224 #ifndef COM_BUFFER_SIZE #define COM_BUFFER_SIZE 0xF0 // 240 Zeichen #endif #ifndef COM_RX_BUFFER uint8_t com_rx_buffer[COM_BUFFER_SIZE]; #define COM_RX_BUFFER &com_rx_buffer[0] #endif #define COM_BUFFER_MASK COM_BUFFER_SIZE - 1 static volatile uint8_t * comRxBuffer = (uint8_t*)COM_RX_BUFFER; static volatile uint8_t comRxBufferIn; static volatile uint8_t comRxBufferOut; void comInit( void ) { comRxBufferIn = comRxBufferOut = 0; // D-Register initialisieren cbi(PORTD,PD0); // PD0 - RX - Input cbi(DDRD,PD0); sbi(DDRD,PD1); // PD1 - TX - Output /* enable RxD and ints */ outp((1<