Index: /fact/tools/FAD/simple_daq/Makefile
===================================================================
--- /fact/tools/FAD/simple_daq/Makefile	(revision 9925)
+++ /fact/tools/FAD/simple_daq/Makefile	(revision 9926)
@@ -1,8 +1,12 @@
 CC=g++
-CFLAGS=-c -Wall
+REVISION = $(shell svnversion -n)
+CFLAGS=-c -Wall -DREVISION='"$(REVISION)"'
 LDFLAGS=
 SOURCES=simple_daq.cpp cmd_send.cpp ../SocketFunctions/SocketFunctions.cpp
 OBJECTS=$(SOURCES:.cpp=.o)
 EXECUTABLE=simple_daq
+
+
+
 
 all: $(SOURCES) $(EXECUTABLE)
Index: /fact/tools/FAD/simple_daq/cmd_send.cpp
===================================================================
--- /fact/tools/FAD/simple_daq/cmd_send.cpp	(revision 9925)
+++ /fact/tools/FAD/simple_daq/cmd_send.cpp	(revision 9926)
@@ -301,5 +301,5 @@
 		printf ("    psup:       'increse' phase shift - default\n");
 		printf ("    psdn:       'decrease' phase shift\n");
-		printf ("    psres:      reset phase shift\n");
+		printf ("    psreset:    reset phase shift\n");
 
 
Index: /fact/tools/FAD/simple_daq/config.txt
===================================================================
--- /fact/tools/FAD/simple_daq/config.txt	(revision 9925)
+++ /fact/tools/FAD/simple_daq/config.txt	(revision 9926)
@@ -1,4 +1,4 @@
-129.217.160.119
-/home/dneise/FACT/FAD/measurements
+192.33.99.225
+/home/daqct3/no_back
 socket
 dat
Index: /fact/tools/FAD/simple_daq/simple_daq.cpp
===================================================================
--- /fact/tools/FAD/simple_daq/simple_daq.cpp	(revision 9925)
+++ /fact/tools/FAD/simple_daq/simple_daq.cpp	(revision 9926)
@@ -22,5 +22,9 @@
 #include "iostream"
 
+int revision = atoi(REVISION) * (strchr(REVISION,'M')==NULL ? 1:-1);
+int fad_firmware_revision;
+
 int init_fad();
+int get_firmware_revision();
 int *SocketDescriptor;
 using namespace std;
@@ -75,5 +79,14 @@
 		}
 	}
+	
 	init_fad();
+	
+	fad_firmware_revision = get_firmware_revision();	
+	printf ("software revision is: %s or %d\n",REVISION,revision);
+	printf ("firmware revision is: %d\n",fad_firmware_revision);
+	
+	
+	
+
 
 
@@ -197,4 +210,14 @@
 	cmd_send ("dd\n", SocketDescriptor[0]);				
 sleep (1);
+	cmd_send ("sd 0 21000\n", SocketDescriptor[0]);
+	cmd_send ("sd 1 0\n", SocketDescriptor[0]);
+	cmd_send ("sd 2 5000\n", SocketDescriptor[0]);
+	cmd_send ("sd 3 5000\n", SocketDescriptor[0]);
+	cmd_send ("sd 4 28800\n", SocketDescriptor[0]);
+	cmd_send ("sd 5 28800\n", SocketDescriptor[0]);
+	cmd_send ("sd 6 28800\n", SocketDescriptor[0]);
+	cmd_send ("sd 7 28800\n", SocketDescriptor[0]);
+
+sleep (1);
 	cmd_send ("sra 10\n", SocketDescriptor[0]);
 	cmd_send ("sa 44 29\n", SocketDescriptor[0]);			
@@ -209,16 +232,75 @@
 sleep (1);
 	cmd_send ("t\n", SocketDescriptor[0]);
-//	cmd_send ("sclkoff\n", SocketDescriptor[0]);			
+	cmd_send ("sclkoff\n", SocketDescriptor[0]);			
 	cmd_send ("de\n", SocketDescriptor[0]);			
 	cmd_send ("dr\n", SocketDescriptor[0]);			
 	cmd_send ("sra 1024\n", SocketDescriptor[0]);			
+sleep (1);
+
 	EmptySockets(SocketDescriptor, 8, 750000L);
+
+
 
 	printf (	"\n\n FAD initialised. \n "
 						"ROI is 1024. \n"
 						"DRS shift registers are initialised.\n"
-						"DRS is up and running.\n");
+						"DRS is up and running.\n"
+						"SPI SCLK was swithced off, TEMP readout makes no sense.\n" 
+						"DAC changes will neighter work. SWITCH SCLK back on, when trying to change DAC values\n"
+						);
 
 return 0;
 }
 
+int get_firmware_revision(){
+
+fd_set ReadFileDescriptor;
+int max_fd = 0;
+	
+int read_return;
+unsigned char buffer[984];
+unsigned short x,rev;
+
+max_fd = GetMaxFileDescriptor(SOCKETS_PER_FAD, SocketDescriptor);
+
+	cmd_send ("sra 10\n", SocketDescriptor[0]);	
+	cmd_send ("t\n", SocketDescriptor[0]);					
+	sleep (1);
+
+
+		FD_ZERO (&ReadFileDescriptor);		
+		for (int i = 0; i < SOCKETS_PER_FAD; i++)
+		{
+			FD_SET (SocketDescriptor[i], &ReadFileDescriptor);
+		}
+
+		// Wait for data from sockets
+		if (select (((int) max_fd) + 1, &ReadFileDescriptor, NULL, NULL, NULL) == -1)
+		{
+			perror ("Error with select()\n");
+			
+		}
+		
+ 
+			// Check all sockets
+			for (int i = 0; i < SOCKETS_PER_FAD; i++)
+			{
+				if (FD_ISSET (SocketDescriptor[i], &ReadFileDescriptor))
+				{ 
+					if ((read_return = read (SocketDescriptor[i], buffer, 984)) == 0)
+					{
+						printf ("Error: Server not existing anymore, exiting...\n");
+						return -1;
+					}
+					if (read_return > 0)
+					{
+						printf ("Socket [%d]: Read %d Bytes\n", i, read_return);
+					}
+				}
+			}
+
+	rev = (unsigned char)buffer[4]<<8 | (unsigned char)buffer [5];
+
+return rev;
+}
+
