#include #include "lcd-routines.h" #include #include #include #include //Defines für Impulsmessung #define TRUE 1 #define FALSE 0 volatile unsigned char NumberOverflow1 = 0; // Anzahl Timer1 Overflows volatile unsigned int StartTime1 = 0; // ICR1-Wert bei 1.High-Flanke speichern volatile unsigned int EndTime1 = 0; // ICR1-Wert bei 2.High-Flanke speichern volatile unsigned char Update1; // Flag //Defines für ADC #define ADCSTATREG 0x00 // 8bit #define ADCMODEREG 0x01 // 16bit #define ADCCONFREG 0x02 // 16bit #define ADCDATAREG 0x03 // 16bit #define ADCIDREG 0x04 // 8bit #define ADCIOREG 0x05 // 8bit #define ADCOFFREG 0x06 // 16bit #define ADCFSREG 0x07 // 16bit void spi_init() { DDRB = _BV(PB2) | _BV(PB3) | _BV(PB5); // setze SCK,MOSI,PB0 (SS) als Ausgang DDRB &= ~_BV(PB4); // setze MISO als Eingang PORTB = _BV(PB5) | _BV(PB2); // SCK und PB0 high (ist mit SS am Slave verbunden) SPCR = _BV(SPE) | _BV(MSTR) | _BV(SPR0); //Aktivierung des SPI, Master, Taktrate fck/16 } void SPIWrite8(uint8_t data) { SPDR = data; while(!(SPSR & (1<>8) & 0xFF); Data_L = Data & 0xFF; SPDR = Data_H; /* Start transmission */ while(!(SPSR & (1<