Changeset 46
- Timestamp:
- 05/22/09 15:07:38 (16 years ago)
- Location:
- hvcontrol
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
hvcontrol/HV.conf
r39 r46 1 # Main configuration file for the HV control program V1.0, 2009 05 13, 11:37:071 # Main configuration file for the HV control program V1.0, 2009 05 22, 15:16:02 2 2 # Note: this file will be updated at program exit 3 3 4 4 LogPath /home/lstark/hvcontrol/log/ 5 6 PixMapTable ../config/PixelMap.txt 5 7 6 8 TimeOut 0.10 s # Timeout to return from read (0.01,...5.00) s -
hvcontrol/Makefile
r41 r46 7 7 OBJECTS = $(addsuffix .o, $(basename $(SOURCES))) 8 8 9 #INCDIRS = -I. -IDRS -I../pixelmap10 9 INCDIRS = -I. -I../pixelmap -I./src 11 10 -
hvcontrol/src/HVCalib.cc
r40 r46 99 99 } 100 100 101 //for(int i=0; i<hvConfig->NumHVBoards; i++){102 for(int i=0; i<1; i++){103 //for(int j=0;j<NCHAIN;j++){104 for(int j=0;j<1;j++){105 //for(int k=0;k<NCHANNEL;k++){106 101 for(int i=0; i<hvConfig->NumHVBoards; i++){ 102 // for(int i=0; i<1; i++){ 103 for(int j=0;j<NCHAIN;j++){ 104 // for(int j=0;j<1;j++){ 105 for(int k=0;k<NCHANNEL;k++){ 106 //for(int k=0;k<1;k++){ 107 107 ihvOld = 0; 108 108 first = true; -
hvcontrol/src/HVConfig.cc
r35 r46 21 21 fUSBDevice = new char*[MAX_NUM_HVBOARDS]; 22 22 fCCClient = new char[FILENAME_MAX_SIZE]; 23 24 fPixMapTable = new char[FILENAME_MAX_SIZE]; 23 25 24 26 for (int i=0; i<MAX_NUM_HVBOARDS; i++) { … … 56 58 57 59 delete [] fLogPath; 60 delete [] fPixMapTable; 58 61 59 62 for (int i=0; i<MAX_NUM_HVBOARDS; i++) … … 78 81 } 79 82 80 ReadCard("LogPath",fLogPath,'s',f); 83 ReadCard("LogPath", fLogPath,'s',f); 84 85 ReadCard("PixMapTable",fPixMapTable,'s',f); 81 86 82 87 for (int i=0;i<MAX_NUM_HVBOARDS;i++) { … … 118 123 fprintf(fptr," HV control configuration (%s):\n\n", FileName); 119 124 fprintf(fptr," Log path: %s\n\n", fLogPath); 125 fprintf(fptr," Pixel map table: %s\n\n", fPixMapTable); 120 126 fprintf(fptr," %.2d USB devices:\n\n", NumHVBoards); 121 127 … … 170 176 171 177 fprintf(f,"LogPath %s\n\n", fLogPath); 178 fprintf(f,"PixMapTable %s\n\n", fPixMapTable); 172 179 173 180 fprintf(f,"TimeOut %.2f s # Timeout to return from read (%.2f,...%.2f) s\n\n",fTimeOut,MIN_TIMEOUT,MAX_TIMEOUT); -
hvcontrol/src/HVConfig.h
r35 r46 33 33 char** fUSBDevice; 34 34 35 char* fPixMapTable; 36 35 37 float fTimeOut; 36 38 float fStatusRefreshRate; -
hvcontrol/src/ProcessIO.cc
r39 r46 26 26 hv = new HV(config->fUSBDevice,config->USBDeviceNumber,stdout); 27 27 28 pm = new PixelMap("../fact_repos.svn/config/PixelMap.txt"); 28 pm = new PixelMap(config->fPixMapTable); 29 printf("PixMapTable = %s. \n",config->fPixMapTable); 29 30 30 31 // Initialize status structure (HVStatus.cc/h) … … 284 285 285 286 int errors = 0; 286 unsigned int hvoltage = 0 ;287 unsigned int hvoltage = 0, hvAll = 0; 287 288 float hvoltageV = 0.0; 288 int channel = 0 ;289 int channel = 0, hvdiff = 0; 289 290 bool allchannels = FALSE; 290 291 … … 352 353 status->HVV[i][j][channel]=hvoltageV; 353 354 hvoltage = calib->HVToDAC(hvoltageV,i,j,channel); 354 printf("HV = %f, dac hv = %d .\n",hvoltageV,hvoltage);355 355 } 356 if ((hv->GetHVBoard(i))->SetHV(stdout,j,channel,hvoltage,rbuf,status->Verbose)==1){ 357 status->HV[i][j][channel]=hvoltage; 358 UpdateStatus(i,rbuf); 359 360 sprintf(str,"board %d: high voltage of chain %d channel %d set to %d | 0X%.4X | %f V\n",hv->GetHVBoard(i)->GetBoardNumber(),j,channel,hvoltage,hvoltage,calib->DACToHV(hvoltage,hv->GetHVBoard(i)->GetBoardNumber(),j,channel)); 361 DoPrompt(str); 362 if (status->Verbose) { 363 sPrintStatus(status,str,i); 364 DoPrompt(str); 356 hvdiff = hvoltage - status->HV[i][j][channel]; 357 for (int k=0;k<=abs((int)(hvdiff/config->fHVMaxDiff));k++){ 358 if (k<abs((int)(hvdiff/config->fHVMaxDiff))){ 359 hvoltage=(unsigned int)(status->HV[i][j][channel] + config->fHVMaxDiff*hvdiff/abs(hvdiff)); 365 360 } 366 sPrintStatus(status,str,i); // Print status only to socket 367 } 368 else { 369 sprintf(str,"board %d error: could not set hv - check timeout and try again\n",hv->GetHVBoard(i)->GetBoardNumber()); 370 DoPrompt(str); 371 errors++; 372 } 373 } 374 375 else { 376 sprintf(str,"updating board %d chain %d\n",hv->GetHVBoard(i)->GetBoardNumber(),j); 377 DoPrompt(str); 378 379 for (int k=0;k<MAX_NUM_CHANNELS;k++) { 380 // Convert from HV to DAC values 381 if (!(config->IsDAC)){ 382 status->HVV[i][j][channel]=hvoltageV; 383 hvoltage = calib->HVToDAC(hvoltageV,i,j,k); 361 if (k==(abs((int)(hvdiff/config->fHVMaxDiff)))){ 362 hvoltage=(unsigned int)(status->HV[i][j][channel] + (hvdiff%(int)config->fHVMaxDiff)); 384 363 } 385 if ((hv->GetHVBoard(i))->SetHV(stdout,j,k,hvoltage,rbuf,status->Verbose)==1) { 386 status->HV[i][j][k]=hvoltage; 364 365 if ((hv->GetHVBoard(i))->SetHV(stdout,j,channel,hvoltage,rbuf,status->Verbose)==1){ 366 status->HV[i][j][channel]=hvoltage; 387 367 UpdateStatus(i,rbuf); 388 368 369 sprintf(str,"board %d: high voltage of chain %d channel %d set to %d | 0X%.4X | %f V\n",hv->GetHVBoard(i)->GetBoardNumber(),j,channel,hvoltage,hvoltage,calib->DACToHV(hvoltage,hv->GetHVBoard(i)->GetBoardNumber(),j,channel)); 370 // DoPrompt(str); 389 371 if (status->Verbose) { 390 sprintf(str,"board %d: high voltage of chain %d channel %d set to %d | 0X%.4X | %f V\n",hv->GetHVBoard(i)->GetBoardNumber(),j,channel,hvoltage,hvoltage,calib->DACToHV(hvoltage,hv->GetHVBoard(i)->GetBoardNumber(),j,channel));391 //sprintf(str,"board %d: high voltage of chain %d channel %d set to %d | 0X%.4X\n",hv->GetHVBoard(i)->GetBoardNumber(),j,k,hvoltage,hvoltage);392 DoPrompt(str);393 372 sPrintStatus(status,str,i); 394 373 DoPrompt(str); 395 374 } 396 375 sPrintStatus(status,str,i); // Print status only to socket 397 398 376 } 399 377 else { 400 sprintf(str,"board %d error: could not set HV- check timeout and try again\n",hv->GetHVBoard(i)->GetBoardNumber());378 sprintf(str,"board %d error: could not set hv - check timeout and try again\n",hv->GetHVBoard(i)->GetBoardNumber()); 401 379 DoPrompt(str); 402 380 errors++; 381 } 382 } 383 } 384 else { 385 sprintf(str,"updating board %d chain %d\n",hv->GetHVBoard(i)->GetBoardNumber(),j); 386 DoPrompt(str); 387 388 for (int k=0;k<MAX_NUM_CHANNELS;k++) { 389 // Convert from HV to DAC values 390 if (!(config->IsDAC)){ 391 status->HVV[i][j][k]=hvoltageV; 392 hvoltage = calib->HVToDAC(hvoltageV,i,j,k); 393 } 394 hvAll = hvoltage; 395 hvdiff = hvAll - status->HV[i][j][k]; 396 for (int l=0;l<=abs((int)(hvdiff/config->fHVMaxDiff));l++){ 397 if (l<abs((int)(hvdiff/config->fHVMaxDiff))){ 398 hvoltage=(unsigned int)(status->HV[i][j][k] + config->fHVMaxDiff*hvdiff/abs(hvdiff)); 399 } 400 if (l==(abs((int)(hvdiff/config->fHVMaxDiff)))){ 401 hvoltage=(unsigned int)(status->HV[i][j][k] + (hvdiff%(int)config->fHVMaxDiff)); 402 } 403 if ((hv->GetHVBoard(i))->SetHV(stdout,j,k,hvoltage,rbuf,status->Verbose)==1) { 404 status->HV[i][j][k]=hvoltage; 405 UpdateStatus(i,rbuf); 406 407 if (status->Verbose) { 408 sprintf(str,"board %d: high voltage of chain %d channel %d set to %d | 0X%.4X | %f V\n",hv->GetHVBoard(i)->GetBoardNumber(),j,channel,hvoltage,hvoltage,calib->DACToHV(hvoltage,hv->GetHVBoard(i)->GetBoardNumber(),j,channel)); 409 //sprintf(str,"board %d: high voltage of chain %d channel %d set to %d | 0X%.4X\n",hv->GetHVBoard(i)->GetBoardNumber(),j,k,hvoltage,hvoltage); 410 // DoPrompt(str); 411 sPrintStatus(status,str,i); 412 DoPrompt(str); 413 } 414 sPrintStatus(status,str,i); // Print status only to socket 415 } 416 417 else { 418 sprintf(str,"board %d error: could not set HV - check timeout and try again\n",hv->GetHVBoard(i)->GetBoardNumber()); 419 DoPrompt(str); 420 errors++; 421 } 403 422 } 404 423 }
Note:
See TracChangeset
for help on using the changeset viewer.