Index: firmware/FSC/src/FSC_eth_with_user_interface.c
===================================================================
--- firmware/FSC/src/FSC_eth_with_user_interface.c	(revision 17625)
+++ 	(revision )
@@ -1,315 +1,0 @@
-//-----------------------------------------------------------------------------
-#include "typedefs.h"
-#include "application.h"
-#include "spi_master.h"
-#include "ad7719_adc.h"
-#include "atmega_adc.h"    
-#include "usart.h"
-#include "macros.h"
-#include "muxer_fsc.h"
-#include "output.h"
-#include "parser.h"
-#include "interpol.h"
-#include "w5100_spi_interface.h"
-#include "timer.h"
-#include <avr/interrupt.h>
-#include <avr/wdt.h>
-#include <stdlib.h>
-
-// MAIN WORKFLOW GLOBAL VARIABLES
-	bool verbose;  // should go to w5100.c or so
-	bool heartbeat_enable;
-	
-
-	bool ad7719_measured_all = false;
-	bool ad7719_values_printed = true;
-	bool ad7719_print_endless = false;
-
-// ATMEGA ADC global variables
-	
-	bool adc_measured_all = false;
-	bool adc_values_printed = true;
-	bool adc_print_endless = false;
-
-	bool once_told_you = true;
-	bool debug_mode = false;
-
-	
-//-----------------------------------------------------------------------------
-//   M A I N    ---   M A I N    ---   M A I N    ---   M A I N    ---  M A I N    
-//-----------------------------------------------------------------------------
-int main(void)
-{
-	U08 highbyte;
-	U08 lowbyte;
-	
-	U16 eth_red_bytes;
-
-	U08 rc;
-	
-	app_init();		  // Setup: Watchdog and I/Os
-	usart_init();
-	spi_init(); 		// Initialize SPI interface as master
-	timer_init();		// set up TIMER2: TIMER2_COMP interrupt occurs every 1ms
-	atmega_adc_init();
-
-	w5100_reset();
-	w5100_init();
-
-	ad7719_init();
-	
-	//  Enable interrupts
-	sei();
-
-	
-for ( U08 i=0; i < (RESISTANCE_CHANNELS/8); ++i ) {
-	ad7719_enables[i]=0xFF;
-	ad7719_channels_ready[i]=0;
-	}
-
-for ( U08 i=0; i < (VOLTAGE_REGS); ++i ) {
-	if (i < (VOLTAGE_REGS)-1)
-		adc_enables[i]=0xFF;
-	else
-		adc_enables[i]=0x0F;
-	adc_channels_ready[i]=0;
-}
-
-	static U08 welcome[]="FSC 0.2 \n build: 05.06.2010\n";
-	usart_write_str(welcome);
-	/*
-	print_help();
-	print_adc_enable_status(true);
-	usart_write_char('\n');
-	print_ad7719_enable_status(true);
-	usart_write_char('\n');
-	usart_write_str((pU08)"time:");
-	usart_write_U32(sec , 7);
-	usart_write_str((pU08)" sec.\n");
-*/
-//MAIN LOOP
-while (1)
-{
-
-	// checks if socket is okay and resets in case of problem the W5100 
-	rc=w5100_caretaker();
-	if ( rc != 0x17 && rc != 0x14)  
-	{
-		usart_write_str((pU08)"caretaker! error code:");
-		usart_write_U08_hex(rc);
-		usart_write_crlf();
-	// something is not okay with the ethernet ... 
-	// will be reset in the next revolution.. but maybe we want to do more...
-	}
-	
-	// this if should check every 25ms if we have any data on the W5100
-	if ( (milisec % W5100_INPUT_CHECK_TIME == 0) && (w5100_ready) )
-	{
-		if ( (eth_red_bytes = get_S0_RX_RSR()) != 0) {
-			for (U08 rep=0; rep<1; ) {
-				if (eth_red_bytes == get_S0_RX_RSR() )
-					rep++;
-				else
-					eth_red_bytes =get_S0_RX_RSR();
-			}
-			usart_write_str((pU08)"ethgot:");
-			usart_write_U16(eth_red_bytes, 7);
-			usart_write_crlf();
-			parse_w5300_incoming( w5100_get_RX(ETH_READ_BUFFER_SIZE, true) );
-		}
-		
-	}
-	
-//----------------------------------------------------------------------------
-
-	if (check_if_adc_measurement_done()) {
-		
-		if(adc_print_endless){
-			usart_write_str((pU08)"V|");
-			usart_write_U32(sec ,8);
-			print_adc_nicely(false,true);
-			write_status_via_eth();
-			//print_adc_stupid();
-			reset_voltage_done();
-			reset_voltage_values();
-			//telegram_start();
-			//w5100_set_TX((U08*) adc_values, ADC_VALUES_LEN_BYTE);
-
-			reset_voltage_done();
-		} else 
-		if ( !adc_values_printed) {
-			adc_values_printed = true;
-			print_adc_nicely(true,true);
-			write_status_via_eth();
-			//print_adc_stupid();
-			//reset_voltage_done();
-			//telegram_start();
-			//w5100_set_TX((U08*) adc_values, ADC_VALUES_LEN_BYTE);
-
-		}
-	} 
-
-	if (check_if_ad7719_measurement_done()) {
-
-		if(ad7719_print_endless){
-			
-			print_ad7719_nicely();
-			write_status_via_eth();
-			reset_resistance_done();
-			reset_voltage_done();
-			reset_voltage_values();
-			//telegram_start();
-			//w5100_set_TX((U08*) ad7719_values, AD7719_VALUES_LEN_BYTE);
-
-		} else 
-		if ( !ad7719_values_printed) {
-			ad7719_values_printed = true;
-			print_ad7719_nicely(true,true);
-			write_status_via_eth();
-			reset_resistance_done();
-			//telegram_start();
-			//w5100_set_TX((U08*) ad7719_values, AD7719_VALUES_LEN_BYTE);
-
-		}
-	} 
-
-//----------------------------------------------------------------------------
-
-	// in order to check the user interface on a hardware near level.
-	// user can issue 'heartbeat command'.
-	// then this üpin is toggled with the 'main-while-loop-frequency'
-	// --> nice check for this frequency as well
-	if (heartbeat_enable) {
-		PORTA ^= (1<<HEARTBEATPIN);
-	}
-		
-//----------------------------------------------------------------------------
-	//IF we need to send away one byte, and ready to send
-	// apparently depricated
-	if ( (usart_tx_buffer_index > 0) && (UCSRA & (1<<UDRE)) ) { 
-		UDR = usart_tx_buffer[0];
-		// THis is shit
-		for (U08 i=0 ; i < USART_TX_BUFFER_SIZE; ++i) {
-			usart_tx_buffer[i] = usart_tx_buffer[i+1];
-		}
-		usart_tx_buffer_index--;
-	}
-
-//----------------------------------------------------------------------------
-
-	//IF USART DOR bit is set, PC is sending data to fast!!!
-	if ( UCSRA & (1<<DOR) ){
-		usart_write_str((pU08)"PC sending to fast!\n");
-		//usart_last_char = UDR;
-		UDR;
-		// flush TX_buffer and write warning message in
-		// maybe even switch off every measurement. ?
-	}
-//----------------------------------------------------------------------------
-
-	//IF TX_BUFFER was overrun.	
-	if (usart_tx_buffer_overflow) {
-		// flash TX_buffer and write warning message in
-		// maybe even switch off every measurement. ?
-		//
-		// this should only happen, in verbose mode and with low baudrates.
-	}
-//----------------------------------------------------------------------------
-	
-	//IF one command was received. 
-	//	-It is not allowed to send more than one command between two '\n'
-	if (usart_rx_ready){ 
-		//parse_ascii();
-		MSR_parser();
-	}
-//----------------------------------------------------------------------------
-
-	//IF ATmega internal ADC did finish a conversion --every 200us
-	if ( (ADCSRA & (1<<ADIF)) && !adc_measured_all) {
-		lowbyte = ADCL;
-		highbyte = ADCH;
-		ADCSRA |= 1<<ADIF;
-		*adc_current_reading = ((U16)highbyte<<8) | ((U16)lowbyte);
-		if (debug_mode) {
-				usart_write_U16_hex(*adc_current_reading);
-				usart_write_crlf();
-		}
-		
-		if (*adc_readings_since_last_muxing == ADC_READINGS_UNTIL_SETTLED+adc_readings_until_mean-1) {
-			adc_values[*adc_current_channel] += *adc_current_reading;
-			adc_channels_ready[*adc_current_channel/8] |= (1<<(*adc_current_channel%8));
-			
-			// if (rc==0x17) {
-				// eth_write_str(nc_U32_to_str(sec, 1));
-				// eth_write_buffer[eth_write_index] = '.';	eth_write_index++;	eth_write_str(nc_U16_to_str(sec, 1));
-				// eth_write_buffer[eth_write_index] = '\t';	eth_write_index++;	eth_write_str(nc_U08_to_str(*adc_current_channel,1));
-				// eth_write_buffer[eth_write_index] = '\t';	eth_write_index++;	eth_writeln_str(nc_U16_to_str(*adc_current_reading,1));
-			// }
-			
-			*adc_current_channel = increase_adc (*adc_current_channel);
-			//adc_values[*adc_current_channel] = 0;
-			Set_V_Muxer(*adc_current_channel);
-			*adc_readings_since_last_muxing = 0;
-			_delay_ms(10); // this is a muxer delay			
-		}
-		else if (adc_readings_since_last_muxing >= ADC_READINGS_UNTIL_SETTLED-1) {
-			adc_values[*adc_current_channel] += *adc_current_reading;
-			if (debug_mode) {
-				usart_write_str((pU08)"ch:");
-				usart_write_U08(*adc_current_channel,4);
-				usart_write_str((pU08)" v:");
-				usart_write_U16_hex(*adc_current_reading);
-				usart_write_str((pU08)" sum:");
-				usart_write_U16(adc_values[*adc_current_channel],8);
-				usart_write_crlf();
-			}
-
-			++(*adc_readings_since_last_muxing);
-		}
-		else  {
-			++(*adc_readings_since_last_muxing);
-		}
-
-	}
-	
-//----------------------------------------------------------------------------
-
-	//IF AD7719 ADC just finished a conversion -- every 60ms
-	
-	if (AD7719_IS_READY() && !ad7719_measured_all) {
-		*ad7719_current_reading = read_adc(); // --takes at 4MHz SCLK speed about 6us
-		// AD7719 is only read out if settled. saves time.	
-		if (*ad7719_readings_since_last_muxing == AD7719_READINGS_UNTIL_SETTLED-1) {
-			ad7719_values[*ad7719_current_channel] = *ad7719_current_reading;
-			*ad7719_readings_since_last_muxing=0;
-			if (debug_mode) {
-				usart_write_U32_hex(*ad7719_current_reading);
-				usart_write_char('\n');
-				usart_write_char('\n');
-			}
-			// now prepare the data to be send away via USART.
-			
-			// note that this channel is ready, now and 
-			// proceed to the next enabled channel.
-			ad7719_channels_ready[*ad7719_current_channel/8] |= (1<<(*ad7719_current_channel%8));
-			*ad7719_current_channel = increase_ad7719 (*ad7719_current_channel);
-			Set_T_Muxer(*ad7719_current_channel);
-		} else { // the AD7719 did not settle yet, we discard the reading
-			++(*ad7719_readings_since_last_muxing);
-			if (debug_mode) {
-				usart_write_U32_hex(*ad7719_current_reading);
-				usart_write_char('\n'); 
-			}
-
-			// current reading is not used for anything else
-		}
-	}
-
-
-} // end of MAIN LOOP
-
-} // end of main function
-//-----------------------------------------------------------------------------
-//    E N D     E N D     E N D     E N D     E N D     E N D     E N D     
-//-----------------------------------------------------------------------------
-
Index: firmware/FSC/src/FSC_neu.c
===================================================================
--- firmware/FSC/src/FSC_neu.c	(revision 17625)
+++ 	(revision )
@@ -1,324 +1,0 @@
-//-----------------------------------------------------------------------------
-#include "typedefs.h"
-#include "muxer_fsc.h"
-#include "parser.h"
-#include "application.h"
-#include "output.h"
-#include "spi_master.h"
-#include "ad7719_adc.h"
-#include "atmega_adc.h"    
-#include "usart.h"
-#include "macros.h"
-#include "interpol.h"
-#include "w5100_spi_interface.h"
-#include <avr/interrupt.h>
-#include <avr/wdt.h>
-#include <stdlib.h>
-//-----------------------------------------------------------------------------
-
-// MAIN WORKFLOW GLOBAL VARIABLES
-	bool heartbeat_enable = true;
-	bool human_readable_interface_active = true;
-	
-
-// USART global variables
-	U08 usart_rx_buffer[USART_RX_BUFFER_SIZE];
-	U08 usart_tx_buffer[USART_TX_BUFFER_SIZE];
-	U08 usart_received_chars;
-	U08 usart_rx_buffer_index = 0;
-	U08 usart_tx_buffer_index = 0;
-  	U08 usart_last_char; 					// last received char
-
-// USART FLAGS
-	bool usart_tx_buffer_overflow = false;	// true if usart_tx_buffer was full.
-	bool usart_rx_ready = false;			// EOL was received, parser needs to be called
-	
-// TIMER global variable
-	volatile U32 local_ms = 0;
-
-// AD7719 global variables
-	U32 ad7719_values[TEMP_CHANNELS];
-	U08 ad7719_enables[CHANNEL_BITMAP];
-	U08 ad7719_channels_ready[CHANNEL_BITMAP];
-	U08 ad7719_readings_since_last_muxing = 0;
-	U08 ad7719_current_channel = 0;
-	U32 ad7719_current_reading = 0;
-	bool ad7719_measured_all = false;
-	
-// ATMEGA ADC global variables
-	U08 adc_values[V_CHANNELS + I_CHANNELS + H_CHANNELS]; // stores measured voltage in steps of 16mV
-	U08 adc_enables[V_BITMAP + I_BITMAP + H_BITMAP];
-	U08 adc_channels_ready[V_BITMAP + I_BITMAP + H_BITMAP];
-	U08 adc_readings_since_last_muxing = 0;
-	U08 adc_current_channel = 0;
-	U08 adc_current_reading = 0;
-	bool adc_measured_all = false;
-
-	bool once_told_you = true;
-	bool debug_mode = false;
-
-//-----------------------------------------------------------------------------
-//   M A I N    ---   M A I N    ---   M A I N    ---   M A I N    ---  M A I N    
-//-----------------------------------------------------------------------------
-int main(void)
-{
-	app_init();		  // Setup: Watchdog and I/Os
-	usart_init();		// Initialize serial interface   
-	spi_init(); 		// Initialize SPI interface as master
-	ad7719_init(); 		// Initialize AD7719 ADC as SPI slave 
-	atmega_adc_init();
-
-// TIMER2 is used as local clock:
-// configure timer 2
-	TCCR2 = (1<<WGM21); // CTC Modus
-	TCCR2 |= (1<<CS21) | (1<<CS20); // Prescaler 64 --> counts up every 8us
-	OCR2 = 125-1; 					// --> output compare interrupt occurs every 125 x 8us = 1ms
-	// Compare Interrupt erlauben
-	TIMSK |= (1<<OCIE2);
-
-  //  Enable interrupts
-  sei();              
-
-  PORTB &= ~(1<<PB2);  // PULL PB2 low --> this is #RST of WIZ812MJ --> WIZ812MJ is inactive.
-
-	static U08 welcome[]="\n\nwelcome to FACT FSC commandline interface v0.5\nready?";
-	usart_write_str(welcome);
-
-	
-  
-for ( U08 i=0; i<CHANNEL_BITMAP; ++i ) {
-	ad7719_enables[i]=0x00;
-	ad7719_channels_ready[i]=0;
-	}
-	ad7719_enables[0]=0x08;
-for ( U08 i=0; i<V_BITMAP + I_BITMAP; ++i ) {
-	adc_enables[i]=0xFF;
-	adc_channels_ready[i]=0;
-}
-	adc_enables[V_BITMAP + I_BITMAP + H_BITMAP -1] = 0xF0;
-	adc_channels_ready[V_BITMAP + I_BITMAP + H_BITMAP -1]=0;
-
-
-
-//MAIN LOOP
-while (1)
-{
-	if (heartbeat_enable) PORTB ^= (1<<PB3); // toggle Out2_spare --> heartbeat
-//----------------------------------------------------------------------------
-	//IF we need to send away one byte, and ready to send
-	// THIS IS NOT USED AT THE MOMENT
-	if ( (usart_tx_buffer_index > 0) && (UCSRA & (1<<UDRE)) ) { 
-		UDR = usart_tx_buffer[0];
-		// THis is shit
-		for (U08 i=0 ; i < USART_TX_BUFFER_SIZE; ++i) {
-			usart_tx_buffer[i] = usart_tx_buffer[i+1];
-		}
-		usart_tx_buffer_index--;
-	}
-//----------------------------------------------------------------------------
-
-	//IF we just received one byte, and there is enough space in the RX_buffer
-	if ( (UCSRA & (1<<RXC)) && (usart_rx_buffer_index < USART_RX_BUFFER_SIZE) ){
-		usart_last_char = UDR;
-		if (usart_last_char == '\n'){ // if EOL was received
-			usart_rx_ready = true;
-		}else {
-		usart_rx_buffer[usart_rx_buffer_index] = usart_last_char;
-		usart_rx_buffer_index++;
-		}
-		// here is still something strange .... better send an enter automatically
-	} else if (UCSRA & (1<<RXC)) { // if there is no space in the buffer; read anyway.
-		usart_last_char = UDR;
-		usart_rx_buffer_index =0;
-	}
-//----------------------------------------------------------------------------
-
-	//IF USART DOR bit is set, PC is sending data to fast!!!
-	if ( UCSRA & (1<<DOR) ){
-		// flush TX_buffer and write warning message in
-		// maybe even switch off every measurement. ?
-	}
-//----------------------------------------------------------------------------
-
-	//IF TX_BUFFER was overrun.	
-	if (usart_tx_buffer_overflow) {
-	
-		// TX BUFFER is not used in this firmware version.
-		
-		// flash TX_buffer and write warning message in
-		// maybe even switch off every measurement. ?
-		//
-		// this should only happen, in verbose mode and with low baudrates.
-	}
-//----------------------------------------------------------------------------
-	
-	//IF one command was received. 
-	//	-It is not allowed to send more than one command between two '\n'
-	if (usart_rx_ready){ 
-		parse_ascii();
-		usart_rx_buffer_index = 0;
-		usart_rx_ready = false;
-	}
-//----------------------------------------------------------------------------
-
-	//IF ATmega internal ADC did finish a conversion --every 200us
-	if ( (ADCSRA & (1<<ADIF)) && !adc_measured_all) {
-		adc_current_reading = ADCH;
-		if (adc_readings_since_last_muxing == ADC_READINGS_UNTIL_SETTLED) {
-			adc_values[adc_current_channel] = adc_current_reading;
-			adc_readings_since_last_muxing=0;
-			// note that this channel is ready, now and 
-			//adc_output(adc_current_channel, adc_current_reading);
-			// proceed to the next enabled channel.
-			adc_channels_ready[adc_current_channel/8] |= (1<<(adc_current_channel%8));
-			adc_current_channel = increase_adc (adc_current_channel);
-			Set_V_Muxer(adc_current_channel);
-			_delay_ms(10);
-		} else { // the ADC did not settle yet, we discard the reading
-			++adc_readings_since_last_muxing;
-			// current reading is not used for anything else
-		}
-	}
-//----------------------------------------------------------------------------
-
-	//IF AD7719 ADC just finished a conversion -- every 60ms
-	
-	if (AD7719_IS_READY() && !ad7719_measured_all) {
-			ad7719_current_reading = read_adc(); // --takes at 4MHz SCLK speed about 6us
-		// AD7719 is only read out if settled. saves time.	
-		if (ad7719_readings_since_last_muxing == AD7719_READINGS_UNTIL_SETTLED) {
-			ad7719_values[ad7719_current_channel] = ad7719_current_reading;
-			ad7719_readings_since_last_muxing=0;
-			if (debug_mode) {
-				usart_write_U32_hex(ad7719_current_reading);
-				usart_write_char('\n');
-				usart_write_char('\n');
-			}
-			// now prepare the data to be send away via USART.
-			//ad7719_output(ad7719_current_channel, ad7719_current_reading);
-			// note that this channel is ready, now and 
-			// proceed to the next enabled channel.
-			ad7719_channels_ready[ad7719_current_channel/8] |= (1<<(ad7719_current_channel%8));
-			ad7719_current_channel = increase_ad7719 (ad7719_current_channel);
-			Set_T_Muxer(ad7719_current_channel);
-		} else { // the AD7719 did not settle yet, we discard the reading
-			++ad7719_readings_since_last_muxing;
-			if (debug_mode) {
-				usart_write_U32_hex(ad7719_current_reading);
-				usart_write_char('\n'); 
-			}
-
-			// current reading is not used for anything else
-		}
-	}
-//----------------------------------------------------------------------------
-	//IF one of the ADC measured all channels, we wanted to know.
-	check_what_measurement_was_finished();
-	
-	if (ad7719_measured_all && adc_measured_all && !once_told_you)
-	{
-		adc_output_all();
-		once_told_you = true;
-	}
-//----------------------------------------------------------------------------
-
-} // end of MAIN LOOP
-//-----------------------------------------------------------------------------
-//    E N D     E N D     E N D     E N D     E N D     E N D     E N D     
-//-----------------------------------------------------------------------------
-} // end of main() function
-
-
-ISR (TIMER2_COMP_vect)
-{
- ++local_ms;
-}
-
-
-U08	increase_adc (U08 channel){
-U08 effective_channel;
-	for ( U08 increase = 1 ; increase <= V_CHANNELS + I_CHANNELS + H_CHANNELS; increase++)
-	{
-		effective_channel = (channel + increase) % (V_CHANNELS + I_CHANNELS + H_CHANNELS);
-		if (adc_enables[effective_channel/8] & (1<<effective_channel%8))
-			return effective_channel;
-	}
-	return channel;
-} // end if increase_adc;
-
-U08	increase_ad7719 (U08 channel){
-U08 effective_channel;
-	for ( U08 increase = 1 ; increase <= TEMP_CHANNELS; increase++)
-	{
-		effective_channel = (channel + increase) % (TEMP_CHANNELS);
-		if (ad7719_enables[effective_channel/8] & (1<<effective_channel%8))
-			return effective_channel;
-	}
-	return channel;
-} // end if increase_adc;
-
-void check_what_measurement_was_finished() {
-	adc_measured_all = true;
-	for ( U08 i=0; i<V_BITMAP + I_BITMAP + H_BITMAP; ++i ) {
-		if ((adc_enables[i] ^ adc_channels_ready[i]) != 0x00) {
-			adc_measured_all = false;
-			break;
-		}
-	}
-	ad7719_measured_all = true;
-	for ( U08 i=0; i<CHANNEL_BITMAP; ++i ) {
-		if ((ad7719_enables[i] ^ ad7719_channels_ready[i]) != 0x00) {
-			ad7719_measured_all = false;
-			break;
-		}
-	}
-
-
-}
-
-
-
-void set_ad7719_enable_register() {
-
-	usart_write_str((pU08)"\n set enable bits of AD7719 Port ");
-	if ((usart_rx_buffer_index>=5) && 
-	(usart_rx_buffer[2] >= 'A' && usart_rx_buffer[2] <= 'H'))
-	{
-	usart_write_char(usart_rx_buffer[2]);
-	usart_write_str((pU08)" to ");
-	usart_write_U08_hex(usart_rx_buffer[4]);
-	usart_write_char('\n');
-		ad7719_enables[usart_rx_buffer[2]-'A']=usart_rx_buffer[4];
-		ad7719_channels_ready[usart_rx_buffer[2]-'A']=0x00;
-	}
-	else if  ((usart_rx_buffer_index=3) && 
-	(usart_rx_buffer[1] >= 'A' && usart_rx_buffer[1] <= 'H'))
-	{
-		usart_write_char(usart_rx_buffer[1]);
-		if (usart_rx_buffer[2]!='0') {
-			usart_write_str((pU08)" to 0xFF\n");
-			ad7719_enables[usart_rx_buffer[1]-'A']=0xFF;
-		} else
-		{
-			usart_write_str((pU08)" to 0x00\n");
-			ad7719_enables[usart_rx_buffer[1]-'A']=0x00;
-		}
-		ad7719_channels_ready[usart_rx_buffer[1]-'A']=0x00;	
-	}
-	else
-	{
-		usart_write_str((pU08)"\n something wrong\n");
-		usart_write_str((pU08)"usart_rx_buffer_index: ");
-		usart_write_U08(usart_rx_buffer_index, 3);
-		usart_write_str((pU08)"\n usart_rx_buffer[2]: ");
-		usart_write_char(usart_rx_buffer[2]);
-		usart_write_str((pU08)"\n usart_rx_buffer[4]: ");
-		usart_write_U08_hex(usart_rx_buffer[4]);
-		usart_write_char('\n');
-	}
-}
-
-void set_adc_enable_register() {
-	// TODO
-	usart_write_str((pU08)"setting of ATmega internal ADC enable registers is not supported. yet.\n");
-}
Index: firmware/FSC/src/FSC_old.c
===================================================================
--- firmware/FSC/src/FSC_old.c	(revision 17625)
+++ 	(revision )
@@ -1,823 +1,0 @@
-//-----------------------------------------------------------------------------
-#include "typedefs.h"
-#include "application.h"
-#include "spi_master.h"
-#include "ad7719_adc.h"
-#include "atmega_adc.h"    
-#include "usart.h"
-#include "macros.h"
-#include "interpol.h"
-#include "w5100_spi_interface.h"
-#include <avr/interrupt.h>
-#include <avr/wdt.h>
-#include <stdlib.h>
-//-----------------------------------------------------------------------------
-// definition of some functions:
-// these function are implemented in this file, this is not doog coding style.
-// sooner or later, they will be moved into more apropriate files.
-U08	increase_adc (U08 channel);
-U08	increase_ad7719 (U08 channel);
-void Set_V_Muxer (U08 channel);
-void Set_T_Muxer(U08 channel);
-void talk(void);// never used up to now.
-void ad7719_output(U08 channel, U32 data);
-void adc_output(U08 channel, U08 data);
-void adc_output_all();
-void parse(); //doesn't do anything at the moment
-void check_if_measured_all() ;
-// end of function definition:
-//-----------------------------------------------------------------------------
-
-// MAIN WORKFLOW GLOBAL VARIABLES
-	bool verbose;
-	bool heartbeat_enable;
-
-// USART global variables
-	U08 usart_rx_buffer[USART_RX_BUFFER_SIZE];
-	U08 usart_tx_buffer[USART_TX_BUFFER_SIZE];
-	U08 usart_rx_buffer_index = 0;
-	U08 usart_tx_buffer_index = 0;
-  	U08 usart_last_char; 					// last received char
-
-// USART FLAGS
-	bool usart_tx_buffer_overflow = false;	// true if usart_tx_buffer was full.
-	bool usart_rx_ready = false;			// EOL was received, parser needs to be called
-	
-// TIMER global variable
-	volatile U32 local_ms = 0;
-
-// AD7719 global variables
-	#define TEMP_CHANNELS 64
-	#define CHANNEL_BITMAP 8
-	#define AD7719_READINGS_UNTIL_SETTLED 1 // bei3:480ms
-	U32 ad7719_values[TEMP_CHANNELS];
-	U08 ad7719_enables[CHANNEL_BITMAP];
-	U08 ad7719_channels_ready[CHANNEL_BITMAP];
-	U08 ad7719_readings_since_last_muxing = 0;
-	U08 ad7719_current_channel = 0;
-	U32 ad7719_current_reading = 0;
-	bool ad7719_measured_all = false;
-	
-// ATMEGA ADC global variables
-	#define V_CHANNELS 40
-	#define I_CHANNELS 40
-	#define H_CHANNELS 4
-	#define V_BITMAP 5
-	#define I_BITMAP 5
-	#define H_BITMAP 1
-	#define ADC_READINGS_UNTIL_SETTLED 1
-	U32 adc_values[V_CHANNELS + I_CHANNELS + H_CHANNELS]; // stores measured voltage in steps of 16mV
-	U08 adc_enables[V_BITMAP + I_BITMAP + H_BITMAP];
-	U08 adc_channels_ready[V_BITMAP + I_BITMAP + H_BITMAP];
-	U08 adc_readings_since_last_muxing = 0;
-	U08 adc_current_channel = 0;
-	U08 adc_current_reading = 0;
-	bool adc_measured_all = false;
-
-//-----------------------------------------------------------------------------
-//   M A I N    ---   M A I N    ---   M A I N    ---   M A I N    ---  M A I N    
-//-----------------------------------------------------------------------------
-int main(void)
-{
-	app_init();		  // Setup: Watchdog and I/Os
-	usart_init();		// Initialize serial interface   
-	spi_init(); 		// Initialize SPI interface as master
-	ad7719_init(); 		// Initialize AD7719 ADC as SPI slave 
-	atmega_adc_init();
-
-// TIMER2 is used as local clock:
-// configure timer 2
-	TCCR2 = (1<<WGM21); // CTC Modus
-	TCCR2 |= (1<<CS21) | (1<<CS20); // Prescaler 64 --> counts up every 8us
-	OCR2 = 125-1; 					// --> output compare interrupt occurs every 125 x 8us = 1ms
-	// Compare Interrupt erlauben
-	TIMSK |= (1<<OCIE2);
-
-  //  Enable interrupts
-  sei();              
-
-for ( U08 i=0; i<CHANNEL_BITMAP; ++i ) {
-	ad7719_enables[i]=0xFF;
-	ad7719_channels_ready[i]=0;
-	}
-for ( U08 i=0; i<V_BITMAP + I_BITMAP + H_BITMAP; ++i ) {
-	adc_enables[i]=0xFF;
-	adc_channels_ready[i]=0;
-}
-	static U08 welcome[]="\n\nwelcome to FACT FSC commandline interface v0.1\nready?";
-	usart_write_str(welcome);
-
-
-//MAIN LOOP
-while (1)
-{
-	if (heartbeat_enable) PORTB ^= (1<<PB3); // toggle Out2_spare --> heartbeat
-//----------------------------------------------------------------------------
-	//IF we need to send away one byte, and ready to send
-
-	if ( (usart_tx_buffer_index > 0) && (UCSRA & (1<<UDRE)) ) { 
-		UDR = usart_tx_buffer[0];
-		// THis is shit
-		for (U08 i=0 ; i < USART_TX_BUFFER_SIZE; ++i) {
-			usart_tx_buffer[i] = usart_tx_buffer[i+1];
-		}
-		usart_tx_buffer_index--;
-	}
-//----------------------------------------------------------------------------
-
-	//IF we just received one byte, and there is enough space in the RX_buffer
-	if ( (UCSRA & (1<<RXC)) && (usart_rx_buffer_index < USART_RX_BUFFER_SIZE) ){
-		usart_last_char = UDR;
-		if (usart_last_char == '\n'){ // if EOL was received
-			usart_rx_ready = true;
-		}else {
-		usart_rx_buffer[usart_rx_buffer_index] = usart_last_char;
-		usart_rx_buffer_index++;
-		}
-		// here is still something strange .... better send an enter automatically
-	} else if (UCSRA & (1<<RXC)) { // if there is no scace in the buffer; read anyway.
-		usart_last_char = UDR;
-		usart_rx_buffer_index =0;
-	}
-//----------------------------------------------------------------------------
-
-	//IF USART DOR bit is set, PC is sending data to fast!!!
-	if ( UCSRA & (1<<DOR) ){
-		// flush TX_buffer and write warning message in
-		// maybe even switch off every measurement. ?
-	}
-//----------------------------------------------------------------------------
-
-	//IF TX_BUFFER was overrun.	
-	if (usart_tx_buffer_overflow) {
-		// flash TX_buffer and write warning message in
-		// maybe even switch off every measurement. ?
-		//
-		// this should only happen, in verbose mode and with low baudrates.
-	}
-//----------------------------------------------------------------------------
-	
-	//IF one command was received. 
-	//	-It is not allowed to send more than one command between two '\n'
-	if (usart_rx_ready){ 
-		parse();
-		usart_rx_buffer_index = 0;
-		usart_rx_ready = false;
-	}
-//----------------------------------------------------------------------------
-
-	//IF ATmega internal ADC did finish a conversion --every 200us
-	if ( (ADCSRA & (1<<ADIF)) && !adc_measured_all) {
-		adc_current_reading = ADCH;
-		if (adc_readings_since_last_muxing == ADC_READINGS_UNTIL_SETTLED) {
-			adc_values[adc_current_channel] = adc_current_reading;
-			adc_readings_since_last_muxing=0;
-			// note that this channel is ready, now and 
-			adc_output(adc_current_channel, adc_current_reading);
-			// proceed to the next enabled channel.
-			adc_channels_ready[adc_current_channel/8] |= (1<<(adc_current_channel%8));
-			adc_current_channel = increase_adc (adc_current_channel);
-			Set_V_Muxer(adc_current_channel);
-		} else { // the ADC did not settle yet, we discard the reading
-			++adc_readings_since_last_muxing;
-			// current reading is not used for anything else
-		}
-	}
-//----------------------------------------------------------------------------
-
-	//IF AD7719 ADC just finished a conversion -- every 60ms
-	
-	if (AD7719_IS_READY()) {
-			ad7719_current_reading = read_adc(); // --takes at 4MHz SCLK speed about 6us
-		// AD7719 is only read out if settled. saves time.	
-		if (ad7719_readings_since_last_muxing == AD7719_READINGS_UNTIL_SETTLED) {
-			ad7719_values[ad7719_current_channel] = ad7719_current_reading;
-			ad7719_readings_since_last_muxing=0;
-			// now prepare the data to be send away via USART.
-			//ad7719_output(ad7719_current_channel, ad7719_current_reading);
-			// note that this channel is ready, now and 
-			// proceed to the next enabled channel.
-			ad7719_channels_ready[ad7719_current_channel/8] |= (1<<(ad7719_current_channel%8));
-			ad7719_current_channel = increase_ad7719 (ad7719_current_channel);
-			Set_T_Muxer(ad7719_current_channel);
-		} else { // the AD7719 did not settle yet, we discard the reading
-			++ad7719_readings_since_last_muxing;
-
-			// current reading is not used for anything else
-		}
-	}
-//----------------------------------------------------------------------------
-	//IF one of the ADC measured all channels, we wanted to know.
-	check_if_measured_all();
-	
-	if (ad7719_measured_all && adc_measured_all)
-		adc_output_all();
-
-//----------------------------------------------------------------------------
-/*
-	if (verbose == true)
-		// talk() was just defined so the 
-		// code is not at this place ... look down.
-		talk();
-*/
-
-} // end of MAIN LOOP
-
-//-----------------------------------------------------------------------------
-//    E N D     E N D     E N D     E N D     E N D     E N D     E N D     
-//-----------------------------------------------------------------------------
-
-
-
-float resistance;
-
-U08 SA_mux_val = 0x00;
-U08 SB_mux_val = 0x00;
-
-//U08 counter = 0;
-U08 Res_or_Volt = 0x00;
-
-
-while (TRUE)
-	 {
-
-
-  ++Res_or_Volt;
-  if (Res_or_Volt <= 64){
-
-
-		// if USART data arrives. i.e. data via USB
-		// the usart_rx_ready flag is set TRUE
-		// now process the incoming data which is stored in 
-		// U08 usart_rx_buffer[USART_RX_BUFFER_SIZE]
-		// and tell the USART interface, it may receive new data
-		// by setting the usart_rx_ready flag FALSE again
-		++SA_mux_val;
-		if (Res_or_Volt == 1) SB_mux_val = 16;
-		else if (SA_mux_val == 64) SA_mux_val = 32;
-		else if (SA_mux_val == 16) SA_mux_val = 48;
-		else if (SA_mux_val == 32) 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");
-		usart_write_str((pU08)"  ");
-
-
-		startconv(0);
-
-	
-		while (!AD7719_IS_READY())
-		{
-		// just wait until ADC is redy -- really bad code here!
-		}	    			
- 		
-		resistance = getresistance();
-							//Start a new A/D Conversion
-    	//temp = 	readandsendtemp();
-		//adcword = getadc();
-		
-		//temperature = gettemp();
-		usart_write_str((pU08)"R:");
-		usart_write_float(resistance,3,4);
-		usart_write_str((pU08)"kOhm ");
-		
-		//_delay_ms(200);
-
-		startconv(0);
-
-		while (!AD7719_IS_READY())
-		{
-		// just wait until ADC is redy -- really bad code here!
-		}	    			
-   									//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 ");			
-
-//usart_write_str((pU08)"\n");
-switch (SA_mux_val)
-		{
-			case 7: usart_write_str((pU08)"\n\n");
-			break;
-			case 15: usart_write_str((pU08)"\n\n");
-			break;
-			case 23: usart_write_str((pU08)"\n\n");
-			break;
-			case 31: usart_write_str((pU08)"\n\n");
-			break;
-			case 39: usart_write_str((pU08)"\n\n");
-			break;
-			case 47: usart_write_str((pU08)"\n\n");
-			break;
-			case 55: usart_write_str((pU08)"\n\n");
-			break;
-			case 63: usart_write_str((pU08)"\n\n");
-			break;
-			default: usart_write_str((pU08)"\n");
-			break; 
-		}
-SB_mux_val = 0;
-}
-else if (Res_or_Volt == 148) Res_or_Volt = 0;
-else {
-
-
-		++SB_mux_val;		
-		if (SB_mux_val == 84) SB_mux_val = 0;
-		else if (SB_mux_val == 74) SB_mux_val = 82;
-		else if (SB_mux_val == 82) SB_mux_val = 72;
-		else if (SB_mux_val == 72) SB_mux_val = 74;
-		else if (SB_mux_val == 48) SB_mux_val = 64;
-		else if (SB_mux_val == 64) SB_mux_val = 32;
-		else if (SB_mux_val == 32) SB_mux_val = 48;
-		PORTC = (SB_mux_val & 0x7F);
- 
-
-
-
-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-2)%8)/2 , 1 );
-		} else {
-			usart_write_str((pU08)"I");
-			usart_write_U08( (((SB_mux_val-2)%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 < 1; ++counter) {
-	while (ADCSRA & (1<<ADSC) );    // wait until internal ADC is ready
-	float voltage;
-	voltage = ( (float)ADCH ) / 256 * 4.096;
-	usart_write_str((pU08)" ");
-	usart_write_float(voltage,3,4);
-
-
-}
-//usart_write_str((pU08)"\n");
-
-switch (SB_mux_val)
-		{
-			case 15: usart_write_str((pU08)"\n\n");
-			break;
-			case 31: usart_write_str((pU08)"\n\n");
-			break;
-			case 47: usart_write_str((pU08)"\n\n");
-			break;
-			case 63: usart_write_str((pU08)"\n\n");
-			break;
-			case 71: usart_write_str((pU08)"\n\n");
-			break;
-			case 73: usart_write_str((pU08)"\n\n");
-			break;
-			case 81: usart_write_str((pU08)"\n\n");
-			break;
-			case 83: usart_write_str((pU08)"\n\n");
-			break;
-			default: usart_write_str((pU08)"\n");
-			break; 
-		}
-
-SA_mux_val = 15;
-}		
-	/*	
-		if ( usart_rx_ready == TRUE )
-		{
-			//understand what it means and react
-			
-			switch (usart_rx_buffer[0])
-			{
-				
-				case 'h':
-				{
-					// toggle the heartbeat mode on or off.
-					heartbeat_enable = !heartbeat_enable;
-					break;
-				}
-				case 'a':
-				{
-					// conduct adc - AD7719 SPI interface test
-					
-					break;
-				}
-				case 'e':
-				{
-					// conduct ethernet module SPI interface test
-					strtol((char*) usart_rx_buffer+1, NULL, 0);
-					break;
-				}
-
-				default:
-				{
-					usart_write_str((pU08)"? you wrote: ");
-					usart_write_str((pU08)usart_rx_buffer);
-					usart_write_str((pU08)"\n");
-					break;
-				}
-			}
-			
-			heartbeat_enable = !heartbeat_enable;
-			usart_rx_ready = FALSE;
-		}
-*/
-// das ist ein paar schritte zu früh.
-// erstmal müssen die interfaces getestet werden.
-/*
-
-		for (U08 i = 0; i<16; i++)
-	  	{ 
-			
-	   		if((~PIND) & 0x08)  // PD4 is #ADC_RDY input. Inverted logic! if PD4=0 this evaluates to true					
-	    	{		
-				PORTA = (PORTA & 0xF0) | ((i) & 0x0F); 	// switch muxer
-		   		startconv();							//Start a new A/D Conversion
-		    	//temp = 	readandsendtemp();
-				//adcword = getadc();
-				//resistance = getresistance();
-				temperature = gettemp();
-				usart_write_float(temperature,2,4);
-				usart_write_str((pU08)"\t");
-
-			} // end of if adc ready
-			else
-			{
-			i--;
-			}
-		} // end of for loop over 16 channels
-		usart_write_crlf();
-
-*/
-
- 	}	// end of infinite while loop
-} // end of main()
-
-
-ISR (TIMER2_COMP_vect)
-{
- ++local_ms;
-}
-
-
-U08	increase_adc (U08 channel){
-bool valid_ch_found = false;
-	while (!valid_ch_found){
-	
-		// just increase 'channel' or turnover to zero.
-		++channel;
-		if (channel == V_CHANNELS + I_CHANNELS + H_CHANNELS)
-			channel = 0;
-	
-		// check if this channel is enabled in the bitmap
-		if (adc_enables[channel/8] & (1<<channel%8))
-			valid_ch_found = true;
-	} // end of while loop
-	return channel;
-} // end if increase_adc;
-
-U08	increase_ad7719 (U08 channel){
-bool valid_ch_found = false;
-	while (!valid_ch_found){
-	
-		// just increase 'channel' or turnover to zero.
-		++channel;
-		if (channel == TEMP_CHANNELS)
-			channel = 0;
-	
-		// check if this channel is enabled in the bitmap
-		if (ad7719_enables[channel/8] & (1<<channel%8))
-			valid_ch_found = true;
-	} // end of while loop
-	return channel;
-} // end if increase_adc;
-
-
-// Sets voltage Muxer to current channel
-// this is a Muxing, and therefor the adc might need some time to settle.
-// Since there are:
-//	- 40 voltage monitor channels
-// 	- 40 current monitor channels
-// 	- 4 humidity monitor channels
-// the muxer is set as follows.
-// channel 00..39 --> looking at the voltage channels
-// channel 40..79 --> looking at the current channels
-// channel 80..83 --> looking at the humidities
-void Set_V_Muxer (U08 channel){
-U08 SB = 0;
-	// voltages
-	if (channel < 40) {
-		if (channel < 36)
-			SB = channel*2;
-		else
-			SB = (channel+1)*2;
-	}
-	// currents
-	else if (channel < 80) {
-		channel -= 40;
-		if (channel < 36)
-			SB = channel*2+1;
-		else
-			SB = (channel+1)*2+1;
-	}
-	// humidities
-	else if (channel < 84) {
-		channel -= 80;
-		switch (channel) {
-			case 0:
-				SB = 0x48; //0100.1000
-				break;
-			case 1:
-				SB = 0x49; //0100.1001
-				break;
-			case 2:
-				SB = 0x58; //0101.0010
-				break;
-			case 3:
-				SB = 0x58; //0101.0011
-				break;
-		} // end of switch-case
-	} // end of if (channel < some_number)
-
-	PORTC = (PORTC & 0x80) | (0x7F & SB); // Here the muxer is switched.
-}
-
-void Set_T_Muxer(U08 channel) {
-U08 SA = 0x00;
-
-	switch (channel/16) {
-		case 0:
-			SA |= 1<<4; // 0001.0000
-			break;
-		case 1:
-			break;		// 0000.0000
-		case 2:
-			SA |= (1<<4)|(1<<5); // 0011.0000
-			break;
-		case 3:
-			SA |= 1<<5;  // 0010.0000
-			break;
-	}
-	
-	SA =  SA | (channel%16);
-	
-	PORTA = (PORTA & 0xC0) | (0x3F & SA); // Here the muxer is switched.
-}
-
-void talk(void){
-
-/*
-// makes no sense to declare the 'new_measurement' vars here
-// but maybe the whole function will be deleted, anyway ...
-// I'm thinking about it.
-bool ad7719_new_measurement;
-bool atmega_adc_new_measurement;
-	if (verbose == true) { 
-		// somebody wants to read every new measured value, even if it is trash!
-			// do not actually send away data !
-			// just prepare the data to be send away.
-		if ( ad7719_new_measurement  == true ) {
-			add_str_to_output_stream("ad7719: reading:");
-			add_dec_to_output_stream(reading_since_last_muxer_switch,1);
-			add_str_to_output_stream(" temperature channel:");
-			add_dec_to_output_stream(current_temperature_channel,2);
-			add_str_to_output_stream(" = ");
-			add_float_to_output_stream(current_ad7719_value,4,3);
-			add_str_to_output_stream("\n");
-		}
-		if (atmega_adc_new_measurement == true) {
-			add_str_to_output_stream("atmega_adc: reading:");
-			add_dec_to_output_stream(reading_since_last_muxer_switch,1);
-			add_str_to_output_stream(" voltage channel:");
-			add_dec_to_output_stream(current_voltage_channel,2);
-			add_str_to_output_stream(" = ");
-			add_float_to_output_stream(current_atmega_adc_value,4,3);
-			add_str_to_output_stream("\n");
-		}
-	} // end of: if verbose
-*/
-} // end of talk()
-
-// this function generates some output.
-void ad7719_output(U08 channel, U32 data) {
-	usart_write_str((pU08)"R:"); //R for resistance
-	usart_write_char('A'+channel/8); // Letters A,B,C,D,E,F,G,H
-	usart_write_char(' '); 
-	usart_write_U08(channel%8+1,1); // Numbers 1...8
-	usart_write_char(':'); 
-	usart_write_U32_hex(data); //data
-	usart_write_char('\n');
-}
-
-void adc_output(U08 channel, U08 data) {
-
-	if (channel < 40) 
-		usart_write_str((pU08)"V:"); 
-	else if (channel < 80)
-		usart_write_str((pU08)"I:"); 
-	else if (channel < 84)
-		usart_write_str((pU08)"H:"); 
-
-	switch (channel/16) {
-		case 0:
-			usart_write_char('A'); 
-			break;
-		case 1:
-			usart_write_char('B'); 
-			break;
-		case 2:
-			usart_write_char('D'); 
-			break;
-		case 3:
-			usart_write_char('C'); 
-			break;
-		case 4:
-			usart_write_char('E'); 
-			usart_write_char('E'); 
-			break;
-			
-	usart_write_char(' '); 
-	usart_write_U08((channel/2)%8+1,1); // Numbers 1...8
-	usart_write_char(':'); 
-	usart_write_U16((U16)data*16,5); //data
-	usart_write_char('\n');
-
-
-}
-
-
-void adc_output_all() {
-	// output all values, which are enabled
-	for (U08 i=0 ; i<40; ++i){
-		if (i==0) usart_write_str((pU08)"voltages:(in units of 16mV)\n");
-		if (i==40) usart_write_str((pU08)"currents:\n");
-		if (i==80) usart_write_str((pU08)"humidities:\n");
-		if (adc_enables[i/8] & i%8){
-			usart_write_U08(adc_values[i],3);
-			usart_write_char('\t');
-		}
-		if (i%8==7) usart_write_char('\n');
-		if (i==83) usart_write_char('\n');
-	}
-}
-
-
-// this method parses the data, 
-// which came in via USART
-// later it might as well parse the data from ethernet.
-void parse() {
-U08 command = usart_rx_buffer[0];
-// look at first byte
-// I hope, I can manage to use one byte commands
-	usart_rx_buffer[USART_RX_BUFFER_SIZE-1] = 0;
-	usart_write_str((pU08)"got:");
-	usart_write_str(usart_rx_buffer);
-	
-	
-
-	switch (command) {
-		case 'E': 			// AD7719 enable bitmaps may be set
-			for ( U08 i=0; i<CHANNEL_BITMAP; ++i ) {
-				ad7719_enables[i]=usart_rx_buffer[i+1];
-				ad7719_channels_ready[i]=0;
-			}
-			break;
-		case 'e':			// ATmega internal ADC enable bitmaps may be set
-			for ( U08 i=0; i<V_BITMAP + I_BITMAP + H_BITMAP; ++i ) {
-				adc_enables[i]=usart_rx_buffer[i+1];
-				adc_channels_ready[i]=0;
-			}
-			break;
-		case 'h':
-			usart_write_str((pU08)"\nheartbeat ");
-			heartbeat_enable = true;
-			if (usart_rx_buffer[1] == '0'){
-				heartbeat_enable = false;
-				usart_write_str((pU08)"off\n");
-			} else {
-				usart_write_str((pU08)"on\n");
-			}
-			break;
-		case 'G': 			// GET the Temperature channels, which are enabled
-			for ( U08 i=0; i<CHANNEL_BITMAP; ++i ) {
-				ad7719_channels_ready[i]=0;
-			}
-			break;
-		case 'g':			// GET the voltage/current/humidity channels, which are enabled
-			for ( U08 i=0; i<V_BITMAP + I_BITMAP + H_BITMAP; ++i ) {
-				adc_channels_ready[i]=0;
-			}
-			break;
-		case 's':
-			usart_write_char('\n');
-			for (U08 i=0; i< CHANNEL_BITMAP;++i) {
-				usart_write_U08_bin(ad7719_enables[i]);
-				usart_write_char('\t');
-			}
-			usart_write_char('\n');
-			for (U08 i=0; i< CHANNEL_BITMAP;++i){
-				usart_write_U08_bin(ad7719_channels_ready[i]);
-				usart_write_char('\t');
-			}
-			usart_write_char('\n');
-				usart_write_U32_hex(local_ms);
-			break;			
-	}
-	usart_write_str((pU08)"\nready?");
-	for (U08 i=0; i<USART_RX_BUFFER_SIZE; ++i)
-		usart_rx_buffer[i] = 0;
-}
-
-void check_if_measured_all() {
-	adc_measured_all = true;
-	for ( U08 i=0; i<V_BITMAP + I_BITMAP + H_BITMAP; ++i ) {
-		if ((adc_enables[i] ^ adc_channels_ready[i]) != 0x00) {
-			adc_measured_all = false;
-			break;
-		}
-	}
-	ad7719_measured_all = true;
-	for ( U08 i=0; i<CHANNEL_BITMAP; ++i ) {
-		if ((ad7719_enables[i] ^ ad7719_channels_ready[i]) != 0x00) {
-			ad7719_measured_all = false;
-			break;
-		}
-	}
-
-
-}
Index: firmware/FSC/src/FSC_test.c
===================================================================
--- firmware/FSC/src/FSC_test.c	(revision 17625)
+++ 	(revision )
@@ -1,369 +1,0 @@
-//-----------------------------------------------------------------------------
-#include "typedefs.h"
-#include "application.h"
-#include "spi_master.h"
-#include "ad7719_adc.h"
-#include "atmega_adc.h"    
-#include "usart.h"
-#include "macros.h"
-#include "muxer_fsc.h"
-#include "output.h"
-#include "parser.h"
-#include "interpol.h"
-#include "timer.h"
-#include "w5100_spi_interface.h"
-#include <avr/interrupt.h>
-#include <avr/wdt.h>
-#include <stdlib.h>
-//-----------------------------------------------------------------------------
-// definition of some functions:
-// these function are implemented in this file, this is not doog coding style.
-// sooner or later, they will be moved into more apropriate files.
-
-void parse(); //doesn't do anything at the moment
-
-// end of function definition:
-//-----------------------------------------------------------------------------
-
-
-// MAIN WORKFLOW GLOBAL VARIABLES
-	bool verbose;
-	bool heartbeat_enable;
-/*
-// USART global variables
-	U08 usart_rx_buffer[USART_RX_BUFFER_SIZE];
-	U08 usart_tx_buffer[USART_TX_BUFFER_SIZE];
-	U08 usart_rx_buffer_index = 0;
-	U08 usart_tx_buffer_index = 0;
-  	U08 usart_last_char; 					// last received char
-
-// USART FLAGS
-	bool usart_tx_buffer_overflow = false;	// true if usart_tx_buffer was full.
-	*/
-// TIMER global variable
-	volatile U32 local_ms = 0;
-
-// AD7719 global variables
-	U32 ad7719_values[RESISTANCE_CHANNELS];
-	U08 ad7719_enables[RESISTANCE_CHANNELS/8];
-	U08 ad7719_channels_ready[RESISTANCE_CHANNELS/8];
-	U08 ad7719_readings_since_last_muxing = 0;
-	U08 ad7719_current_channel = 0;
-	U32 ad7719_current_reading = 0;
-	bool ad7719_measured_all = false;
-	
-// ATMEGA ADC global variables
-	U08 adc_values[VOLTAGE_CHANNELS]; // stores measured voltage in steps of 16mV
-	U08 adc_enables[VOLTAGE_REGS];
-	U08 adc_channels_ready[VOLTAGE_REGS];
-	U08 adc_readings_since_last_muxing = 0;
-	U08 adc_current_channel = 0;
-	U08 adc_current_reading = 0;
-	bool adc_measured_all = false;
-
-	bool once_told_you = true;
-	bool debug_mode = false;
-	
-#ifndef ___MAIN_WORKFLOW_GLOBAL_VARS
-#define ___MAIN_WORKFLOW_GLOBAL_VARS	
-	#define TEMP_CHANNELS 64
-	#define CHANNEL_BITMAP 8
-	#define AD7719_READINGS_UNTIL_SETTLED 1 // bei3:480ms
-	#define V_CHANNELS 40
-	#define I_CHANNELS 40
-	#define H_CHANNELS 4
-	#define V_BITMAP 5
-	#define I_BITMAP 5
-	#define H_BITMAP 1
-	#define ADC_READINGS_UNTIL_SETTLED 1
-	
-#endif // ___MAIN_WORKFLOW_GLOBAL_VARS
-
-
-//-----------------------------------------------------------------------------
-//   M A I N    ---   M A I N    ---   M A I N    ---   M A I N    ---  M A I N    
-//-----------------------------------------------------------------------------
-int main(void)
-{
-
-	app_init();		  // Setup: Watchdog and I/Os
-	usart_init();
-	spi_init(); 		// Initialize SPI interface as master
-	
-// TIMER2 is used as local clock:
-// configure timer 2
-	TCCR2 = (1<<WGM21); // CTC Modus
-	TCCR2 |= (1<<CS21) | (1<<CS20); // Prescaler 64 --> counts up every 8us
-	OCR2 = 125-1; 					// --> output compare interrupt occurs every 125 x 8us = 1ms
-	// Compare Interrupt erlauben
-	TIMSK |= (1<<OCIE2);
-
-  //  Enable interrupts
-  sei();              
-
-	usart_write_str((pU08)"Start of test firmware (06.05.11) now:\n");
-	if (local_ms % 10000 == 0) {
-		usart_write_str((pU08)"time: ");
-		usart_write_U32(local_ms/1000,6);
-		usart_write_str((pU08)"sec.\n");
-	}
-	
-	PORTB &= ~(1<<PB2); //#reset = LOW --> W5100 is in reset ... 
-	_delay_ms(50); //reset
-	
-	PORTB |= 1<<PB2; //#reset = HIGH --> W5100 is active
-	_delay_ms(5);		// give it 5ms to accomodate.
-/*	
-	PORTB |= (1<<PB4);
-	usart_write_str((pU08)"PB4 switched HIGH. Please check & hit ENTER.\n");
-	while(!enter_received){
-		if ( UCSRA & (1<<RXC) ) {
-			if (UDR == '\n')
-				enter_received = true;
-		}
-	}
-	enter_received = false;
-*/
-
-	usart_write_str((pU08)"W5300 init begins at:");
-	usart_write_U32(local_ms,10);
-	usart_write_str((pU08)"ms.\n");
-	
-	w5100_init();
- 
-	usart_write_str((pU08)"W5300 init finished at:");
-	usart_write_U32(local_ms,10);
-	usart_write_str((pU08)"ms.\n");
-
-	usart_write_str((pU08)"Wait for PC to connect to FSC...");
-	while (!w5100_is_established()) {
-		usart_write_str((pU08)"Socket status is:");
-		usart_write_U08_hex(w5100_sock_status());
-		usart_write_char('\n');
-		_delay_ms(333);
-	}
-	
-	usart_write_str((pU08)"connection to PC established at:");
-	usart_write_U32(local_ms/1000,6);
-	usart_write_str((pU08)"sec.\n");
-	
-	usart_write_str((pU08)"Ready to investigate, what's happening next? - HIT ENTER - \n");
- 	while(!usart_rx_ready){
-		_delay_ms(10);
-	}
-	usart_rx_ready = false;
-	
-	
-	usart_write_str((pU08)"S0_TX_FSR\t|S0_TX_RD\t|S0_TX_WR\t|S0_RX_RSR\t|S0_RX_RD\t| 0x0426 | 0x0427 |\n");
-	while(!usart_rx_ready){
-		
-		usart_write_U16_hex(get_S0_TX_FSR()); usart_write_char('\t'); usart_write_char('|');
-		usart_write_U16_hex(get_S0_TX_RD()); usart_write_char('\t'); usart_write_char('|');
-		usart_write_U16_hex(get_S0_TX_WR()); usart_write_char('\t'); usart_write_char('|');
-		usart_write_U16_hex(get_S0_RX_RSR()); usart_write_char('\t'); usart_write_char('|');
-		usart_write_U16_hex(get_S0_RX_RD()); usart_write_char('\t'); usart_write_char('|');
-		usart_write_U08_hex( w5100_read(0x0426) ); usart_write_char('\t'); usart_write_char('|');
-		usart_write_U08_hex( w5100_read(0x0427) ); usart_write_char('\t'); usart_write_char('|');
-		
-		usart_write_char('\n');
-
-		_delay_ms(400);
-		_delay_ms(400);
-	}
-	usart_rx_ready = false;
-
-	U16 received_bytes;
-	U08 really_downloaded_bytes;
-	while(!usart_rx_ready){
-		received_bytes = get_S0_RX_RSR();
-		
-		usart_write_U16_hex(get_S0_TX_FSR()); usart_write_char('\t'); usart_write_char('|');
-		usart_write_U16_hex(get_S0_TX_RD()); usart_write_char('\t'); usart_write_char('|');
-		usart_write_U16_hex(get_S0_TX_WR()); usart_write_char('\t'); usart_write_char('|');
-		usart_write_U16_hex(get_S0_RX_RSR()); usart_write_char('\t'); usart_write_char('|');
-		usart_write_U16_hex(get_S0_RX_RD()); usart_write_char('\t'); usart_write_char('|');
-		
-	
-		if (get_S0_RX_RSR() != 0) { // we have something to read
-			usart_write_str((pU08)"\nReading ");
-			usart_write_U16(get_S0_RX_RSR(), 6);
-			usart_write_str((pU08)" b from W5100\n");
-		
-			while (received_bytes != 0) {
-				really_downloaded_bytes = w5100_get_RX(16, true);
-				usart_write_char('!');
-				usart_write_U08(really_downloaded_bytes,4);
-				usart_write_char('\n');
-				for (U08 i=0; i<really_downloaded_bytes; i++){
-					usart_write_U08_hex(eth_read_buffer[i]);
-					usart_write_char(' ');
-				}
-				received_bytes -= really_downloaded_bytes;
-			}
-		}
-		usart_write_char('\n');
-		
-		_delay_ms(400);
-		_delay_ms(400);
-		_delay_ms(400);
-		_delay_ms(400);
-	}
-	usart_rx_ready = false;
-	
-	bool quit = false;
-	while (!quit) {
-	usart_write_str((pU08)"Enter the string to send to PC or \"XXX\" in order to quit\n");
-		while(!usart_rx_ready){
-			_delay_ms(100);
-		}
-		usart_rx_ready = false;
-	
-		if ( (usart_rx_buffer[0]=='X') &&  (usart_rx_buffer[1]=='X') && (usart_rx_buffer[2]=='X') )
-			quit = true;
-		else {
-			// copy string to W5100 TX buffer and issue 'SEND' command.
-			for (U08 i =0; i<usart_received_chars; i++){
-				eth_write_buffer[i]=usart_rx_buffer[i];
-			}
-			
-			w5100_set_TX(usart_received_chars);
-			
-		}		
-			
-		
-	}
-	
-} // end of main()	
-	
-/*
-//MAIN LOOP
-while (1)
-{
-	if (heartbeat_enable) PORTB ^= (1<<PB3); // toggle Out2_spare --> heartbeat
-//----------------------------------------------------------------------------
-	//IF we need to send away one byte, and ready to send
-
-	if ( (usart_tx_buffer_index > 0) && (UCSRA & (1<<UDRE)) ) { 
-		UDR = usart_tx_buffer[0];
-		// THis is shit
-		for (U08 i=0 ; i < USART_TX_BUFFER_SIZE; ++i) {
-			usart_tx_buffer[i] = usart_tx_buffer[i+1];
-		}
-		usart_tx_buffer_index--;
-	}
-//----------------------------------------------------------------------------
-
-	//IF we just received one byte, and there is enough space in the RX_buffer
-	if ( (UCSRA & (1<<RXC)) && (usart_rx_buffer_index < USART_RX_BUFFER_SIZE) ){
-		usart_last_char = UDR;
-		if (usart_last_char == '\n'){ // if EOL was received
-			usart_rx_ready = true;
-		}else {
-		usart_rx_buffer[usart_rx_buffer_index] = usart_last_char;
-		usart_rx_buffer_index++;
-		}
-		// here is still something strange .... better send an enter automatically
-	} else if (UCSRA & (1<<RXC)) { // if there is no scace in the buffer; read anyway.
-		usart_last_char = UDR;
-		usart_rx_buffer_index =0;
-	}
-//----------------------------------------------------------------------------
-
-	//IF USART DOR bit is set, PC is sending data to fast!!!
-	if ( UCSRA & (1<<DOR) ){
-		// flush TX_buffer and write warning message in
-		// maybe even switch off every measurement. ?
-	}
-//----------------------------------------------------------------------------
-
-	//IF TX_BUFFER was overrun.	
-	if (usart_tx_buffer_overflow) {
-		// flash TX_buffer and write warning message in
-		// maybe even switch off every measurement. ?
-		//
-		// this should only happen, in verbose mode and with low baudrates.
-	}
-//----------------------------------------------------------------------------
-	
-	//IF one command was received. 
-	//	-It is not allowed to send more than one command between two '\n'
-	if (usart_rx_ready){ 
-		parse();
-		usart_rx_buffer_index = 0;
-		usart_rx_ready = false;
-	}
-//----------------------------------------------------------------------------
-
-	//IF ATmega internal ADC did finish a conversion --every 200us
-	if ( (ADCSRA & (1<<ADIF)) && !adc_measured_all) {
-		adc_current_reading = ADCH;
-		if (adc_readings_since_last_muxing == ADC_READINGS_UNTIL_SETTLED) {
-			adc_values[adc_current_channel] = adc_current_reading;
-			adc_readings_since_last_muxing=0;
-			// note that this channel is ready, now and 
-			adc_output(adc_current_channel, adc_current_reading);
-			// proceed to the next enabled channel.
-			adc_channels_ready[adc_current_channel/8] |= (1<<(adc_current_channel%8));
-			adc_current_channel = increase_adc (adc_current_channel);
-			Set_V_Muxer(adc_current_channel);
-		} else { // the ADC did not settle yet, we discard the reading
-			++adc_readings_since_last_muxing;
-			// current reading is not used for anything else
-		}
-	}
-//----------------------------------------------------------------------------
-
-	//IF AD7719 ADC just finished a conversion -- every 60ms
-	
-	if (AD7719_IS_READY()) {
-			ad7719_current_reading = read_adc(); // --takes at 4MHz SCLK speed about 6us
-		// AD7719 is only read out if settled. saves time.	
-		if (ad7719_readings_since_last_muxing == AD7719_READINGS_UNTIL_SETTLED) {
-			ad7719_values[ad7719_current_channel] = ad7719_current_reading;
-			ad7719_readings_since_last_muxing=0;
-			// now prepare the data to be send away via USART.
-			//ad7719_output(ad7719_current_channel, ad7719_current_reading);
-			// note that this channel is ready, now and 
-			// proceed to the next enabled channel.
-			ad7719_channels_ready[ad7719_current_channel/8] |= (1<<(ad7719_current_channel%8));
-			ad7719_current_channel = increase_ad7719 (ad7719_current_channel);
-			Set_T_Muxer(ad7719_current_channel);
-		} else { // the AD7719 did not settle yet, we discard the reading
-			++ad7719_readings_since_last_muxing;
-
-			// current reading is not used for anything else
-		}
-	}
-//----------------------------------------------------------------------------
-	//IF one of the ADC measured all channels, we wanted to know.
-	check_if_measured_all();
-	
-	if (ad7719_measured_all && adc_measured_all)
-		adc_output_all();
-
-//----------------------------------------------------------------------------
-
-//	if (verbose == true)
-		// talk() was just defined so the 
-		// code is not at this place ... look down.
-//		talk();
-
-
-} // end of MAIN LOOP
-//-----------------------------------------------------------------------------
-//    E N D     E N D     E N D     E N D     E N D     E N D     E N D     
-//-----------------------------------------------------------------------------
-
-*/
-
-/*
-
-ISR (TIMER2_COMP_vect)
-{
- ++local_ms;
-}
-
-
-
-
-*/
Index: firmware/FSC/src/FSC_test_electrical_connection.c
===================================================================
--- firmware/FSC/src/FSC_test_electrical_connection.c	(revision 17625)
+++ 	(revision )
@@ -1,299 +1,0 @@
-//-----------------------------------------------------------------------------
-#include "typedefs.h"
-#include "application.h"
-#include "spi_master.h"
-#include "ad7719_adc.h"
-#include "atmega_adc.h"    
-#include "usart.h"
-#include "macros.h"
-#include "muxer_fsc.h"
-#include "output.h"
-#include "parser.h"
-#include "interpol.h"
-#include "w5100_spi_interface.h"
-#include <avr/interrupt.h>
-#include <avr/wdt.h>
-#include <stdlib.h>
-//-----------------------------------------------------------------------------
-// definition of some functions:
-// these function are implemented in this file, this is not doog coding style.
-// sooner or later, they will be moved into more apropriate files.
-
-void parse(); //doesn't do anything at the moment
-
-// end of function definition:
-//-----------------------------------------------------------------------------
-
-
-// MAIN WORKFLOW GLOBAL VARIABLES
-	bool verbose;
-	bool heartbeat_enable;
-
-// USART global variables
-	U08 usart_rx_buffer[USART_RX_BUFFER_SIZE];
-	U08 usart_tx_buffer[USART_TX_BUFFER_SIZE];
-	U08 usart_rx_buffer_index = 0;
-	U08 usart_tx_buffer_index = 0;
-  	U08 usart_last_char; 					// last received char
-
-// USART FLAGS
-	bool usart_tx_buffer_overflow = false;	// true if usart_tx_buffer was full.
-	//bool usart_rx_ready = false;			// EOL was received, parser needs to be called
-	
-// TIMER global variable
-	volatile U32 local_ms = 0;
-
-// AD7719 global variables
-	U32 ad7719_values[TEMP_CHANNELS];
-	U08 ad7719_enables[CHANNEL_BITMAP];
-	U08 ad7719_channels_ready[CHANNEL_BITMAP];
-	U08 ad7719_readings_since_last_muxing = 0;
-	U08 ad7719_current_channel = 0;
-	U32 ad7719_current_reading = 0;
-	bool ad7719_measured_all = false;
-	
-// ATMEGA ADC global variables
-	U08 adc_values[V_CHANNELS + I_CHANNELS + H_CHANNELS]; // stores measured voltage in steps of 16mV
-	U08 adc_enables[V_BITMAP + I_BITMAP + H_BITMAP];
-	U08 adc_channels_ready[V_BITMAP + I_BITMAP + H_BITMAP];
-	U08 adc_readings_since_last_muxing = 0;
-	U08 adc_current_channel = 0;
-	U08 adc_current_reading = 0;
-	bool adc_measured_all = false;
-
-	bool once_told_you = true;
-	bool debug_mode = false;
-	
-#ifndef ___MAIN_WORKFLOW_GLOBAL_VARS
-#define ___MAIN_WORKFLOW_GLOBAL_VARS	
-	#define TEMP_CHANNELS 64
-	#define CHANNEL_BITMAP 8
-	#define AD7719_READINGS_UNTIL_SETTLED 1 // bei3:480ms
-	#define V_CHANNELS 40
-	#define I_CHANNELS 40
-	#define H_CHANNELS 4
-	#define V_BITMAP 5
-	#define I_BITMAP 5
-	#define H_BITMAP 1
-	#define ADC_READINGS_UNTIL_SETTLED 1
-	
-#endif // ___MAIN_WORKFLOW_GLOBAL_VARS
-
-
-//-----------------------------------------------------------------------------
-//   M A I N    ---   M A I N    ---   M A I N    ---   M A I N    ---  M A I N    
-//-----------------------------------------------------------------------------
-int main(void)
-{
-	U08 register_content;
-
-	app_init();		  // Setup: Watchdog and I/Os
-	usart_init();
-
-	spi_init(); 		// Initialize SPI interface as master
-	
-// TIMER2 is used as local clock:
-// configure timer 2
-	TCCR2 = (1<<WGM21); // CTC Modus
-	TCCR2 |= (1<<CS21) | (1<<CS20); // Prescaler 64 --> counts up every 8us
-	OCR2 = 125-1; 					// --> output compare interrupt occurs every 125 x 8us = 1ms
-	// Compare Interrupt erlauben
-	TIMSK |= (1<<OCIE2);
-
-  //  Enable interrupts
-  sei();              
-
-	usart_write_str((pU08)"Start of test firmware (06.05.11) now:\n");
-	if (local_ms % 10000 == 0) {
-		usart_write_str((pU08)"time: ");
-		usart_write_U32(local_ms/1000,6);
-		usart_write_str((pU08)"sec.\n");
-	}
-
-  PORTB &= ~(1<<PB2); //#reset = LOW --> W5100 is in reset ... 
-	_delay_ms(50); //reset
-	
-	PORTB |= 1<<PB2; //#reset = HIGH --> W5100 is active
-	_delay_ms(5);		// give it 5ms to accomodate.
-	
-	
-//	DDRB |= (1 << PB2);  // setze 5tes bit im data direction register von port B
-//	DDRB |= (1 << PB3);  // setze 5tes bit im data direction register von port B
-//	DDRB |= (1 << PB4);  // setze 5tes bit im data direction register von port B
-	
-	while (1)
-	{ 
-		PORTB ^= (1<<PB4);  // toggle zustand vom 5ten bit in Port B
-		PORTB ^= (1<<PB3);  // toggle zustand vom 5ten bit in Port B
-		PORTB ^= (1<<PB2);  // toggle zustand vom 5ten bit in Port B
-		
-	_delay_ms(1); //reset
-		
-	}
-	
-	
-	while (1) {
-	usart_write_str((pU08)"Start to read from W5300 CM_RTR0 register at:");
-	usart_write_U32(local_ms,10);
-	usart_write_str((pU08)"ms.\n");
-	
-	register_content = w5100_read(CM_RTR0); // read something
-	
-	usart_write_str((pU08)"register content of CM_RTR0 retrieved at:");
-	usart_write_U32(local_ms,10);
-	usart_write_str((pU08)"ms.\t");
-	usart_write_str((pU08)"register content is: 0x");
-	usart_write_U08_hex(register_content);
-	usart_write_str((pU08)"\n");
-	
-	
-	_delay_ms(400); //reset
-	_delay_ms(400); //reset
-	_delay_ms(400); //reset
-}
-	
-	
-	usart_write_str((pU08)"W5300 init begins at:");
-	usart_write_U32(local_ms,10);
-	usart_write_str((pU08)"ms.\n");
-	
-	w5100_init();
- 
- 
- 
- 
-
-	
-} // end of main()	
-	
-/*
-//MAIN LOOP
-while (1)
-{
-	if (heartbeat_enable) PORTB ^= (1<<PB3); // toggle Out2_spare --> heartbeat
-//----------------------------------------------------------------------------
-	//IF we need to send away one byte, and ready to send
-
-	if ( (usart_tx_buffer_index > 0) && (UCSRA & (1<<UDRE)) ) { 
-		UDR = usart_tx_buffer[0];
-		// THis is shit
-		for (U08 i=0 ; i < USART_TX_BUFFER_SIZE; ++i) {
-			usart_tx_buffer[i] = usart_tx_buffer[i+1];
-		}
-		usart_tx_buffer_index--;
-	}
-//----------------------------------------------------------------------------
-
-	//IF we just received one byte, and there is enough space in the RX_buffer
-	if ( (UCSRA & (1<<RXC)) && (usart_rx_buffer_index < USART_RX_BUFFER_SIZE) ){
-		usart_last_char = UDR;
-		if (usart_last_char == '\n'){ // if EOL was received
-			usart_rx_ready = true;
-		}else {
-		usart_rx_buffer[usart_rx_buffer_index] = usart_last_char;
-		usart_rx_buffer_index++;
-		}
-		// here is still something strange .... better send an enter automatically
-	} else if (UCSRA & (1<<RXC)) { // if there is no scace in the buffer; read anyway.
-		usart_last_char = UDR;
-		usart_rx_buffer_index =0;
-	}
-//----------------------------------------------------------------------------
-
-	//IF USART DOR bit is set, PC is sending data to fast!!!
-	if ( UCSRA & (1<<DOR) ){
-		// flush TX_buffer and write warning message in
-		// maybe even switch off every measurement. ?
-	}
-//----------------------------------------------------------------------------
-
-	//IF TX_BUFFER was overrun.	
-	if (usart_tx_buffer_overflow) {
-		// flash TX_buffer and write warning message in
-		// maybe even switch off every measurement. ?
-		//
-		// this should only happen, in verbose mode and with low baudrates.
-	}
-//----------------------------------------------------------------------------
-	
-	//IF one command was received. 
-	//	-It is not allowed to send more than one command between two '\n'
-	if (usart_rx_ready){ 
-		parse();
-		usart_rx_buffer_index = 0;
-		usart_rx_ready = false;
-	}
-//----------------------------------------------------------------------------
-
-	//IF ATmega internal ADC did finish a conversion --every 200us
-	if ( (ADCSRA & (1<<ADIF)) && !adc_measured_all) {
-		adc_current_reading = ADCH;
-		if (adc_readings_since_last_muxing == ADC_READINGS_UNTIL_SETTLED) {
-			adc_values[adc_current_channel] = adc_current_reading;
-			adc_readings_since_last_muxing=0;
-			// note that this channel is ready, now and 
-			adc_output(adc_current_channel, adc_current_reading);
-			// proceed to the next enabled channel.
-			adc_channels_ready[adc_current_channel/8] |= (1<<(adc_current_channel%8));
-			adc_current_channel = increase_adc (adc_current_channel);
-			Set_V_Muxer(adc_current_channel);
-		} else { // the ADC did not settle yet, we discard the reading
-			++adc_readings_since_last_muxing;
-			// current reading is not used for anything else
-		}
-	}
-//----------------------------------------------------------------------------
-
-	//IF AD7719 ADC just finished a conversion -- every 60ms
-	
-	if (AD7719_IS_READY()) {
-			ad7719_current_reading = read_adc(); // --takes at 4MHz SCLK speed about 6us
-		// AD7719 is only read out if settled. saves time.	
-		if (ad7719_readings_since_last_muxing == AD7719_READINGS_UNTIL_SETTLED) {
-			ad7719_values[ad7719_current_channel] = ad7719_current_reading;
-			ad7719_readings_since_last_muxing=0;
-			// now prepare the data to be send away via USART.
-			//ad7719_output(ad7719_current_channel, ad7719_current_reading);
-			// note that this channel is ready, now and 
-			// proceed to the next enabled channel.
-			ad7719_channels_ready[ad7719_current_channel/8] |= (1<<(ad7719_current_channel%8));
-			ad7719_current_channel = increase_ad7719 (ad7719_current_channel);
-			Set_T_Muxer(ad7719_current_channel);
-		} else { // the AD7719 did not settle yet, we discard the reading
-			++ad7719_readings_since_last_muxing;
-
-			// current reading is not used for anything else
-		}
-	}
-//----------------------------------------------------------------------------
-	//IF one of the ADC measured all channels, we wanted to know.
-	check_if_measured_all();
-	
-	if (ad7719_measured_all && adc_measured_all)
-		adc_output_all();
-
-//----------------------------------------------------------------------------
-
-//	if (verbose == true)
-		// talk() was just defined so the 
-		// code is not at this place ... look down.
-//		talk();
-
-
-} // end of MAIN LOOP
-//-----------------------------------------------------------------------------
-//    E N D     E N D     E N D     E N D     E N D     E N D     E N D     
-//-----------------------------------------------------------------------------
-
-*/
-
-
-
-ISR (TIMER2_COMP_vect)
-{
- ++local_ms;
-}
-
-
-
-
Index: firmware/FSC/src/interpol.c
===================================================================
--- firmware/FSC/src/interpol.c	(revision 17625)
+++ 	(revision )
@@ -1,518 +1,0 @@
-//-----------------------------------------------------------------------------
-
-#include "interpol.h"
-#include "usart.h"
-#include "ad7719_adc.h" 
-//#include "typedefs.h"
-//#include "application.h"
-#include "num_conversion.h"
-#include "math.h"
-//-----------------------------------------------------------------------------
-/*
-Temperatur Sensoren von IST nach DIN60751, Kl.B 
-Messfehler +/- 0.30+0.005*|t|
-
-R(t) = R0(1 + At + Bt^2 + C(t-100)t^3)  t = [-200, 0]°C
-R(t) = R0(1 + At + Bt^2)				t = [0, 850]°C
-
-A = 3.9083*10^-3[°C^-1]
-B = -5.775*10^-7[°C^-2]
-C = -4.183*10^-12[°C^-4]
-
-Strom durch R ist konstant 400uA
-Intervallweise lineare Interpolation der Funktion R(t) mit MATLAB polyfit
-adcword = 13107200 * u(temperatur)
-*/
- U08 space_STR[] = "  |";
- U08 OoR_STR[] = "  OoR  |";
-
-
-
- float gettemp(void)
- {
-
-  
-  U8  temprange = 17;
-  U32 adcword=0;
-  float temp=-3.14; // should be initialized in a proper way, but I dont know how :-)
-  const U32 min = 0x404054;
-  const U32 max = 0x8CAF50;
-  const U32 s	= 0x4C6F0;		//(max-min)/16 = s(lice)
-  	
-  adcword = read_adc();
-
- if  (adcword >= (min + 8*s))
-   {
-     if  (adcword >= (min + 12*s))
-	   {
-	     if  (adcword >= (min + 14*s))
-		   {
-			 if   (adcword >= (min + 15*s)) 
-			   { 
-			     if (adcword < max)
-				   {
-		            temprange = 16;
-				   }
-			   }
-			 else
-			   {
-				 temprange = 15;
-			   }
-		   }
-		 else
-		   {
-		      if  (adcword >= (min + 13*s))
-			    {
-				  temprange = 14;
-				}
-			  else
-			    {
-				  temprange = 13;
-				}
-		   }   
-	   }
-	 else
-	   {
-	     if  (adcword >= (min + 10*s))
-		   {
-			 if  (adcword >= (min + 11*s))
-			   {
-				 temprange = 12;
-			   }
-			 else
-			   {
-				 temprange = 11;
-			   }
-		   }
-		 else
-		   {
-		      if  (adcword >= (min + 9*s))
-			    {
-				  temprange = 10;
-				}
-			  else
-			    {
-				  temprange = 9;
-				}
-		   }   
-	   }
-   } 
- else
- {
-     if  (adcword >= (min + 4*s))
-	   {
-	     if  (adcword >= (min + 6*s))
-		   {
-			 if  (adcword >= (min + 7*s))
-			   {
-				 temprange = 8;
-			   }
-			 else
-			   {
-				 temprange = 7;
-			   }
-		   }
-		 else
-		   {
-		      if  (adcword >= (min + 5*s))
-			    {
-				  temprange = 6;
-				}
-			  else
-			    {
-				  temprange = 5;
-				}
-		   }   
-	   }
-	 else
-	   {
-	     if  (adcword >= (min + 2*s))
-		   {
-			 if  (adcword >= (min + 3*s))
-			   {
-				 temprange = 4;
-			   }
-			 else
-			   {
-				 temprange = 3;
-			   }
-		   }
-		 else
-		   {
-		      if  (adcword >= (min + s))
-			    {
-				  temprange = 2;
-				}
-			  else
-			    { 
-				  if  (adcword > min)
-				    {
-				      temprange = 1;
- 					}
-				}
-		   }   
-	   }
-   } 
-
-
- switch (temprange)
-  {
-    case 1:{ // Temp. Range [-50°C , -34.375°C[
-      temp = ((float)adcword / 20764.727846 - 252.7721); 		//20764.727846 - 252.7721
-	  }
-    break;
-
-    case 2:{ // Temp. Range [-34.375°C , -18.75°C[
-      temp = ((float)adcword / 20658.049789 - 253.8995);		//20658.049789 - 253.8995
-	  }
-    break;
-
-    case 3:{ // Temp. Range [-18.75°C , -3.125°C[		
-      temp = ((float)adcword / 20557.997603 - 255.0436);		//20557.997603 - 255.0436
-	  }
-    break;
-
-    case 4:{ // Temp. Range [-3.125°C , 12.5°C]
-      temp = ((float)adcword / 20462.362624 - 256.2209); 		//20462.362624 - 256.2209
-	  }
-    break;
-
-    case 5:{ // Temp. Range [12.5°C , 28.125°C]
-      temp = ((float)adcword / 20367.745024 - 257.4692);		//20367.745024 - 257.4692
-	  }
-    break;
-	
-    case 6:{ // Temp. Range [28.125°C , 43.75°C]
-      temp = ((float)adcword / 20273.127424 - 258.8021);		//20273.127424 - 258.8021
-	  }
-    break;
-	
-    case 7:{ // Temp. Range [43.75°C , 59.375°C]
-      temp = ((float)adcword / 20178.509824 - 260.2208);		//20178.509824 - 260.2208
-	  }
-    break;
-	
-    case 8:{ // Temp. Range [59.375°C , 75°C]
-      temp = ((float)adcword / 20083.892224 - 261.7265);		//20083.892224 - 261.7265
-	  }
-    break;
-	
-    case 9:{ // Temp. Range [75°C , 90.625°C]
-      temp = ((float)adcword / 19989.274624 - 263.3203);		//19989.274624 - 263.3203
-	  }
-    break;
-	
-    case 10:{ // Temp. Range [90.625°C , 106.25°C]
-      temp = ((float)adcword / 19894.657024 - 265.0037);		//19894.657024 - 265.0037
-	  }
-    break;
-	
-    case 11:{ // Temp. Range [106.25°C , 121.875°C]
-      temp = ((float)adcword / 19800.039424 - 266.7778);		//19800.039424 - 266.7778
-	  }
-    break;
-	
-    case 12:{ // Temp. Range [121.875°C , 137.5°C]
-      temp = ((float)adcword / 19705.421824 - 268.6439);		//19705.421824 - 268.6439
-	  }
-    break;
-	
-    case 13:{ // Temp. Range [137.5°C , 153.125°C]
-      temp = ((float)adcword / 19610.804224 - 270.6035);		//19610.804224 - 270.6035
-	  }
-    break;
-	
-    case 14:{ // Temp. Range [153.125°C , 168.75°C]
-      temp = ((float)adcword / 19516.186624 - 272.6578);		//19516.186624 - 272.6578
-	  }
-    break;
-	
-    case 15:{ // Temp. Range [168.75°C , 184.375°C]
-      temp = ((float)adcword / 19421.569024 - 274.8082);		//19421.569024 - 274.8082
-	  }
-    break;
-	
-    case 16:{ // Temp. Range [184.375°C , 200°C]
-      temp = ((float)adcword / 19326.951424 - 277.0562);		//19326.951424 - 277.0562
-	  }
-    break;
-    default:{ // Temp. Range beyond [-50C , 200C]
-	  PORTC = (PORTC | 0x04);
-	  }
-  }// end of switch case statement
-  return temp;
-
- }
-
- void readandsendpress(void)
- {
-  U32 adcword=0;
-  float press;
-
-  adcword = read_adc();
-
- if ( (adcword > 0x253332) && (adcword < 0xF80000) ) // Press. Range is [0Bar , 250Bar]
-   {
-    press = ((float)adcword / (62 * 836.658790402)) - 63.0091; // 62 Ohm
-	usart_write_float(press,2,5);
-	usart_write_flash_str(space_STR);
-   } 
- else
-   {
-	usart_write_flash_str(OoR_STR);  // Press. is beyond [0Bar , 250Bar]
-    PORTC = (PORTC | 0x04);
-   }
-
- }
-
-
-/*
-Temperatur Sensoren von IST nach DIN60751, Kl.B 
-Messfehler +/- 0.30+0.005*|t|
-
-R(t) = R0(1 + At + Bt^2 + C(t-100)t^3)  t = [-200, 0]°C
-R(t) = R0(1 + At + Bt^2)				t = [0, 850]°C
-
-A = 3.9083*10^-3[°C^-1]
-B = -5.775*10^-7[°C^-2]
-C = -4.183*10^-12[°C^-4]
-
-Strom durch R ist konstant 400uA
-Messung ist ratiometrisch bezogen auf Referenzwiderstand an ADC Pin5 (REFIN-) und Pin6 (REFIN+)
-Referenzwiderstand ist ca. 6.28kOhm.
-ADC hat internes gain von 2.
-
-*/
-
-float getresistance(void)
-{
-  
-  U32 adcword=0;
-  float resistance;
-  const float R_REF=6.25; // kilo-ohms	
-  adcword = read_adc();
-  U32 fullscale = 16777215L; //2^24 -1
-  
-  resistance = ((float)adcword / (float)fullscale) /2.0 * R_REF; // divide through 2.0 because of PGA in ADC.
-
-  return resistance; // in kilo-ohms
-}
-
-U32 getadc(void) 
-{
-return read_adc();
-}
-
-
- float calc_temp(U32 adcword)
- {
-  U8  temprange = 17;
-  
-  float temp=NAN;
-  const U32 min = 0x404054;
-  const U32 max = 0x8CAF50;
-  const U32 s	= 0x4C6F0;		//(max-min)/16 = s(lice)
-
- if  (adcword >= (min + 8*s))
-   {
-     if  (adcword >= (min + 12*s))
-	   {
-	     if  (adcword >= (min + 14*s))
-		   {
-			 if   (adcword >= (min + 15*s)) 
-			   { 
-			     if (adcword < max)
-				   {
-		            temprange = 16;
-				   }
-			   }
-			 else
-			   {
-				 temprange = 15;
-			   }
-		   }
-		 else
-		   {
-		      if  (adcword >= (min + 13*s))
-			    {
-				  temprange = 14;
-				}
-			  else
-			    {
-				  temprange = 13;
-				}
-		   }   
-	   }
-	 else
-	   {
-	     if  (adcword >= (min + 10*s))
-		   {
-			 if  (adcword >= (min + 11*s))
-			   {
-				 temprange = 12;
-			   }
-			 else
-			   {
-				 temprange = 11;
-			   }
-		   }
-		 else
-		   {
-		      if  (adcword >= (min + 9*s))
-			    {
-				  temprange = 10;
-				}
-			  else
-			    {
-				  temprange = 9;
-				}
-		   }   
-	   }
-   } 
- else
- {
-     if  (adcword >= (min + 4*s))
-	   {
-	     if  (adcword >= (min + 6*s))
-		   {
-			 if  (adcword >= (min + 7*s))
-			   {
-				 temprange = 8;
-			   }
-			 else
-			   {
-				 temprange = 7;
-			   }
-		   }
-		 else
-		   {
-		      if  (adcword >= (min + 5*s))
-			    {
-				  temprange = 6;
-				}
-			  else
-			    {
-				  temprange = 5;
-				}
-		   }   
-	   }
-	 else
-	   {
-	     if  (adcword >= (min + 2*s))
-		   {
-			 if  (adcword >= (min + 3*s))
-			   {
-				 temprange = 4;
-			   }
-			 else
-			   {
-				 temprange = 3;
-			   }
-		   }
-		 else
-		   {
-		      if  (adcword >= (min + s))
-			    {
-				  temprange = 2;
-				}
-			  else
-			    { 
-				  if  (adcword > min)
-				    {
-				      temprange = 1;
- 					}
-				}
-		   }   
-	   }
-   } 
-
-
- switch (temprange)
-  {
-    case 1:{ // Temp. Range [-50°C , -34.375°C[
-      temp = ((float)adcword / 20764.727846 - 252.7721); 		//20764.727846 - 252.7721
-	  }
-    break;
-
-    case 2:{ // Temp. Range [-34.375°C , -18.75°C[
-      temp = ((float)adcword / 20658.049789 - 253.8995);		//20658.049789 - 253.8995
-	  }
-    break;
-
-    case 3:{ // Temp. Range [-18.75°C , -3.125°C[		
-      temp = ((float)adcword / 20557.997603 - 255.0436);		//20557.997603 - 255.0436
-	  }
-    break;
-
-    case 4:{ // Temp. Range [-3.125°C , 12.5°C]
-      temp = ((float)adcword / 20462.362624 - 256.2209); 		//20462.362624 - 256.2209
-	  }
-    break;
-
-    case 5:{ // Temp. Range [12.5°C , 28.125°C]
-      temp = ((float)adcword / 20367.745024 - 257.4692);		//20367.745024 - 257.4692
-	  }
-    break;
-	
-    case 6:{ // Temp. Range [28.125°C , 43.75°C]
-      temp = ((float)adcword / 20273.127424 - 258.8021);		//20273.127424 - 258.8021
-	  }
-    break;
-	
-    case 7:{ // Temp. Range [43.75°C , 59.375°C]
-      temp = ((float)adcword / 20178.509824 - 260.2208);		//20178.509824 - 260.2208
-	  }
-    break;
-	
-    case 8:{ // Temp. Range [59.375°C , 75°C]
-      temp = ((float)adcword / 20083.892224 - 261.7265);		//20083.892224 - 261.7265
-	  }
-    break;
-	
-    case 9:{ // Temp. Range [75°C , 90.625°C]
-      temp = ((float)adcword / 19989.274624 - 263.3203);		//19989.274624 - 263.3203
-	  }
-    break;
-	
-    case 10:{ // Temp. Range [90.625°C , 106.25°C]
-      temp = ((float)adcword / 19894.657024 - 265.0037);		//19894.657024 - 265.0037
-	  }
-    break;
-	
-    case 11:{ // Temp. Range [106.25°C , 121.875°C]
-      temp = ((float)adcword / 19800.039424 - 266.7778);		//19800.039424 - 266.7778
-	  }
-    break;
-	
-    case 12:{ // Temp. Range [121.875°C , 137.5°C]
-      temp = ((float)adcword / 19705.421824 - 268.6439);		//19705.421824 - 268.6439
-	  }
-    break;
-	
-    case 13:{ // Temp. Range [137.5°C , 153.125°C]
-      temp = ((float)adcword / 19610.804224 - 270.6035);		//19610.804224 - 270.6035
-	  }
-    break;
-	
-    case 14:{ // Temp. Range [153.125°C , 168.75°C]
-      temp = ((float)adcword / 19516.186624 - 272.6578);		//19516.186624 - 272.6578
-	  }
-    break;
-	
-    case 15:{ // Temp. Range [168.75°C , 184.375°C]
-      temp = ((float)adcword / 19421.569024 - 274.8082);		//19421.569024 - 274.8082
-	  }
-    break;
-	
-    case 16:{ // Temp. Range [184.375°C , 200°C]
-      temp = ((float)adcword / 19326.951424 - 277.0562);		//19326.951424 - 277.0562
-	  }
-    break;
-    default:
-		break;
-  }// end of switch case statement
-  return temp;
-
- }
-
-
Index: firmware/FSC/src/interpol.h
===================================================================
--- firmware/FSC/src/interpol.h	(revision 17625)
+++ 	(revision )
@@ -1,19 +1,0 @@
-#ifndef __INTERPOL_H
-#define __INTERPOL_H
-//-----------------------------------------------------------------------------
-
-#include "typedefs.h"
-#include "application.h"
-#include "num_conversion.h"
-//-----------------------------------------------------------------------------
-
-// function prototype
-
-
- float gettemp(void);
- void readandsendpress(void);
- float getresistance(void);
- U32 getadc(void);
- float calc_temp(U32 adcword);
-//-----------------------------------------------------------------------------
-#endif
Index: firmware/FSC/src/num_conversion.c
===================================================================
--- firmware/FSC/src/num_conversion.c	(revision 17625)
+++ 	(revision )
@@ -1,378 +1,0 @@
-//-----------------------------------------------------------------------------
-
-#include "num_conversion.h"
-#include "math.h"
-//-----------------------------------------------------------------------------
-
-//__flash U08 NC_HEX_ARRAY[] = "0123456789ABCDEF";
-U08 NC_HEX_ARRAY[] = "0123456789ABCDEF";
-//-----------------------------------------------------------------------------
-
-U08 nc_buffer[NC_BUFFER_LENGTH]; // Conversion buffer
-U08 nc_format_buffer[NC_BUFFER_LENGTH]; // Format buffer
-
-static U08 nc_int_digits[8];
-static U08 nc_dec_digits[6];
-//-----------------------------------------------------------------------------
-
-pU08 nc_format(pU08 source_ptr,U08 digits)
-{
-  U08 len = strlen((const char *)source_ptr);
-  pU08 dest_ptr = (pU08)nc_format_buffer;
-
-  // Fillup loop
-  while (digits-- > len)
-  {
-    *dest_ptr++ = NC_FILL_CHAR;
-  }
-
-  // Copy loop
-  while (len--)
-  {
-    *dest_ptr++ = *source_ptr++;
-  }
-
-  *dest_ptr = 0; // Terminate format string
-
-  return (pU08)nc_format_buffer;
-}
-//-----------------------------------------------------------------------------
-
-pU08 nc_U08_to_str(U08 value,U08 digits)
-{
-  pU08 pstr = nc_buffer;
-
-  if (value >= 100) *pstr++ = ('0' + (value % 1000 / 100));
-  if (value >= 10) *pstr++ = ('0' + (value % 100 / 10));
-  *pstr++ = ('0' + (value % 10));
-  *pstr = 0;
-
-  if (!digits) // If digits = 0, then return buffer start
-  {
-    return nc_buffer;
-  }
-  else // Do formatted output
-  {
-    return nc_format(nc_buffer,digits);
-  }
-}
-//-----------------------------------------------------------------------------
-
-pU08 nc_S08_to_str(S08 signed_value,U08 digits)
-{
-  pU08 pstr = nc_buffer;
-  U08 value;
-
-  if (signed_value < 0)
-  {
-    *pstr++ = '-';
-    value = -signed_value;
-  }
-  else
-  {
-    value = signed_value;
-  }
-
-  if (value >= 100) *pstr++ = ('0' + (value % 1000 / 100));
-  if (value >= 10) *pstr++ = ('0' + (value % 100 / 10));
-  *pstr++ = ('0' + (value % 10));
-  *pstr = 0;
-
-  if (!digits) // If digits = 0, then return buffer start
-  {
-    return nc_buffer;
-  }
-  else // Do formatted output
-  {
-    return nc_format(nc_buffer,digits);
-  }
-}
-//-----------------------------------------------------------------------------
-
-pU08 nc_U08_to_hex(U08 value)
-{
-  pU08 pstr = nc_buffer;
-
-  *pstr++ = NC_HEX_ARRAY[value >> 4];
-  *pstr++ = NC_HEX_ARRAY[value & 0x0F];
-  *pstr = 0;
-
-  return (nc_buffer);
-}
-//-----------------------------------------------------------------------------
-
-pU08 nc_U08_to_bin(U08 value)
-{
-  pU08 pstr = nc_buffer;
-  U08 n;
-
-  for (n = 7; n < 8; n--)
-  {
-    if (value & (1 << n))
-    {
-      *pstr++ = '1';
-    }
-    else
-    {
-      *pstr++ = '0';
-    }
-  }
-
-  *pstr = 0;
-
-  return (nc_buffer);
-}
-//-----------------------------------------------------------------------------
-
-pU08 nc_U16_to_str(U16 value,U08 digits)
-{
-  pU08 pstr = nc_buffer;
-
-  if (value >= 10000) *pstr++ = ('0' + (value / 10000));
-  if (value >= 1000) *pstr++ = ('0' + (value % 10000 / 1000));
-  if (value >= 100) *pstr++ = ('0' + (value % 1000 / 100));
-  if (value >= 10)*pstr++ = ('0' + (value % 100 / 10));
-  *pstr++ = ('0' + (value % 10));
-  *pstr = 0;
-
-  if (!digits) // If digits = 0, then return buffer start
-  {
-    return nc_buffer;
-  }
-  else // Do formatted output
-  {
-    return nc_format(nc_buffer,digits);
-  }
-}
-//-----------------------------------------------------------------------------
-
-pU08 nc_S16_to_str(S16 signed_value,U08 digits)
-{
-  pU08 pstr = nc_buffer;
-  U16 value;
-
-  if (signed_value < 0)
-  {
-    *pstr++ = '-';
-    value = -signed_value;
-  }
-  else
-  {
-    value = signed_value;
-  }
-
-  if (value >= 10000) *pstr++ = ('0' + (value / 10000));
-  if (value >= 1000) *pstr++ = ('0' + (value % 10000 / 1000));
-  if (value >= 100) *pstr++ = ('0' + (value % 1000 / 100));
-  if (value >= 10) *pstr++ = ('0' + (value % 100 / 10));
-  *pstr++ = ('0' + (value % 10));
-  *pstr = 0;
-
-  if (!digits) // If digits = 0, then return buffer start
-  {
-    return nc_buffer;
-  }
-  else // Do formatted output
-  {
-    return nc_format(nc_buffer,digits);
-  }
-}
-//-----------------------------------------------------------------------------
-
-pU08 nc_U16_to_hex(U16 value)
-{
-  pU08 pstr = nc_buffer;
-  tMEM16 data;
-
-  data.word = value;
-
-  *pstr++ = NC_HEX_ARRAY[(data.byte[1]) >> 4];
-  *pstr++ = NC_HEX_ARRAY[(data.byte[1]) & 0x0F];
-
-  *pstr++ = NC_HEX_ARRAY[(data.byte[0]) >> 4];
-  *pstr++ = NC_HEX_ARRAY[(data.byte[0]) & 0x0F];
-
-  *pstr = 0;
-
-  return (nc_buffer);
-}
-//-----------------------------------------------------------------------------
-
-pU08 nc_U32_to_str(U32 value,U08 digits)
-{
-  pU08 pstr = nc_buffer;
-
-  if (value >= 1000000000) *pstr++ = ('0' + (value / 1000000000));
-  if (value >= 100000000) *pstr++ = ('0' + (value % 1000000000 / 100000000));
-  if (value >= 10000000) *pstr++ = ('0' + (value % 100000000 / 10000000));
-  if (value >= 1000000) *pstr++ = ('0' + (value % 10000000 / 1000000));
-  if (value >= 100000) *pstr++ = ('0' + (value % 1000000 / 100000));
-  if (value >= 10000) *pstr++ = ('0' + (value % 100000 / 10000));
-  if (value >= 1000) *pstr++ = ('0' + (value % 10000 / 1000));
-  if (value >= 100) *pstr++ = ('0' + (value % 1000 / 100));
-  if (value >= 10) *pstr++ = ('0' + (value % 100 / 10));
-
-  *pstr++ = ('0' + (value % 10));
-  *pstr = 0;
-
-  if (!digits) // If digits = 0, then return buffer start
-  {
-    return nc_buffer;
-  }
-  else // Do formatted output
-  {
-    return nc_format(nc_buffer,digits);
-  }
-}
-//-----------------------------------------------------------------------------
-
-pU08 nc_S32_to_str(S32 signed_value,U08 digits)
-{
-  pU08 pstr = nc_buffer;
-  U32 value;
-
-  if (signed_value < 0)
-  {
-    *pstr++ = '-';
-    value = -signed_value;
-  }
-  else
-  {
-    value = signed_value;
-  }
-
-  if (value >= 1000000000) *pstr++ = ('0' + (value / 1000000000));
-  if (value >= 100000000) *pstr++ = ('0' + (value % 1000000000 / 100000000));
-  if (value >= 10000000) *pstr++ = ('0' + (value % 100000000 / 10000000));
-  if (value >= 1000000) *pstr++ = ('0' + (value % 10000000 / 1000000));
-  if (value >= 100000) *pstr++ = ('0' + (value % 1000000 / 100000));
-  if (value >= 10000) *pstr++ = ('0' + (value % 100000 / 10000));
-  if (value >= 1000) *pstr++ = ('0' + (value % 10000 / 1000));
-  if (value >= 100) *pstr++ = ('0' + (value % 1000 / 100));
-  if (value >= 10) *pstr++ = ('0' + (value % 100 / 10));
-
-  *pstr++ = ('0' + (value % 10));
-  *pstr = 0;
-
-  if (!digits) // If digits = 0, then return buffer start
-  {
-    return nc_buffer;
-  }
-  else // Do formatted output
-  {
-    return nc_format(nc_buffer,digits);
-  }
-}
-//-----------------------------------------------------------------------------
-
-pU08 nc_U32_to_hex(U32 value)
-{
-  pU08 pstr = nc_buffer;
-  tMEM32 data;
-
-  data.dword = value;
-
-  *pstr++ = NC_HEX_ARRAY[(data.byte[3]) >> 4];
-  *pstr++ = NC_HEX_ARRAY[(data.byte[3]) & 0x0F];
-
-  *pstr++ = NC_HEX_ARRAY[(data.byte[2]) >> 4];
-  *pstr++ = NC_HEX_ARRAY[(data.byte[2]) & 0x0F];
-
-  *pstr++ = NC_HEX_ARRAY[(data.byte[1]) >> 4];
-  *pstr++ = NC_HEX_ARRAY[(data.byte[1]) & 0x0F];
-
-  *pstr++ = NC_HEX_ARRAY[(data.byte[0]) >> 4];
-  *pstr++ = NC_HEX_ARRAY[(data.byte[0]) & 0x0F];
-
-  *pstr = 0;
-
-  return (nc_buffer);
-}
-//-----------------------------------------------------------------------------
-
-pU08 nc_float_to_str(float value,U08 decimals,U08 digits)
-{
-  S08 n;
-  U08 int_count;
-  U08 dec_count;
-  float dec_part;
-  U32 int_part;
-  pU08 pstr = nc_buffer;
-
-  if (decimals > 5)
-  {
-    decimals = 5;
-  }
-
-	if (isnan(value)){
-		pstr[0]=pstr[2]='n';
-		pstr[1]='a';
-		pstr[3]=0;
-		return nc_buffer;
-	}
-  if (value < 0.0)
-  {
-    *pstr++ = '-';
-    value = -value;
-  }
-
-  int_part = value;
-  dec_part = value - int_part;
-  int_count = 0;
-  dec_count = 0;
-
-  if (int_part == 0)
-  {
-    *pstr++ = '0';
-  }
-
-  while (int_part > 0)
-  {
-    nc_int_digits[int_count] = int_part % 10;
-    int_part = int_part - nc_int_digits[int_count];
-
-    if (int_part > 0)
-    {
-      int_part = int_part / 10;
-    }
-
-    int_count++; // go to the next digit
-  }
-
-  while (dec_count < decimals)
-  {
-    dec_part = dec_part * 10.0;
-    nc_dec_digits[dec_count] = dec_part;
-
-    if (nc_dec_digits[dec_count] > 0)
-    {
-      dec_part = dec_part - nc_dec_digits[dec_count];
-    }
-
-    dec_count++;
-  }
-
-  for (n = int_count - 1; n > -1; n--)
-  {
-    *pstr++ = 48 + nc_int_digits[n];
-  }
-
-  *pstr++ = '.';
-
-  for (n = 0; n < dec_count; n++)
-  {
-    *pstr++ = 48 + nc_dec_digits[n];
-  }
-
-  // Terminate string
-  *pstr = 0;
-
-  if (!digits) // If digits = 0, then return buffer start
-  {
-    return nc_buffer;
-  }
-  else // Do formatted output
-  {
-    return nc_format(nc_buffer,digits);
-  }
-}
Index: firmware/FSC/src/num_conversion.h
===================================================================
--- firmware/FSC/src/num_conversion.h	(revision 17625)
+++ 	(revision )
@@ -1,29 +1,0 @@
-#ifndef __NUM_CONVERSION_H
-#define __NUM_CONVERSION_H
-//-----------------------------------------------------------------------------
-
-#include "typedefs.h"
-//-----------------------------------------------------------------------------
-
-#define NC_BUFFER_LENGTH 16 // Conversion buffer size
-#define NC_FILL_CHAR 32 // Character for post digits
-//-----------------------------------------------------------------------------
-
-extern U08 nc_buffer[];
-//-----------------------------------------------------------------------------
-
-pU08 nc_format(pU08 source_ptr,U08 digits);
-pU08 nc_U08_to_str(U8 value,U08 digits);
-pU08 nc_S08_to_str(S08 signed_value,U08 digits);
-pU08 nc_U08_to_hex(U08 value);
-pU08 nc_U08_to_bin(U08 value);
-pU08 nc_U16_to_str(U16 value,U08 digits);
-pU08 nc_S16_to_str(S16 signed_value,U08 digits);
-pU08 nc_U16_to_hex(U16 value);
-pU08 nc_U32_to_str(U32 value,U08 digits);
-pU08 nc_S32_to_str(S32 signed_value,U08 digits);
-pU08 nc_U32_to_hex(U32 value);
-pU08 nc_float_to_str(float value,U08 decimals,U08 digits);
-//-----------------------------------------------------------------------------
-
-#endif
Index: firmware/FSC/src/output.c
===================================================================
--- firmware/FSC/src/output.c	(revision 17625)
+++ 	(revision )
@@ -1,207 +1,0 @@
-#include "output.h"
-#include "usart.h"
-#include "application.h"
-#include "timer.h"
-#include "w5100_spi_interface.h"
-
-void print_status() {
-	usart_write_str((pU08)"adc status:\n");
-	for (U08 i=0; i< VOLTAGE_REGS;++i) {
-		usart_write_U08_bin(adc_enables[i]);	
-		usart_write_char(' ');
-	}
-	usart_write_crlf();
-	for (U08 i=0; i< VOLTAGE_REGS;++i){
-		usart_write_U08_bin(adc_channels_ready[i]);
-		usart_write_char(' ');
-	}
-	usart_write_crlf();
-
-	usart_write_str((pU08)"ad7719 status:\n");
-	for (U08 i=0; i< RESISTANCE_CHANNELS/8;++i) {
-		usart_write_U08_bin(ad7719_enables[i]);
-		usart_write_char(' ');
-	}
-	usart_write_crlf();
-	for (U08 i=0; i< RESISTANCE_CHANNELS/8;++i){
-		usart_write_U08_bin(ad7719_channels_ready[i]);
-		usart_write_char(' ');
-	}
-	usart_write_crlf();
-
-	usart_write_str((pU08)"time:");
-	usart_write_U32(sec,10);
-	usart_write_str((pU08)" sec.\n");
-/*
-	usart_write_str((pU08)"adc measured all: ");
-	if (adc_measured_all)
-		usart_write_str((pU08)" true\n");
-	else
-		usart_write_str((pU08)"false\n");
-
-	usart_write_str((pU08)"ad7719 measured all: ");
-	if (ad7719_measured_all)
-		usart_write_str((pU08)" true\n");
-	else
-		usart_write_str((pU08)"false\n");
-
-	usart_write_str((pU08)"adc current channel:");
-	usart_write_U08(*adc_current_channel,2);
-	usart_write_crlf();
-
-	usart_write_str((pU08)"ad7719 current channel:");
-	usart_write_U08(*ad7719_current_channel,2);
-	usart_write_crlf();
-	
-	usart_write_str((pU08)"mux SB:");
-	usart_write_U08_hex(PORTC);
-	usart_write_str((pU08)" SA:");
-	usart_write_U08_hex(PORTA);
-	usart_write_crlf();
-*/
-}
-void print_adc_nicely() {
-	usart_write_str((pU08)"\n printing voltages in mV:\n");
-	// output:	U08 adc_values[V_CHANNELS + I_CHANNELS + H_CHANNELS];
-	for (U08 i=0; i< VOLTAGE_CHANNELS;++i) {
-		if (i%8 == 0) usart_write_char('\n');
-		adc_output(i, adc_values[i]);
-		usart_write_str((pU08)"   ");
-	}
-	usart_write_char('\n');
-}
-
-
-void print_ad7719_nicely() 
-{
-	float value;
-
-	usart_write_str((pU08)"\n printing measured resistance in kohms:\n");
-
-	for (U08 i=0; i< RESISTANCE_CHANNELS;++i) {
-		if (i%8 == 0) usart_write_char('\n');
-
-		// print channel name:
-		usart_write_str((pU08)"R:"); //R for resistance
-		usart_write_char('A'+i/8); // Letters A,B,C,D,E,F,G,H
-		//usart_write_char(' '); 
-		usart_write_U08(i%8+1,1); // Numbers 1...8
-		usart_write_char(':'); 
-
-		// check if this channel is enabled in the bitmap
-		if (ad7719_enables[i/8] & (1<<i%8))
-		{
-			value = (6.25 * 1.024 * ad7719_values[i]) / ((U32)1 << 25);
-			usart_write_float(value, 3,6);
-			//usart_write_U32(ad7719_values[i],8);
-			//usart_write_U32_hex(data); //data
-			usart_write_str((pU08)" ");	
-		} else {
-			usart_write_str((pU08)"       ");	
-		}
-		//usart_write_char('\n');
-	}
-}
-
-void ad7719_output(U08 channel, U32 data) {
-float value = 0;
-	usart_write_str((pU08)"R:"); //R for resistance
-	usart_write_char('A'+channel/8); // Letters A,B,C,D,E,F,G,H
-	//usart_write_char(' '); 
-	usart_write_U08(channel%8+1,1); // Numbers 1...8
-	usart_write_char(':'); 
-	
-
-	value = (6.25 * data) / ((U32)1 << 25);
-	usart_write_float(value, 3,6);
-	//usart_write_U32_hex(data); //data
-
-
-}
-
-void adc_output(U08 channel, U16 data) {
-
-//	if (channel < 40) 
-//		usart_write_str((pU08)"V:"); 
-//	else if (channel < 80)
-//		usart_write_str((pU08)"I:"); 
-//	else if (channel < 84)
-//		usart_write_str((pU08)"H:"); 
-
-	if (channel <80)
-	{
-		switch ((channel%40)/4) {
-			case 0:
-			case 1:
-				usart_write_char('A'); 
-			break;
-			case 2:
-			case 3:
-				usart_write_char('B');
-				break;
-			case 4:
-			case 5:
-				usart_write_char('C'); 
-				break;
-			case 6:
-			case 7:
-				usart_write_char('D'); 
-				break;
-			case 8:
-				usart_write_char('E');
-				break;
-			case 9:
-				usart_write_char('F');
-				break;
-			default:
-				usart_write_char('?');
-				break;
-			}
-	}
-	else // channel 80..83
-	{
-		usart_write_char('H');
-	}
-	//usart_write_char(' '); 
-	
-	if ( (channel%40)/4 == 9)
-		usart_write_U08((channel)%4+1,1); // Numbers 1...4
-	else
-		usart_write_U08((channel)%8+1,1); // Numbers 1...8
-	
-	
-	//usart_write_U08(channel,2); // Numbers 1...8
-	usart_write_char(':'); 
-	usart_write_U16(data/(adc_readings_until_mean/4), 7); //data
-}
-
-
-void adc_output_all() {
-	print_adc_nicely();
-	print_ad7719_nicely();
-}
-
-
-void telegram_start(){
-	eth_write_buffer[0]='@';
-	eth_write_buffer[1]='@';
-	w5100_set_TX(eth_write_buffer, 2); 
-}
-
-void print_help(){
-	usart_write_str((pU08)"printing help: -not yet- \n"); 
-}
-
-void print_adc_stupid() {
-	usart_write_str((pU08)"printing voltages in mV - stupid mode:\n");
-	for (U08 i = 0 ; i < VOLTAGE_CHANNELS ; ++i) {
-		usart_write_str((pU08)"ch:");
-		usart_write_U08(i,3);
-		usart_write_char(' ');
-		usart_write_U16_hex(adc_values[i]);
-		usart_write_char(' ');
-		usart_write_U16(adc_values[i],7);
-		usart_write_crlf(); 
-	}
-	usart_write_char('\n');
-}
Index: firmware/FSC/src/output.h
===================================================================
--- firmware/FSC/src/output.h	(revision 17625)
+++ 	(revision )
@@ -1,17 +1,0 @@
-#ifndef __OUTPUT_H
-#define __OUTPUT_H
-
-#include "typedefs.h"
-
-void ad7719_output(U08 channel, U32 data);
-void adc_output(U08 channel, U16 data);
-void adc_output_all();
-void print_ad7719_nicely();
-void print_adc_nicely();
-void print_adc_stupid();
-void print_status() ;
-
-void print_help();
-void telegram_start();
-
-#endif
Index: firmware/FSC/src/parser.c
===================================================================
--- firmware/FSC/src/parser.c	(revision 17625)
+++ 	(revision )
@@ -1,510 +1,0 @@
-#include "parser.h"
-#include "output.h"
-#include "application.h"
-#include "usart.h"
-#include "w5100_spi_interface.h"
-#include "timer.h"
-// this method parses the data, 
-// which came in via USART
-// later it might as well parse the data from ethernet.
-void parse_ascii() {
-	usart_rx_buffer[USART_RX_BUFFER_SIZE-1] = 0;
-	usart_write_str((pU08)"got:");
-	usart_write_str(usart_rx_buffer);
-	
-// look at first byte
-// I hope, I can manage to use one byte commands
-	switch (usart_rx_buffer[0]) {
-		case 'E': 	// AD7719 enable bitmaps may be set
-			set_ad7719_enable_register();
-			break;
-		case 'e':	// ATmega internal ADC enable bitmaps may be set
-			// not supported yet.
-			set_adc_enable_register();
-			break;
-		case 'h':
-			usart_write_str((pU08)"\nheartbeat ");
-			heartbeat_enable = true;
-			if (usart_rx_buffer[1] == '0'){
-				heartbeat_enable = false;
-				usart_write_str((pU08)"off\n");
-			} else {
-				usart_write_str((pU08)"on\n");
-			}
-			break;
-		case 'G': 			// GET the Temperature channels, which are enabled
-			once_told_you = false;
-			for ( U08 i=0; i<RESISTANCE_CHANNELS/8; ++i ) {
-				ad7719_channels_ready[i]=0;
-			}
-			break;
-
-		case 'g':			// GET the voltage/current/humidity channels, which are enabled
-			once_told_you = false;
-			for ( U08 i=0; i<VOLTAGE_REGS; ++i ) {
-				adc_channels_ready[i]=0;
-			}
-			break;
-
-		case 'P':
-			print_ad7719_nicely();
-			break;
-			
-		case 'p':
-			print_adc_nicely();
-			break;
-
-		case 's':
-			print_status();
-			break;	
-
-		case 'd':
-			usart_write_str((pU08)"\ndebug mode ");
-			debug_mode = true;
-			if (usart_rx_buffer[1] == '0'){
-				debug_mode = false;
-				usart_write_str((pU08)"off\n");
-			} else {
-				usart_write_str((pU08)"on\n");
-			}
-			break;		
-	}
-	
-	
-	usart_write_str((pU08)"\nready?");
-	for (U08 i=0; i<USART_RX_BUFFER_SIZE; ++i)
-		usart_rx_buffer[i] = 0;
-}
-
-void parse_non_human_readable_input() {
-
-
-}
-
-// this guy checks, if an incoming byte is:
-// to be stored, because it belongs to a command
-// to be discarded, because something went wrong, and the bytemade no sense...
-// the end of a commmand, and so the 'real parser' may do his work.
-/*
-void incoming_byte_parser() {
-	static bool receiving_command = false;
-	U08 current_byte = UDR;
-	
-	if (!receiving_command) { 
-		switch (current_byte) {
-			case 0x01:
-				receiving_command = true;
-				break;
-		}
-	}
-	
-	if (receiving_command)
-	{
-		usart_rx_buffer[usart_received_chars] = usart_last_char;
-		usart_received_chars++;
-	}
-	
-	
-}
-*/
-
-
-// this is the recent MSR parser
-/////////////////////////////////////////////////////////////////////////////////////////////////////
-/////////////// P A R S E R /////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////////////////////////////
-// this method parses the data, 
-// which came in via USART
-// later it might as well parse the data from ethernet.
-void MSR_parser() {
-
-U08 input_number = 0;
-bool enable = false;
-// look at first byte
-// I hope, I can manage to use one byte commands
-	usart_rx_buffer[USART_RX_BUFFER_SIZE-1] = 0;
-	usart_write_char(' ');
-	usart_write_str(usart_rx_buffer);
-	usart_write_char('\n');
-	
-
-	if (usart_received_chars >0) {
-		switch (usart_rx_buffer[0]) {
-			case 'E': 		// user wants to enable/disable something
-			case 'e':
-				enable = true;
-			case 'D':
-			case 'd':
-			
-				if (usart_received_chars>=1) {  // let's see what.
-					if ( 	usart_rx_buffer[1] != 'r'  &&
-							usart_rx_buffer[1] != 'v'  &&
-							usart_rx_buffer[1] != 'h'  &&
-							usart_rx_buffer[1] != 'p' )
-						{
-							//print_invalid_enable_statement();
-							break;
-						}
-				}
-				
-				input_number = 0;
-				if (usart_received_chars >2) {  // lets check the first digit
-					if ( usart_rx_buffer[2] >= '0' && usart_rx_buffer[2] <= '9' ) {
-						input_number = usart_rx_buffer[2] - '0';
-					} else {
-						//print_invalid_enable_statement();
-						break;
-					}
-				}
-				if (usart_received_chars >3) {  // lets check the 2nd digit
-					if ( usart_rx_buffer[3] >= '0' && usart_rx_buffer[3] <= '9' ) {
-						input_number = 10*input_number + usart_rx_buffer[3] - '0';
-					} else {
-						// okay as well ... if the second digit is missing .. 
-						// we might have trailing spaces
-						// that's okay .. we just accept the first number.
-					}
-				}
-				if (usart_received_chars>2) {
-					usart_write_str((pU08)"\n I will switch ");
-					if (enable) 
-						usart_write_str((pU08)"on ");
-					else
-						usart_write_str((pU08)"off ");
-					
-					// now we know, what the user wanted ... and we need to do it.
-					switch (usart_rx_buffer[1]) {
-						case 'r':
-							if (enable)
-								ad7719_enables[input_number/8] |= (1<<(input_number%8));
-							else {
-								ad7719_enables[input_number/8] &= ~(1<<(input_number%8));
-								ad7719_channels_ready[input_number/8] &= ~(1<<(input_number%8));
-								}
-							usart_write_str((pU08)" resistance channel ");
-							usart_write_U08(input_number,2);
-							usart_write_char('\n');
-							break;
-						case 'v':
-							if (enable)
-								adc_enables[input_number/8] |= (1<<(input_number%8));
-							else {
-								adc_enables[input_number/8] &= ~(1<<(input_number%8));
-								adc_channels_ready[input_number/8] &= ~(1<<(input_number%8));
-								}
-							usart_write_str((pU08)" voltage channel ");
-							usart_write_U08(input_number,2);
-							usart_write_char('\n');
-							break;
-							
-						case 'h':
-							if (enable)
-								adc_enables[1] |= (1<<(input_number%4));
-							else {
-								adc_enables[1] &= ~(1<<(input_number%4));
-								adc_channels_ready[1] &= ~(1<<(input_number%4));
-								}
-							usart_write_str((pU08)" humidity channel ");
-							usart_write_U08(input_number,2);
-							usart_write_char('\n');
-							break;
-						case 'p':
-							if (enable)
-								adc_enables[1] |= (1<<((input_number%4) + 4));
-							else {
-								adc_enables[1] &= ~(1<<((input_number%4) + 4));
-								adc_channels_ready[1] &= ~(1<<((input_number%4) + 4));
-								}
-							usart_write_str((pU08)" pressure channel ");
-							usart_write_U08(input_number,2);
-							usart_write_char('\n');
-							break;
-						default:
-							usart_write_str((pU08)"\n DAMN! this should never happen"
-							"- enable/disable switch-case!\n");
-							break;
-					}
-					
-					
-					
-				}// end of if usart_received_chars>2  --> this should not be necessary at all
-				break;
-				
-			case 'b':
-				usart_write_str((pU08)"\nheartbeat ");
-				heartbeat_enable = true;
-				if (usart_rx_buffer[1] == '0'){
-					heartbeat_enable = false;
-					usart_write_str((pU08)"off\n");
-				} else {
-					usart_write_str((pU08)"on\n");
-				}
-				break;
-			case 'G': 			// GET the Temperature channels, which are enabled
-				ad7719_values_printed = false;
-				reset_resistance_done();
-				reset_resistance_values();				
-				break;
-				
-			case 'g':			// GET the voltage/current/humidity channels, which are enabled
-				adc_values_printed = false;
-				reset_voltage_done();
-				reset_voltage_values();
-				break;
-
-			case 'p':
-					adc_print_endless = true;
-				if (usart_rx_buffer[1] == '0')
-					adc_print_endless = false;
-				break;		
-
-			case 'P':
-					ad7719_print_endless = true;
-				if (usart_rx_buffer[1] == '0')
-					ad7719_print_endless = false;
-				break;		
-			
-			case 's':
-				print_status();
-				//print_adc_enable_status(true);
-				//usart_write_char('\n');
-
-				//print_ad7719_enable_status(true);
-				//usart_write_char('\n');
-			
-				//usart_write_str((pU08)"time:");
-				//usart_write_float((float)local_ms/1000 , 1,7);
-				//usart_write_str((pU08)" sec.\n");
-				break;	
-				
-			case 'S':
-				write_status_via_eth();
-				break;
-
-			case '!':
-				usart_write_str((pU08)"\ndebug mode ");
-				debug_mode = true;
-				if (usart_rx_buffer[1] == '0'){
-					debug_mode = false;
-					usart_write_str((pU08)"off\n");
-				} else {
-					usart_write_str((pU08)"on\n");
-				}
-				break;		
-				
-			case 'h':
-			case 'H':
-				print_help();
-				break;
-		}
-	} else
-	{
-		// zero bytes received
-	}
-	
-	
-	for (U08 i=0; i<USART_RX_BUFFER_SIZE; ++i)
-		usart_rx_buffer[i] = 0;
-	usart_received_chars = 0;	
-	usart_rx_ready = false;
-}	// END of MSR_parser();
-
-
-
-///////////////////////////////////////////////////////////////////////////////////////
-// W5300 incoming commands parser
-void parse_w5300_incoming( U08 bytes_in_w5100_rx_buffer ) {
-
-	usart_writeln_str((pU08)"parsget:");
-	for (U08 i =0; i< ETH_READ_BUFFER_SIZE ; i++) {
-		usart_write_U08_hex(eth_read_buffer[i]);
-		usart_write_char((U08)eth_read_buffer[i]);
-		
-	}
-	usart_write_crlf();
-
-	if (bytes_in_w5100_rx_buffer == 0) // it was stupid to call this parser without having any bytes downloaded
-		return;
-		
-	switch (eth_read_buffer[0]) {
-		case 'w': // *w*rite to register command
-			write_FSC_register();
-			read_FSC_register(); 
-			break;
-			
-		case 'r':	// *r*ead from register command
-			read_FSC_register();
-			break;
-			
-		case 't':	// measure *t*emperature (resistance) channels only
-			ad7719_values_printed = false;
-			reset_resistance_done();
-			simple_acknowledge();
-			break;
-			
-		case 'v':	// measure *v*oltage channels only
-			adc_values_printed = false;
-			reset_voltage_done();
-			simple_acknowledge();
-			break;
-			
-		case 'm':	// *m*easure active channels commands
-			reset_done();
-			ad7719_print_endless = true;
-			//simple_acknowledge();
-			break;
-			
-		case 's':	// return *s*tatus information
-			// this might take a lot of time... about... 25us per byte .. --> less than 25ms
-			write_status_via_eth();
-			//w5100_set_TX(FSCregister, FSC_REGISTER_LENGTH);
-			break;
-			
-		case 'k':
-			eth_write_stuff();
-			break;
-		
-		case 'z':	// re*z*et ATmega32 and peripherals
-			eth_write_buffer[0]='!';
-			eth_write_buffer[1]='!';
-			w5100_set_TX(eth_write_buffer, 2); 
-			// let watchdog occur!
-			// gotta read, how this works...
-			break;	
-	}
-}
-
-void write_FSC_register() {
-	FSCregister[eth_read_buffer[2]]=eth_read_buffer[3];
-}
-
-void read_FSC_register() {
-	eth_write_buffer[0]=eth_read_buffer[0];
-	eth_write_buffer[1]=eth_read_buffer[1];
-	eth_write_buffer[2]=eth_read_buffer[2];
-	eth_write_buffer[3]=FSCregister[eth_read_buffer[2]];
-	w5100_set_TX(eth_write_buffer, 4); 
-}
-
-void reset_resistance_done(){
-	for (U08 i=0; i < (RESISTANCE_CHANNELS/8); i++){
-		ad7719_channels_ready[i] = 0;
-	}
-}
-void reset_resistance_values(){
-	for (U08 i=0; i < RESISTANCE_CHANNELS; i++){
-		ad7719_values[i] = 0;
-	}
-}
-
-
-void reset_voltage_done(){
-	for (U08 i=0; i < (VOLTAGE_REGS); i++){
-		adc_channels_ready[i] = 0;
-	}
-}
-void reset_voltage_values(){
-	for (U08 i=0; i < VOLTAGE_CHANNELS; i++){
-		adc_values[i] = 0;
-	}
-}
-
-void reset_done(){
-	reset_resistance_done();
-	reset_voltage_done();
-}
-
-void simple_acknowledge(){
-	eth_write_buffer[0]=eth_read_buffer[0];
-	eth_write_buffer[1]=eth_read_buffer[1];
-	w5100_set_TX(eth_write_buffer, 2); 
-}
-
-void write_status_via_eth() {
-float resistance;
-
-	// take care: ethernet write buffer is just 32 bytes long.
-	eth_write_str("status: "); 				eth_writeln_str(nc_U32_to_hex(status));
-	// better switch off interrupts here:
-	// otherwise the numbers in time_sec and time_ms might get corrupt during output.
-	cli();
-	eth_write_str("time_s: "); 				eth_write_str(nc_U32_to_str(sec, 1));
-	eth_write_str(".");eth_writeln_str(nc_U16_to_str(milisec, 1));
-	//eth_write_str("mili_s: "); 				eth_writeln_str(nc_U16_to_str(milisec, 1));
-	sei();
-	
-	//eth_write_str("R_ref : "); 				eth_writeln_str(nc_U16_to_str(ref_resistor, 6));
-	
-	eth_writeln_str("VOLTAGES\n");
-		eth_write_str("enable:"); 				
-		for (U08 i=0; i<VOLTAGE_REGS ; i++){
-			eth_write_str(nc_U08_to_bin(adc_enables[i]));
-			// need to tweak here in order to get some nice spaces...
-			eth_write_buffer[eth_write_index] = ' ';
-			eth_write_index++;
-		}
-		eth_write_buffer[eth_write_index++] = '\n';
-		
-		eth_write_str("  done:"); 				
-		for (U08 i=0; i<VOLTAGE_REGS ; i++){
-			eth_write_str(nc_U08_to_bin(adc_channels_ready[i]));
-			// need to tweak here in order to get some nice spaces...
-			eth_write_buffer[eth_write_index] = ' ';
-			eth_write_index++;
-		}
-		eth_write_buffer[eth_write_index++] = '\n';
-		
-		eth_write_str("values:"); 				
-		for (U08 i=0; i<VOLTAGE_CHANNELS ; i++){
-			eth_write_str(nc_U16_to_str(adc_values[i]/10, 1) );
-			// need to tweak here in order to get some nice spaces...
-			eth_write_buffer[eth_write_index] = ' ';
-			eth_write_index++;
-		}
-		eth_write_buffer[eth_write_index++] = '\n';
-		
-	eth_writeln_str("RESISTANCES\n");
-		eth_write_str("enable:"); 				
-		for (U08 i=0; i<(RESISTANCE_CHANNELS/8) ; i++){
-			eth_write_str(nc_U08_to_bin(ad7719_enables[i]));
-			// need to tweak here in order to get some nice spaces...
-			eth_write_buffer[eth_write_index] = ' ';
-			eth_write_index++;
-		}
-		eth_write_buffer[eth_write_index++] = '\n';
-		
-		eth_write_str("  done:"); 				
-		for (U08 i=0; i<(RESISTANCE_CHANNELS/8) ; i++){
-			eth_write_str(nc_U08_to_bin(ad7719_channels_ready[i]));
-			// need to tweak here in order to get some nice spaces...
-			eth_write_buffer[eth_write_index] = ' ';
-			eth_write_index++;
-		}
-		eth_write_buffer[eth_write_index++] = '\n';
-
-		eth_write_str("values:\n"); 				
-		for (U08 i=0; i<RESISTANCE_CHANNELS ; i++){
-			//eth_write_str(nc_U32_to_str(ad7719_values[i], 10) );
-			
-			resistance = (6.25 * 1024 * ad7719_values[i]) / ((U32)1 << 25);
-			eth_write_str(nc_float_to_str(resistance , 2, 2) );
-			// need to tweak here in order to get some nice spaces...
-			if (i%8 == 7)
-				eth_write_buffer[eth_write_index] = '\n';
-			else
-				eth_write_buffer[eth_write_index] = ' ';
-			
-			eth_write_index++;
-		}
-		eth_writeln_str("\nend.\n");
-		
-
-}
-
-void eth_write_stuff(void) {
-	S08 buf []="Test Ah A!!\n";
-	for (U08 i =0 ; i<255 ; i++) {
-		eth_write_str(nc_U08_to_str(i,4));
-		eth_write_str(buf);
-	}
-}
Index: firmware/FSC/src/parser.h
===================================================================
--- firmware/FSC/src/parser.h	(revision 17625)
+++ 	(revision )
@@ -1,27 +1,0 @@
-#ifndef __PARSER_H
-#define __PARSER_H
-
-#include "typedefs.h"
-void parse_ascii(); 
-void MSR_parser() ;
-
-// all allowed non readable commands are listed here
-// this is not used at all right?
-#define SET_ENABLES 0x01 // sets all enables -- needs 8 + 11 bytes of data
-#define SW_TO_HUMAN 0xFF // SWITCH_TO_HUMAN_READABLE_INTERFACE
-
-void parse_w5300_incoming( U08 bytes_in_w5100_rx_buffer );
-void write_FSC_register();
-void read_FSC_register();
-void reset_resistance_done();
-void reset_resistance_values();
-void reset_voltage_done();
-void reset_voltage_values();
-void reset_done();
-void simple_acknowledge();
-
-// this function will loop over the entire FSC register and output it in a human readable form.
-// I hope this is convenient.
-void write_status_via_eth();
-void eth_write_stuff(void);
-#endif
Index: firmware/FSC/src/tests.c
===================================================================
--- firmware/FSC/src/tests.c	(revision 17625)
+++ 	(revision )
@@ -1,47 +1,0 @@
-#include "tests.h"
-
-#include "typedefs.h"
-
-void test_out_spare_pins(void)
-{
-
-	// set everything as inputs -- high Z
-	DDRA = 0x00;
-	DDRB = 0x00;
-	DDRC = 0x00;
-	DDRD = 0x00;
-
-	DDRB |= 1<<PB2; // set spare out1 as output
-	DDRB |= 1<<PB3; // set spare out2 as output
-
-	DDRB |= 1<<PB4; 
-
-	PORTC |= 1<<PC7; // switch PC7 pullup on
-	PORTA |= 1<<PA7; // switch PA7 pullup on
-
-	while (true)
-	{
-		 
-		if ( (PINC & (1<<PC7)) == 0 )
-		{
-			PORTB |= 1 << PB2;
-		} else {
-			PORTB &= ~(1<<PB2);
-		}
-
-		/*
-		if ( (PINA & (1<<PA7)) == 0 )
-		{
-			PORTB |= 1 << PB3;
-		} else {
-			PORTB &= ~(1<<PB3);
-		}
-*/
-
-		PORTB ^= 1<<PB3;
-		PORTB ^= 1<<PB4;
-	}
-
-
-
-}
Index: firmware/FSC/src/tests.h
===================================================================
--- firmware/FSC/src/tests.h	(revision 17625)
+++ 	(revision )
@@ -1,1 +1,0 @@
-void test_out_spare_pins(void) ;
Index: firmware/FSC/src/usart.c
===================================================================
--- firmware/FSC/src/usart.c	(revision 17625)
+++ 	(revision )
@@ -1,269 +1,0 @@
-//-----------------------------------------------------------------------------
-
-#include "usart.h"
-#include "num_conversion.h"
-#include <avr/interrupt.h>
-//-----------------------------------------------------------------------------
-#ifdef USART_USE_TX_IRQ
-
-#endif
-
-	U08 usart_tx_buffer[USART_TX_BUFFER_SIZE];
-	U08 usart_tx_buffer_index = 0;
-	bool usart_tx_buffer_overflow = false;	// true if usart_tx_buffer was full.
-
-
-
-#ifdef USART_USE_RX_IRQ
-  U08 usart_rx_buffer[USART_RX_BUFFER_SIZE];
-  //U08 *usart_rx_buffer_ptr = &usart_rx_buffer[0];
-  U08 usart_received_chars;
-  volatile BOOL usart_rx_ready = false;
-  static U08 usart_rx_buffer_index = 0;
-  static U08 usart_receive_char;
-  static BOOL usart_receive_suspended = false;
-#endif
-//-----------------------------------------------------------------------------
-
-void usart_init(void)
-{
-  USART_SET_BAUDRATE(USART_BAUDRATE);
-
-  UCSRA = 0x00;
-
-  UCSRB = 0x00; // Disable receiver and transmitter and interrupts
-
-#ifdef USART_USE_RX
-  UCSRB |= (1 << RXEN);			// Turn on receiver
-	DDRD &= ~(1<<PD0);				// PD0 is RXD
-#endif
-
-#ifdef USART_USE_RX_IRQ
-  UCSRB |= (1 << RXCIE);		// Enable rx interrupt
-#endif
-
-#ifdef USART_USE_TX
-  UCSRB |= (1 << TXEN);			// Turn on transmitter
-	DDRD |= 1<<PD1; 					// PD1 is TXD
-#endif
-
-  UCSRC = (1 << URSEL) | (1 << UCSZ1) | (1 << UCSZ0); // 8-Bit character length
-}
-//-----------------------------------------------------------------------------
-
-void usart_write_char(U08 data)
-{
-  while (!(UCSRA & (1 << UDRE))) ; // Wait until tx register is empty
-  UDR = data;
-
-//	if ( usart_tx_buffer_index < USART_TX_BUFFER_SIZE-1){
-//		usart_tx_buffer[usart_tx_buffer_index] = data;
-//		++usart_tx_buffer_index;
-//	} else {
-//		usart_tx_buffer_overflow = true;
-//	}
-}
-//-----------------------------------------------------------------------------
-
-void usart_write_crlf(void)
-{
-  usart_write_char(USART_CHAR_CR);
-  usart_write_char(USART_CHAR_LF);
-}
-//-----------------------------------------------------------------------------
-
-void usart_write_str(pU08 str)
-{
-  while (*str)
-  {
-    usart_write_char(*str++);
-  }
-}
-//-----------------------------------------------------------------------------
-
-void usart_write_flash_str(fpU08 str)
-{
-  while (*str)
-  {
-    usart_write_char(*str++);
-  }
-}
-//-----------------------------------------------------------------------------
-
-void usart_writeln_flash_str(fpU08 str)
-{
-  while (*str)
-  {
-    usart_write_char(*str++);
-  }
-
-  usart_write_char(USART_CHAR_CR);
-  usart_write_char(USART_CHAR_LF);
-}
-//-----------------------------------------------------------------------------
-
-void usart_writeln_str(pU08 str)
-{
-  usart_write_str(str);
-  usart_write_char(USART_CHAR_CR);
-  usart_write_char(USART_CHAR_LF);
-}
-//-----------------------------------------------------------------------------
-
-void usart_write_U08(U08 value,U08 digits)
-{
-  usart_write_str(nc_U08_to_str(value,digits));
-}
-//-----------------------------------------------------------------------------
-
-void usart_write_S08(S08 value,U08 digits)
-{
-  usart_write_str(nc_S08_to_str(value,digits));
-}
-//-----------------------------------------------------------------------------
-
-void usart_write_U08_hex(U08 value)
-{
-  usart_write_str(nc_U08_to_hex(value));
-}
-//-----------------------------------------------------------------------------
-
-void usart_write_U08_bin(U08 value)
-{
-  usart_write_str(nc_U08_to_bin(value));
-}
-//-----------------------------------------------------------------------------
-
-void usart_write_U16(U16 value,U08 digits)
-{
-  usart_write_str(nc_U16_to_str(value,digits));
-}
-//-----------------------------------------------------------------------------
-
-void usart_write_S16(S16 value,U08 digits)
-{
-  usart_write_str(nc_S16_to_str(value,digits));
-}
-//-----------------------------------------------------------------------------
-
-void usart_write_U16_hex(U16 value)
-{
-  usart_write_str(nc_U16_to_hex(value));
-}
-//-----------------------------------------------------------------------------
-
-void usart_write_U32(U32 value,U08 digits)
-{
-  usart_write_str(nc_U32_to_str(value,digits));
-}
-//-----------------------------------------------------------------------------
-
-void usart_write_S32(S32 value,U08 digits)
-{
-  usart_write_str(nc_S32_to_str(value,digits));
-}
-//-----------------------------------------------------------------------------
-
-void usart_write_U32_hex(U32 value)
-{
-  usart_write_str(nc_U32_to_hex(value));
-}
-//-----------------------------------------------------------------------------
-
-void usart_write_float(float value,U08 decimals,U08 digits)
-{
-  usart_write_str(nc_float_to_str(value,decimals,digits));
-}
-//-----------------------------------------------------------------------------
-
-#ifdef USART_USE_RX_IRQ
-
-ISR(SIG_USART_RECV)
-{
-	usart_receive_char = UDR;
-
-  if (usart_rx_ready) // Exit if ready flag is still set 
-  {
-    return;
-  }
-
-  // If CR received, then set ready flag
-  if (usart_receive_char == USART_CHAR_CR)
-  {
-    usart_rx_buffer[usart_rx_buffer_index] = 0; // Terminate input string
-    usart_received_chars = usart_rx_buffer_index;
-    usart_rx_buffer_index = 0;
-    usart_receive_suspended = false;
-    usart_rx_ready = TRUE;
-    return;
-  }
-
-  // Ignore all characters till next CR
-  if (usart_receive_suspended)
-  {
-    return;
-  }
-
-  // Check for underscore or comment
-  if (usart_receive_char == '_' || usart_receive_char == ';')
-  {
-    usart_receive_suspended = true;
-
-    return;
-  }
-
-  // If Backspace received, then delete last character
-  if (usart_receive_char == USART_CHAR_BS && usart_rx_buffer_index)
-  {
-    usart_rx_buffer_index--;
-
-    return;
-  }
-
-  // Ignore invalid characters
-  if (usart_receive_char < USART_CHAR_SPC)
-  {
-    return;
-  }
-
-#ifdef USART_USE_UPPERCASE
-  if (usart_receive_char >= 'a' && usart_receive_char <= 'z')
-  {
-    usart_receive_char -= 32;
-  }
-#endif
-
-  if (usart_rx_buffer_index < USART_RX_BUFFER_SIZE - 1) // Store character
-  {
-    usart_rx_buffer[usart_rx_buffer_index++] = usart_receive_char;
-    //usart_writeln_str(usart_rx_buffer);
-  }
-
-  //usart_write_char(usart_rx_buffer[usart_rx_buffer_index]);
- //usart_writeln_str(usart_rx_buffer);
- //usart_write_char(usart_rx_buffer[1,2]);
- //usart_write_char(usart_rx_buffer[usart_rx_buffer_index]);
- //usart_writeln_flash_str(*usart_rx_buffer);
- //usart_write_char(usart_rx_buffer);
-}  
-#endif 
-
-
-#ifdef USART_USE_TX_IRQ
-
-ISR(TRALA_vect)
-{
-
-	// if it is necessary to write something via USART ... then send
-	// if not ... disable this interrupt.
-	if (usart_write_start_index < usart_write_stop_index) // some bytes in the usart_tx_buffer should be send away.
-	{
-		UDR = usart_tx_buffer[usart_write_start_index%USART_TX_BUFFER_SIZE];
-	}
-	else
-	{
-		// disable this interrupt source
-		UCSRB &= ~(1<<UDRIE);
-	}
-}  
-#endif 
Index: firmware/FSC/src/usart.h
===================================================================
--- firmware/FSC/src/usart.h	(revision 17625)
+++ 	(revision )
@@ -1,79 +1,0 @@
-#ifndef __USART_H
-#define __USART_H
-//-----------------------------------------------------------------------------
-
-#include "typedefs.h"
-#include "application.h"
-#include "num_conversion.h"
-
-//-----------------------------------------------------------------------------
-#define USART_RX_BUFFER_SIZE 32 // Receive buffer size
-#define USART_TX_BUFFER_SIZE 5 // Receive buffer size. MUST not be larger 255
-
-#define USART_BAUDRATE 9600 // USART baudrate original
-#define USART_USE_TX // Transmitter used?
-#define USART_USE_RX // Receiver used?
-#define USART_USE_RX_IRQ // RX interrupt used?
-//#define USART_USE_UPPERCASE // Convert received chars to uppercase?
-//-----------------------------------------------------------------------------
-
-#define USART_CHAR_BS 8
-#define USART_CHAR_LF 10
-#define USART_CHAR_CR 13
-#define USART_CHAR_ESC 27
-#define USART_CHAR_SPC 32
-//-----------------------------------------------------------------------------
-
-#define USART_SET_BAUDRATE(br) (UBRRH = (U08)((((U32)F_CPU) /\
-                                ((U32)br * 16) - 1) >> 8),\
-                                UBRRL = (U08)(((U32)F_CPU) /\
-                                ((U32)br * 16) - 1))
-//-----------------------------------------------------------------------------
-
-// USART global variables
-	extern U08 usart_rx_buffer[USART_RX_BUFFER_SIZE];
-	extern U08 usart_tx_buffer[USART_TX_BUFFER_SIZE];
-	extern U08 usart_received_chars;
-
-	extern U08 usart_tx_buffer_index;
-  	extern U08 usart_last_char; 					// last received char
-
-// USART FLAGS
-	extern bool usart_tx_buffer_overflow;	// true if usart_tx_buffer was full.
-
-
-
-extern bool usart_tx_buffer_overflow;
-extern U08 usart_tx_buffer_index;
-extern U08 usart_tx_buffer[USART_TX_BUFFER_SIZE];
-
-#ifdef USART_USE_RX_IRQ
-  extern U08 usart_rx_buffer[];
-  //U08 *usart_rx_buffer_ptr = &usart_rx_buffer[0];
-  extern U08 usart_received_chars;
-  extern volatile BOOL usart_rx_ready;
-#endif
-
-//-----------------------------------------------------------------------------
-
-void usart_init(void);
-void usart_write_char(U08 data);
-void usart_write_crlf(void);
-void usart_write_str(pU08 str);
-void usart_writeln_str(pU08 str);
-void usart_write_flash_str(fpU08 str);
-void usart_writeln_flash_str(fpU08 str);
-void usart_write_U08(U08 value,U08 digits);
-void usart_write_S08(S08 value,U08 digits);
-void usart_write_U08_hex(U08 value);
-void usart_write_U08_bin(U08 value);
-void usart_write_U16(U16 value,U08 digits);
-void usart_write_S16(S16 value,U08 digits);
-void usart_write_U16_hex(U16 value);
-void usart_write_U32(U32 value,U08 digits);
-void usart_write_S32(S32 value,U08 digits);
-void usart_write_U32_hex(U32 value);
-void usart_write_float(float value,U08 decimals,U08 digits);
-//-----------------------------------------------------------------------------
-
-#endif
