added PrintACQStatus

This commit is contained in:
carina@hades 2022-08-09 17:31:36 -04:00
parent 223d751ba3
commit 1f943d8ded
4 changed files with 47 additions and 29 deletions

View File

@ -292,20 +292,15 @@ void Digitizer::WriteRegister(uint32_t address, uint32_t value, int ch ){
ErrorMsg("WriteRegister"); ErrorMsg("WriteRegister");
} }
uint32_t Digitizer::ReadRegister(uint32_t address, unsigned int ch, string str ){ uint32_t Digitizer::ReadRegister(uint32_t address, int ch, string str ){
uint32_t * Data = new uint32_t[NChannel]; uint32_t * Data = new uint32_t[NChannel];
printf("=dsadads====== 0x%x \n", address);
if( address < 0x8000) { if( address < 0x8000) {
if( ch < 0 ) { if( ch < 0 ) {
printf("a %d-- %x \n", ch, address + 0x7000);
ret = CAEN_DGTZ_ReadRegister(handle, address + 0x7000, Data); ret = CAEN_DGTZ_ReadRegister(handle, address + 0x7000, Data);
}else{ }else{
printf("b %d -- %x \n", ch, address + (ch << 8));
ret = CAEN_DGTZ_ReadRegister(handle, address + (ch << 8), Data); ret = CAEN_DGTZ_ReadRegister(handle, address + (ch << 8), Data);
} }
}else{ }else{
printf("--- %x \n", address);
ret = CAEN_DGTZ_ReadRegister(handle, address, Data); ret = CAEN_DGTZ_ReadRegister(handle, address, Data);
} }
ErrorMsg("ReadRegister"); ErrorMsg("ReadRegister");
@ -457,6 +452,24 @@ int Digitizer::GetChTemperature(int ch){
return temp[0]; return temp[0];
} }
void Digitizer::PrintACQStatue(){
unsigned int status = ReadRegister(Register::DPP::AcquisitionStatus);
printf(" Acq state (0x%1x): %s \n", (status >> 2) & 0x1, ((status >> 2) & 0x1) == 0? "stopped" : "running");
printf(" Event Ready (0x%1x): %s \n", (status >> 3) & 0x1, ((status >> 3) & 0x1) == 0? "no event in buffer" : "event in buffer");
printf(" Event Full (0x%1x): %s \n", (status >> 4) & 0x1, ((status >> 4) & 0x1) == 0? "not full" : "full");
printf(" Clock source (0x%1x): %s \n", (status >> 5) & 0x1, ((status >> 5) & 0x1) == 0? "internal" : "external");
printf(" Board ready (0x%1x): %s \n", (status >> 8) & 0x1, ((status >> 8) & 0x1) == 0? "not ready" : "ready");
printf(" Ch shutDown (0x%1x): %s \n", (status >> 19) & 0x1, ((status >> 19) & 0x1) == 0? "Channels are on" : "channels are shutdown");
printf(" TRG-IN 0x%1x \n", (status >> 16) & 0x1);
printf(" Ch temp state 0x%04x \n", (status >> 20) & 0xF);
}
//========================================== setting file IO
void Digitizer::OpenSettingBinary(string fileName){ void Digitizer::OpenSettingBinary(string fileName){
settingFile = NULL; settingFile = NULL;
this->settingFileName = fileName; this->settingFileName = fileName;

View File

@ -33,7 +33,7 @@ class Digitizer{
///=================Settings ///=================Settings
void WriteRegister(uint32_t address, uint32_t value, int ch = -1); void WriteRegister(uint32_t address, uint32_t value, int ch = -1);
uint32_t ReadRegister(uint32_t address, unsigned int ch = 0, string str = ""); uint32_t ReadRegister(uint32_t address, int ch = -1, string str = "");
///common for PHA and PSD digitizers ///common for PHA and PSD digitizers
void SetChannelMask(uint32_t mask); void SetChannelMask(uint32_t mask);
@ -63,6 +63,7 @@ class Digitizer{
int GetDPPType() {return DPPType;} int GetDPPType() {return DPPType;}
void PrintBoardConfiguration(); void PrintBoardConfiguration();
void PrintACQStatue();
///================ ACQ control ///================ ACQ control
void StopACQ(); void StopACQ();

View File

@ -71,8 +71,8 @@ namespace Register {
const uint32_t InputDynamicRange = 0x1028; /// R/W const uint32_t InputDynamicRange = 0x1028; /// R/W
const uint32_t NumberEventsPerAggregate_G = 0x1034; /// R/W const uint32_t NumberEventsPerAggregate_G = 0x1034; /// R/W
const uint32_t PreTrigger = 0x1038; /// R/W const uint32_t PreTrigger = 0x1038; /// R/W
///const uint32_t TriggerThreshold = 0x106C; /// R/W const uint32_t TriggerThreshold = 0x106C; /// R/W
///const uint32_t TriggerHoldOffWidth = 0x1074; /// R/W const uint32_t TriggerHoldOffWidth = 0x1074; /// R/W
const uint32_t DPPAlgorithmControl = 0x1080; /// R/W const uint32_t DPPAlgorithmControl = 0x1080; /// R/W
const uint32_t ChannelStatus = 0x1088; /// R const uint32_t ChannelStatus = 0x1088; /// R
const uint32_t AMCFirmwareRevision = 0x108C; /// R const uint32_t AMCFirmwareRevision = 0x108C; /// R
@ -81,6 +81,7 @@ namespace Register {
const uint32_t IndividualSoftwareTrigger = 0x10C0; /// W const uint32_t IndividualSoftwareTrigger = 0x10C0; /// W
const uint32_t VetoWidth = 0x10D4; /// R/W const uint32_t VetoWidth = 0x10D4; /// R/W
/// I know there are many duplication, it is the design.
const uint32_t BoardConfiguration = 0x8000; /// R/W const uint32_t BoardConfiguration = 0x8000; /// R/W
const uint32_t AggregateOrganization = 0x800C; /// R/W const uint32_t AggregateOrganization = 0x800C; /// R/W
const uint32_t ADCCalibration = 0x809C; /// W const uint32_t ADCCalibration = 0x809C; /// W

View File

@ -22,32 +22,35 @@ int main(int argc, char* argv[]){
//dig[0].ReadRegister(Register::DPP::PHA::TriggerThreshold, 0, "trigger threshold"); //dig[0].ReadRegister(Register::DPP::PHA::TriggerThreshold, 0, "trigger threshold");
//dig[0].CreateAndSaveSettingBinary("test.bin"); //dig[0].CreateAndSaveSettingBinary("setting_" + to_string(dig[0].GetSerialNumber()) + ".bin");
dig[0].OpenSettingBinary("setting_" + to_string(dig[0].GetSerialNumber()) + ".bin");
dig[0].SetAcqMode("mixed");
dig[0].PrintACQStatue();
dig[0].OpenSettingBinary("test.bin");
// //
//printf("0x%x \n", (unsigned int)dig[0].ReadSettingBinary(Register::DPP::BoardConfiguration)); //printf("0x%x \n", (unsigned int)dig[0].ReadSettingBinary(Register::DPP::BoardConfiguration));
//printf("0x%x \n", (unsigned int)dig[0].ReadSettingBinary(Register::DPP::GlobalTriggerMask)); //printf("0x%x \n", (unsigned int)dig[0].ReadSettingBinary(Register::DPP::GlobalTriggerMask));
//printf("0x%x \n", (unsigned int)dig[0].ReadSettingBinary(Register::DPP::PHA::TriggerThreshold, 0)); //printf("0x%x \n", (unsigned int)dig[0].ReadSettingBinary(Register::DPP::PHA::TriggerThreshold, 0));
printf("======================= \n"); //printf("======================= \n");
dig[0].SetRecordLength(2000); //dig[0].SetRecordLength(2000);
//
dig[0].GetChannelSettingFromDigitizer(0); //dig[0].GetChannelSettingFromDigitizer(0);
//
printf("0x%x \n", (unsigned int)dig[0].ReadSettingBinary(Register::DPP::RecordLength_G, 0)); //printf("0x%x \n", (unsigned int)dig[0].ReadSettingBinary(Register::DPP::RecordLength_G, 0));
printf("0x%x \n", (unsigned int)dig[0].ReadSettingBinary(Register::DPP::RecordLength_G, 4)); //printf("0x%x \n", (unsigned int)dig[0].ReadSettingBinary(Register::DPP::RecordLength_G, 4));
//
dig[0].SetRecordLength(4000); //dig[0].SetRecordLength(4000);
//
printf("0x%x \n", (unsigned int)dig[0].ReadSettingBinary(Register::DPP::RecordLength_G, 0)); //printf("0x%x \n", (unsigned int)dig[0].ReadSettingBinary(Register::DPP::RecordLength_G, 0));
printf("0x%x \n", (unsigned int)dig[0].ReadSettingBinary(Register::DPP::RecordLength_G, 3)); //printf("0x%x \n", (unsigned int)dig[0].ReadSettingBinary(Register::DPP::RecordLength_G, 3));
printf("0x%x \n", (unsigned int)dig[0].ReadSettingBinary(Register::DPP::RecordLength_G, 6)); //printf("0x%x \n", (unsigned int)dig[0].ReadSettingBinary(Register::DPP::RecordLength_G, 6));
//
dig[0].SetRecordLength(3000, 0); //dig[0].SetRecordLength(3000, 0);
printf("0x%x \n", (unsigned int)dig[0].ReadSettingBinary(Register::DPP::RecordLength_G, 0)); //printf("0x%x \n", (unsigned int)dig[0].ReadSettingBinary(Register::DPP::RecordLength_G, 0));
printf("0x%x \n", (unsigned int)dig[0].ReadSettingBinary(Register::DPP::RecordLength_G, 1)); //printf("0x%x \n", (unsigned int)dig[0].ReadSettingBinary(Register::DPP::RecordLength_G, 1));
printf("0x%x \n", (unsigned int)dig[0].ReadSettingBinary(Register::DPP::RecordLength_G, 2)); //printf("0x%x \n", (unsigned int)dig[0].ReadSettingBinary(Register::DPP::RecordLength_G, 2));
/* dig[1].OpenDigitizer(1,0, true); /* dig[1].OpenDigitizer(1,0, true);
/* /*