Index: firmware/FSC/src/FSC.c
===================================================================
--- firmware/FSC/src/FSC.c	(revision 10243)
+++ firmware/FSC/src/FSC.c	(revision 10244)
@@ -118,5 +118,5 @@
 	adc_channels_ready[V_BITMAP + I_BITMAP + H_BITMAP -1]=0;
 
-	static U08 welcome[]="\n\nwelcome to FACT FSC commandline interface v0.2\nready?";
+	static U08 welcome[]="\n\nwelcome to FACT FSC commandline interface v0.4\nDN 17.03.2011\nready?";
 	usart_write_str(welcome);
 
@@ -895,8 +895,10 @@
 			for (U08 i=0; i< V_BITMAP + I_BITMAP + H_BITMAP;++i) {
 				usart_write_U08_bin(adc_enables[i]);	
+				usart_write_char(' ');
 			}
 			usart_write_char('\n');
 			for (U08 i=0; i< V_BITMAP + I_BITMAP + H_BITMAP;++i){
 				usart_write_U08_bin(adc_channels_ready[i]);
+				usart_write_char(' ');
 			}
 			usart_write_char('\n');
@@ -905,10 +907,10 @@
 			for (U08 i=0; i< CHANNEL_BITMAP;++i) {
 				usart_write_U08_bin(ad7719_enables[i]);
-				//usart_write_char('\t');
+				usart_write_char(' ');
 			}
 			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(' ');
 			}
 			usart_write_char('\n');
@@ -995,10 +997,11 @@
 	if (ad7719_enables[i/8] & (1<<i%8))
 	{
-		value = (6.25 * ad7719_values[i]) / ((U32)1 << 25);
+		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)"   ");	
+		usart_write_str((pU08)"  ");	
 	} else {
-		usart_write_str((pU08)"         ");	
+		usart_write_str((pU08)"        ");	
 	}
 	//usart_write_char('\n');
Index: firmware/FSC/src/muxer_fsc.c
===================================================================
--- firmware/FSC/src/muxer_fsc.c	(revision 10244)
+++ firmware/FSC/src/muxer_fsc.c	(revision 10244)
@@ -0,0 +1,74 @@
+#include "muxer_fsc.h"
+
+// 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.
+}
+
+
Index: firmware/FSC/src/muxer_fsc.h
===================================================================
--- firmware/FSC/src/muxer_fsc.h	(revision 10244)
+++ firmware/FSC/src/muxer_fsc.h	(revision 10244)
@@ -0,0 +1,19 @@
+// include either muxer_fsc.h or muxer_msr.h
+#ifndef __MUXER_FSC_H
+#define __MUXER_FSC_H
+
+#include "typedefs.h"
+
+	#ifndef __MUXER_XXX_H_
+	#  define __MUXER_XXX_H "muxer_fsc.h"
+	#else
+	#  error "Attempt to include more than one <muxer_xxx.h> file."
+	#endif
+
+	void Set_V_Muxer(U08 channel);
+	void Set_T_Muxer(U08 channel);
+
+
+
+
+#endif
Index: firmware/FSC/src/output.c
===================================================================
--- firmware/FSC/src/output.c	(revision 10244)
+++ firmware/FSC/src/output.c	(revision 10244)
@@ -0,0 +1,173 @@
+#include "output.h"
+#include "usart.h"
+
+void print_status() {
+	usart_write_str((pU08)"adc status:\n");
+	for (U08 i=0; i< V_BITMAP + I_BITMAP + H_BITMAP;++i) {
+		usart_write_U08_bin(adc_enables[i]);	
+		usart_write_char(' ');
+	}
+	usart_write_char('\n');
+	for (U08 i=0; i< V_BITMAP + I_BITMAP + H_BITMAP;++i){
+		usart_write_U08_bin(adc_channels_ready[i]);
+		usart_write_char(' ');
+	}
+	usart_write_char('\n');
+
+	usart_write_str((pU08)"ad7719 status:\n");
+	for (U08 i=0; i< CHANNEL_BITMAP;++i) {
+		usart_write_U08_bin(ad7719_enables[i]);
+		usart_write_char(' ');
+	}
+	usart_write_char('\n');
+	for (U08 i=0; i< CHANNEL_BITMAP;++i){
+		usart_write_U08_bin(ad7719_channels_ready[i]);
+		usart_write_char(' ');
+	}
+	usart_write_char('\n');
+
+	usart_write_str((pU08)"time:");
+	usart_write_float((float)local_ms/1000 , 1,7);
+	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_char('\n');
+
+	usart_write_str((pU08)"ad7719 current channel:");
+	usart_write_U08(ad7719_current_channel,2);
+	usart_write_char('\n');
+
+}
+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< V_CHANNELS + I_CHANNELS + H_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< TEMP_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, 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:"); 
+
+	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((U16)data*16, 4); //data
+}
+
+
+void adc_output_all() {
+	print_adc_nicely();
+	print_ad7719_nicely();
+}
Index: firmware/FSC/src/output.h
===================================================================
--- firmware/FSC/src/output.h	(revision 10244)
+++ firmware/FSC/src/output.h	(revision 10244)
@@ -0,0 +1,13 @@
+#ifndef __OUTPUT_H
+#define __OUTPUT_H
+
+#include "typedefs.h"
+
+void ad7719_output(U08 channel, U32 data);
+void adc_output(U08 channel, U08 data);
+void adc_output_all();
+void print_ad7719_nicely();
+void print_adc_nicely();
+
+
+#endif
Index: firmware/FSC/src/parser.c
===================================================================
--- firmware/FSC/src/parser.c	(revision 10244)
+++ firmware/FSC/src/parser.c	(revision 10244)
@@ -0,0 +1,73 @@
+#include "parser.h"
+#include "output.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<CHANNEL_BITMAP; ++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<V_BITMAP + I_BITMAP + H_BITMAP; ++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;
+}
Index: firmware/FSC/src/parser.h
===================================================================
--- firmware/FSC/src/parser.h	(revision 10244)
+++ firmware/FSC/src/parser.h	(revision 10244)
@@ -0,0 +1,6 @@
+#ifndef __PARSER_H
+#define __PARSER_H
+
+void parse_ascii(); 
+
+#endif
