- Timestamp:
- 09/07/10 09:05:39 (14 years ago)
- Location:
- fact/tools/FAD/simple_daq
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
fact/tools/FAD/simple_daq/Makefile
r256 r9926 1 1 CC=g++ 2 CFLAGS=-c -Wall 2 REVISION = $(shell svnversion -n) 3 CFLAGS=-c -Wall -DREVISION='"$(REVISION)"' 3 4 LDFLAGS= 4 5 SOURCES=simple_daq.cpp cmd_send.cpp ../SocketFunctions/SocketFunctions.cpp 5 6 OBJECTS=$(SOURCES:.cpp=.o) 6 7 EXECUTABLE=simple_daq 8 9 10 7 11 8 12 all: $(SOURCES) $(EXECUTABLE) -
fact/tools/FAD/simple_daq/cmd_send.cpp
r9905 r9926 301 301 printf (" psup: 'increse' phase shift - default\n"); 302 302 printf (" psdn: 'decrease' phase shift\n"); 303 printf (" psres :reset phase shift\n");303 printf (" psreset: reset phase shift\n"); 304 304 305 305 -
fact/tools/FAD/simple_daq/config.txt
r271 r9926 1 1 29.217.160.1192 /home/d neise/FACT/FAD/measurements1 192.33.99.225 2 /home/daqct3/no_back 3 3 socket 4 4 dat -
fact/tools/FAD/simple_daq/simple_daq.cpp
r9907 r9926 22 22 #include "iostream" 23 23 24 int revision = atoi(REVISION) * (strchr(REVISION,'M')==NULL ? 1:-1); 25 int fad_firmware_revision; 26 24 27 int init_fad(); 28 int get_firmware_revision(); 25 29 int *SocketDescriptor; 26 30 using namespace std; … … 75 79 } 76 80 } 81 77 82 init_fad(); 83 84 fad_firmware_revision = get_firmware_revision(); 85 printf ("software revision is: %s or %d\n",REVISION,revision); 86 printf ("firmware revision is: %d\n",fad_firmware_revision); 87 88 89 90 78 91 79 92 … … 197 210 cmd_send ("dd\n", SocketDescriptor[0]); 198 211 sleep (1); 212 cmd_send ("sd 0 21000\n", SocketDescriptor[0]); 213 cmd_send ("sd 1 0\n", SocketDescriptor[0]); 214 cmd_send ("sd 2 5000\n", SocketDescriptor[0]); 215 cmd_send ("sd 3 5000\n", SocketDescriptor[0]); 216 cmd_send ("sd 4 28800\n", SocketDescriptor[0]); 217 cmd_send ("sd 5 28800\n", SocketDescriptor[0]); 218 cmd_send ("sd 6 28800\n", SocketDescriptor[0]); 219 cmd_send ("sd 7 28800\n", SocketDescriptor[0]); 220 221 sleep (1); 199 222 cmd_send ("sra 10\n", SocketDescriptor[0]); 200 223 cmd_send ("sa 44 29\n", SocketDescriptor[0]); … … 209 232 sleep (1); 210 233 cmd_send ("t\n", SocketDescriptor[0]); 211 //cmd_send ("sclkoff\n", SocketDescriptor[0]);234 cmd_send ("sclkoff\n", SocketDescriptor[0]); 212 235 cmd_send ("de\n", SocketDescriptor[0]); 213 236 cmd_send ("dr\n", SocketDescriptor[0]); 214 237 cmd_send ("sra 1024\n", SocketDescriptor[0]); 238 sleep (1); 239 215 240 EmptySockets(SocketDescriptor, 8, 750000L); 241 242 216 243 217 244 printf ( "\n\n FAD initialised. \n " 218 245 "ROI is 1024. \n" 219 246 "DRS shift registers are initialised.\n" 220 "DRS is up and running.\n"); 247 "DRS is up and running.\n" 248 "SPI SCLK was swithced off, TEMP readout makes no sense.\n" 249 "DAC changes will neighter work. SWITCH SCLK back on, when trying to change DAC values\n" 250 ); 221 251 222 252 return 0; 223 253 } 224 254 255 int get_firmware_revision(){ 256 257 fd_set ReadFileDescriptor; 258 int max_fd = 0; 259 260 int read_return; 261 unsigned char buffer[984]; 262 unsigned short x,rev; 263 264 max_fd = GetMaxFileDescriptor(SOCKETS_PER_FAD, SocketDescriptor); 265 266 cmd_send ("sra 10\n", SocketDescriptor[0]); 267 cmd_send ("t\n", SocketDescriptor[0]); 268 sleep (1); 269 270 271 FD_ZERO (&ReadFileDescriptor); 272 for (int i = 0; i < SOCKETS_PER_FAD; i++) 273 { 274 FD_SET (SocketDescriptor[i], &ReadFileDescriptor); 275 } 276 277 // Wait for data from sockets 278 if (select (((int) max_fd) + 1, &ReadFileDescriptor, NULL, NULL, NULL) == -1) 279 { 280 perror ("Error with select()\n"); 281 282 } 283 284 285 // Check all sockets 286 for (int i = 0; i < SOCKETS_PER_FAD; i++) 287 { 288 if (FD_ISSET (SocketDescriptor[i], &ReadFileDescriptor)) 289 { 290 if ((read_return = read (SocketDescriptor[i], buffer, 984)) == 0) 291 { 292 printf ("Error: Server not existing anymore, exiting...\n"); 293 return -1; 294 } 295 if (read_return > 0) 296 { 297 printf ("Socket [%d]: Read %d Bytes\n", i, read_return); 298 } 299 } 300 } 301 302 rev = (unsigned char)buffer[4]<<8 | (unsigned char)buffer [5]; 303 304 return rev; 305 } 306
Note:
See TracChangeset
for help on using the changeset viewer.