Index: firmware/FSC/src/FSC.c
===================================================================
--- firmware/FSC/src/FSC.c	(revision 10094)
+++ firmware/FSC/src/FSC.c	(revision 10102)
@@ -21,6 +21,6 @@
 
 	spare_outs_init(); //set spare out pin I/O modes
-  app_init();		  // Setup software modules
-  usart_init();		// Initialize serial interface   
+    app_init();		  // Setup software modules
+    usart_init();		// Initialize serial interface   
 	spi_init(); 		// Initialize SPI interface as master
 	adc_init(); 		// Initialize AD7719 ADC as SPI slave 
@@ -40,9 +40,16 @@
 	// voltage, current, humidity - muxer pins:
 	// SB - pins
-	DDRB |= 0x7F; // set all SB - pins as outputs
+	DDRC |= 0x7F; // set all SB - pins as outputs
 	
 	// SB - muxer test
-	DDRA |= 1<<PA6 ; // set D0-0 lina as output. for tests only !!!
-	PORTA |= 1<<PA6; // set D0-0 line high. for tests only !!!
+//	DDRA |= 1<<PA6 ; // set D0-0 lina as output. for tests only !!!
+//	PORTA |= 1<<PA6; // set D0-0 line high. for tests only !!!
+DDRA &= ~(1<<PA6);
+
+//ADC einschalten
+  ADMUX = 0x26;  //0010.0110     // interne Referenzspannung nutzen
+  ADCSRA = (1<<ADPS1) | (1<<ADPS0);     // Frequenzvorteiler
+  ADCSRA |= (1<<ADEN);                  // ADC aktivieren
+  ADCSRA |= (1<<ADSC);
 
 
@@ -53,6 +60,11 @@
 BOOL heartbeat_enable = TRUE;
 
