Changeset 10969
- Timestamp:
- 06/10/11 08:23:22 (13 years ago)
- Location:
- fact/FADctrl
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
fact/FADctrl/FAD.cc
r10913 r10969 32 32 {"roi", &FAD::cmd_roi, true, 2, "<range> <value>", "Set ROI to for channel range to value"}, 33 33 {"dac", &FAD::cmd_dac, true, 2, "<range> <value>", "Set DAC numbers in range to value"}, 34 {"execute", &FAD::cmd_execute, true, 0, "", "confirm FAD configuration settings, e.g. DAC, ROI, run#"}, 34 35 {"address", &FAD::cmd_address, true, 2, "<range> <value>", "Set addresses in range to value"}, 35 36 {"send", &FAD::cmd_send, true, 1, "<value>", "Send arbitrary data to board"}, … … 205 206 206 207 // 208 // Execute: Confirm new ROI, DAC or what ever settings 209 // 210 211 void FAD::cmd_execute() { 212 213 for (unsigned int i=0; i<Boards.size(); i++) Boards[i]->Send(CMD_Execute); 214 } 215 216 217 // 207 218 // Set run number 208 219 // 209 220 void FAD::cmd_runnumber() { 210 221 222 unsigned short Buffer[4] = {0}; 211 223 int Num; 212 224 … … 215 227 return; 216 228 } 229 Buffer[0] = htons(CMD_Write | ADDR_RUNNUMBER); 230 Buffer[1] = htons( (unsigned short)( ((unsigned int)Num) >> 16 ) ); 231 Buffer[2] = htons(CMD_Write | (ADDR_RUNNUMBER + 1) ); 232 Buffer[3] = htons( (unsigned short)Num ); 217 233 218 234 for (unsigned int i=0; i<Boards.size(); i++) { 219 Boards[i]->Send(CMD_Write | ADDR_RUNNUMBER ); 220 Boards[i]->Send((unsigned short) (Num>>16)); // Write the HIGH-word first 221 Boards[i]->Send(CMD_Write | (ADDR_RUNNUMBER+1) ); 222 Boards[i]->Send((unsigned short) Num); // now write the LOW-word 235 Boards[i]->Send(Buffer, sizeof(Buffer)); 236 Boards[i]->Send(CMD_Execute); 223 237 } 224 238 } … … 351 365 for (unsigned int i=0; i<Boards.size(); i++) { 352 366 Boards[i]->Send(Buffer, sizeof(Buffer)); 367 Boards[i]->Send(CMD_Execute); 353 368 } 354 369 } … … 380 395 } 381 396 382 // Disable triggers for all boards and wait (workaround for firmware bug)383 for (unsigned int i=0; i<Boards.size(); i++) Boards[i]->Send(CMD_TRIGGERS_OFF);384 usleep(500000);385 397 386 398 // Send command buffer and enable triggers again 387 399 for (unsigned int i=0; i<Boards.size(); i++) { 388 Boards[i]->Send(Buffer, sizeof(Buffer)); 389 Boards[i]->Send(CMD_TRIGGERS_ON); 390 } 400 Boards[i]->Send(Buffer+R.Min*2, (R.Max-R.Min+1)*2*sizeof(unsigned short)); 401 Boards[i]->Send(CMD_Execute); 402 } 403 404 391 405 } 392 406 -
fact/FADctrl/FAD.h
r10757 r10969 71 71 void cmd_trigger(); void cmd_socketmode(); 72 72 void cmd_runnumber(); void cmd_reset(); 73 void cmd_execute(); 73 74 void cmd_srclk(); void cmd_sclk(); 74 75 void cmd_dwrite(); void cmd_domino(); -
fact/FADctrl/FADBoard.cc
r10813 r10969 168 168 169 169 vector<unsigned short> ROICmd; 170 unsigned short DACCmd[] = {htons(CMD_Write | (BADDR_DAC + 1)), 0, htons(CMD_Write | (BADDR_DAC + 2)), 0, htons(CMD_Write | (BADDR_DAC + 3)), 0 };170 unsigned short DACCmd[] = {htons(CMD_Write | (BADDR_DAC + 1)), 0, htons(CMD_Write | (BADDR_DAC + 2)), 0, htons(CMD_Write | (BADDR_DAC + 3)), 0, htons(CMD_Execute) }; 171 171 string Message = string("ACALIBDONE")+Name+"\n"; 172 172 … … 183 183 InitialStatus = GetStatus(); 184 184 185 Send(CMD_TRIGGERS_OFF);186 usleep(500000);187 188 185 for (unsigned int i=0; i<NChips*NChannels; i++) { 189 186 ROICmd.push_back(htons(CMD_Write | (BADDR_ROI + i))); 190 187 ROICmd.push_back(htons(NBins)); 191 188 } 189 ROICmd.push_back(htons(CMD_Execute)); 192 190 Send(&ROICmd[0], ROICmd.size()*sizeof(unsigned short)); 193 191 194 195 196 192 DACCmd[1] = htons(0); 193 DACCmd[3] = htons(0); 194 DACCmd[5] = htons(0); 197 195 Send(DACCmd, sizeof(DACCmd)); 198 199 Send(CMD_TRIGGERS_ON);200 196 201 197 // Clear sum vector and set state to accumulate … … 335 331 case cleanup: 336 332 // ROI values 337 Send(CMD_TRIGGERS_OFF);338 usleep(100000);339 333 340 334 ROICmd.clear(); … … 343 337 ROICmd.push_back(htons(InitialStatus.ROI[i/NChannels][i%NChannels])); 344 338 } 339 ROICmd.push_back(htons(CMD_Execute)); 345 340 Send(&ROICmd[0], ROICmd.size()*sizeof(unsigned short)); 346 341 347 Send(CMD_TRIGGERS_ON);348 349 342 // DAC values 350 351 352 343 DACCmd[1] = htons(InitialStatus.DAC[1]); 344 DACCmd[3] = htons(InitialStatus.DAC[2]); 345 DACCmd[5] = htons(InitialStatus.DAC[3]); 353 346 Send(DACCmd, sizeof(DACCmd)); 354 347 -
fact/FADctrl/FADFormat.h
r10504 r10969 27 27 #define CMD_Trigger_C 0xB000 // continous trigger 28 28 #define CMD_Trigger_S 0x2000 // stop continous trigger 29 30 #define CMD_Execute 0x0400 // only after 'execute' Config-RAM changes will have an effect 31 #define CMD_Write 0x0500 // write to Config-RAM 29 32 #define CMD_Read 0x0A00 // read from Config-RAM 30 #define CMD_Write 0x0500 // write to Config-RAM31 33 #define CMD_RESET_TRIGGER_ID 0x2A00 32 34
Note:
See TracChangeset
for help on using the changeset viewer.