-U08 SA_mux_val = 0;
-//U08 SB_mx_val = 0;
+U08 SA_mux_val = 0x00;
+U08 SB_mux_val = 0x00;
+
+//U08 counter = 0;
+
+
+
 while (TRUE)
 	 {
@@ -60,4 +72,11 @@
 		// measure with a scope.
 		if (heartbeat_enable) PORTB ^= (1<<PB3); // toggle Out2_spare --> heartbeat
+		//adc_init(); 
+
+
+
+_delay_ms(1);
+/*
+
 
 		// if USART data arrives. i.e. data via USB
@@ -68,34 +87,151 @@
 		// by setting the usart_rx_ready flag FALSE again
 		++SA_mux_val;
-		PORTA |= (SA_mux_val & 0x3F); 
+		if (SA_mux_val == 64) SA_mux_val = 0;
+		PORTA = (SA_mux_val & 0x3F); 
+				
+		usart_write_str((pU08)"SA:");
+		usart_write_U08(SA_mux_val,2);
+		usart_write_str((pU08)" Sensor:");
+		usart_write_U08((SA_mux_val % 8)+1,2);
+		usart_write_str((pU08)" an Temperatur_");
+		switch (SA_mux_val / 8)
+		{
+			case 0: usart_write_str((pU08)"C");
+			break;
+			case 1: usart_write_str((pU08)"D");
+			break;
+			case 2: usart_write_str((pU08)"A");
+			break;
+			case 3: usart_write_str((pU08)"B");
+			break;
+			case 4: usart_write_str((pU08)"G");
+			break;
+			case 5: usart_write_str((pU08)"H");
+			break;
+			case 6: usart_write_str((pU08)"E");
+			break;
+			case 7: usart_write_str((pU08)"F");
+			break;
+			default: usart_write_str((pU08)"alarm!");
+			break;
+		}
+		usart_write_str((pU08)"\n");
+		_delay_us(200);
+	
+
+
+	
+for (U08 counter = 0; counter < 10; ++counter) {
+
 		
-		usart_write_str((pU08)"\tSA:");
-		usart_write_U08(SA_mux_val,2);
-		usart_write_str((pU08)"\t");
-		_delay_us(200);
+		while (!ADC_IS_READY())
+		{
+		// just wait until ADC is redy -- really bad code here!
+		}	    			
+   		startconv();							//Start a new A/D Conversion
+    	//temp = 	readandsendtemp();
+		//adcword = getadc();
+		resistance = getresistance();
+		//temperature = gettemp();
+		usart_write_str((pU08)"R:");
+		usart_write_float(resistance,3,4);
+		usart_write_str((pU08)"kOhm ");	
 		
-				
-				if(ADC_IS_READY()) 
-	    	{		
-		   		startconv();							//Start a new A/D Conversion
-		    	//temp = 	readandsendtemp();
-					//adcword = getadc();
-					resistance = getresistance();
-					//temperature = gettemp();
-					usart_write_str((pU08)"R:");
-					usart_write_float(resistance,3,4);
-					usart_write_str((pU08)"\t");	
-				}
-				if(ADC_IS_READY()) 
-	    	{		
-		   		startconv();							//Start a new A/D Conversion
-		    	//temp = 	readandsendtemp();
-					//adcword = getadc();
-					resistance = getresistance();
-					//temperature = gettemp();
-					usart_write_str((pU08)"R:");
-					usart_write_float(resistance,3,4);
-					usart_write_str((pU08)"\n");	
-				}
+
+		while (!ADC_IS_READY())
+		{
+		// just wait until ADC is redy -- really bad code here!
+		}	    			
+	
+		startconv();							//Start a new A/D Conversion
+		//temp = 	readandsendtemp();
+		//adcword = getadc();
+		resistance = getresistance();
+		//temperature = gettemp();
+		usart_write_str((pU08)"R:");
+		usart_write_float(resistance,3,4);
+		usart_write_str((pU08)"kOhm\n");	
+
+	_delay_ms(500);
+}
+usart_write_str((pU08)"\n\n\n");
+*/
+
+		++SB_mux_val;
+		if (SB_mux_val == 84) SB_mux_val = 0;
+		PORTC = (SB_mux_val & 0x7F); 
+
+_delay_ms(5);
+
+
+usart_write_str((pU08)"8bit-ADC: ");
+
+if (SB_mux_val < 64)
+{
+		switch (SB_mux_val / 16)
+		{
+			case 0: usart_write_str((pU08)"voltage_A: ");
+			break;
+			case 1: usart_write_str((pU08)"voltage_B: ");
+			break;
+			case 2: usart_write_str((pU08)"voltage_D: ");
+			break;
+			case 3: usart_write_str((pU08)"voltage_C: ");
+			break;
+		}
+
+		if (SB_mux_val % 2 == 0) {
+			usart_write_str((pU08)"U");
+			usart_write_U08( (SB_mux_val%16)/2 , 1 );
+		} else {
+			usart_write_str((pU08)"I");
+			usart_write_U08( ((SB_mux_val%16)-1)/2 , 1 );
+		}
+
+
+} else {
+
+
+	if (SB_mux_val < 72)  {
+		usart_write_str((pU08)"voltage_E: ");
+		if (SB_mux_val % 2 == 0) {
+			usart_write_str((pU08)"U");
+			usart_write_U08( (SB_mux_val%8)/2 , 1 );
+		} else {
+			usart_write_str((pU08)"I");
+			usart_write_U08( ((SB_mux_val%8)-1)/2 , 1 );
+		}
+
+	}
+else if (SB_mux_val == 72) usart_write_str((pU08)"humidity_A: H0");
+else if (SB_mux_val == 73) usart_write_str((pU08)"humidity_A: H1");
+
+else if (SB_mux_val < 82) {
+		usart_write_str((pU08)"voltage_F: ");
+		if (SB_mux_val % 2 == 0) {
+			usart_write_str((pU08)"U");
+			usart_write_U08( (SB_mux_val%8)/2 , 1 );
+		} else {
+			usart_write_str((pU08)"I");
+			usart_write_U08( ((SB_mux_val%8)-1)/2 , 1 );
+		}
+
+	}
+else if (SB_mux_val == 82) usart_write_str((pU08)"humidity_B: H0");
+else if (SB_mux_val == 83) usart_write_str((pU08)"humidity_B: H1");
+}
+
+for (U08 counter = 0; counter < 10; ++counter) {
+	while (ADCSRA & (1<<ADSC) );    // wait until internal ADC is ready
+	ADCSRA |= (1<<ADSC);
+	float voltage;
+	voltage = ( (float)ADCH ) / 256 * 4.096;
+	usart_write_str((pU08)" ");
+	usart_write_float(voltage,3,4);
+
+
+	_delay_ms(300);
+}
+usart_write_str((pU08)"\n");
 
 		
Index: firmware/FSC/src/ad7719_adc.c
===================================================================
--- firmware/FSC/src/ad7719_adc.c	(revision 10094)
+++ firmware/FSC/src/ad7719_adc.c	(revision 10102)
@@ -51,4 +51,13 @@
   const U8 WR_TO_AD0CON = 0x02;
   const U8 WR_TO_MODE = 0x01;
+  const U8 RD_FROM_FILTER = 0x44;
+
+  CLR_BIT(PORTD,SPI_AD_CS);  	// Set CS low
+  spi_transfer_byte(RD_FROM_FILTER);     	// Next Operation is write to IOCON1 and IOCON2  Start SPI
+  spi_transfer_byte(0xFF);     	// Next Operation is write to IOCON1 and IOCON2  Start SPI
+  SET_BIT(PORTD,SPI_AD_CS);	// Set CS high
+
+
+
 
   CLR_BIT(PORTD,SPI_AD_CS);  	// Set CS low
Index: firmware/FSC/src/ad7719_adc.h
===================================================================
--- firmware/FSC/src/ad7719_adc.h	(revision 10094)
+++ firmware/FSC/src/ad7719_adc.h	(revision 10102)
@@ -10,5 +10,5 @@
 #define ADC_RDY PD6
 #define ADC_RST PD7
-#define ADC_IS_READY() !(PIND & PD6) // TRUE if PD6=0 AD_RDY is inverted logic.
+#define ADC_IS_READY() !(PIND & (1<<PD6)) // TRUE if PD6=0 AD_RDY is inverted logic.
 
 // Port Definitions
Index: firmware/FSC/src/application.h
===================================================================
--- firmware/FSC/src/application.h	(revision 10094)
+++ firmware/FSC/src/application.h	(revision 10102)
@@ -28,5 +28,5 @@
 #define USART_RX_BUFFER_SIZE 64 // Receive buffer size
 
-#define USART_BAUDRATE 38400 // USART baudrate original
+#define USART_BAUDRATE 9600 // USART baudrate original
 
 #define USART_USE_TX // Transmitter used?
Index: firmware/FSC/src/interpol.c
===================================================================
--- firmware/FSC/src/interpol.c	(revision 10094)
+++ firmware/FSC/src/interpol.c	(revision 10102)
@@ -289,5 +289,5 @@
   U32 adcword=0;
   float resistance;
-  const float R_REF=6.28; // kilo-ohms	
+  const float R_REF=6.25; // kilo-ohms	
   adcword = read_adc();
   U32 fullscale = 16777215L; //2^24 -1
Index: firmware/FSC/src/spi_master.c
===================================================================
--- firmware/FSC/src/spi_master.c	(revision 10094)
+++ firmware/FSC/src/spi_master.c	(revision 10102)
@@ -37,5 +37,5 @@
 SPI_PRT |= (1 << SPI_MOSI);
 SPI_PRT |= (1 << SPI_SCLK);
-//SPI_PRT |= (1 << SPI_MISO);
+SPI_PRT |= (1 << SPI_MISO);
 
 
@@ -221,4 +221,6 @@
 {
   // Start SPI Transfer
+	if (!(SPCR & (1<<MSTR)) )
+		SPCR |= 1<<MSTR;
   SPDR = data;
 
Index: firmware/FSC/src/spi_master.h
===================================================================
--- firmware/FSC/src/spi_master.h	(revision 10094)
+++ firmware/FSC/src/spi_master.h	(revision 10102)
@@ -17,5 +17,5 @@
 #define SPI_MISO PB6
 // #define SPI_SS 	 PB4  // not in this application!!! danger
-#define SPI_E_CS PD2 		//device 0
+#define SPI_E_CS PB4 		//device 0
 #define SPI_AD_CS PD3 		//device 1
 #define SPI_M_CS PD4		//device 2
