Skip to content
Snippets Groups Projects
Commit 1174b201 authored by ELATTAOUI's avatar ELATTAOUI
Browse files

xavier :

Keithley DDC part -> no more data with prefix
TODO : change all DDC files.
parent 93dad89e
No related branches found
No related tags found
No related merge requests found
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
</parent> </parent>
<groupId>fr.soleil.lib</groupId> <groupId>fr.soleil.lib</groupId>
<artifactId>Electrometers-${aol}-${library}-${mode}</artifactId> <artifactId>Electrometers-${aol}-${library}-${mode}</artifactId>
<version>2.2.1</version> <version>2.2.2</version>
<packaging>nar</packaging> <packaging>nar</packaging>
<name>Electrometers library</name> <name>Electrometers library</name>
<description>Electrometers library</description> <description>Electrometers library</description>
......
...@@ -58,6 +58,9 @@ bool KeithleyDDCProtocol::build_communicationLink() ...@@ -58,6 +58,9 @@ bool KeithleyDDCProtocol::build_communicationLink()
if (!_communication_link) if (!_communication_link)
return false; return false;
//- Read data with no prefix
this->disable_readingWithPrefix();
return true; return true;
} }
...@@ -294,25 +297,27 @@ std::string argout("no data"); ...@@ -294,25 +297,27 @@ std::string argout("no data");
//- send command : G0X -> prefix (to check if device overload !) and second X to get data //- send command : G0X -> prefix (to check if device overload !) and second X to get data
// cmd_to_send << "G0" << std::ends; // cmd_to_send << "G0" << std::ends;
// _communication_link->write(cmd_to_send.str()); //this->disable_readingWithPrefix();
this->enable_readingWithPrefix();
//- get data value //- get data value
// cmd_to_send << "X" << std::ends; cmd_to_send << "X" << std::ends;
argout = _communication_link->read(); _communication_link->write(cmd_to_send.str());
argout = _communication_link->read();
std::cout << "KeithleyDDCProtocol::get_value = " << argout << std::endl;
// this->enable_readingWithPrefix();
//- send command : G1X -> no prefix and second X to get data //- send command : G1X -> no prefix and second X to get data
// cmd_to_send << "G1X" << std::ends; // cmd_to_send << "G1X" << std::ends;
// _communication_link->write(cmd_to_send.str()); // _communication_link->write(cmd_to_send.str());
this->disable_readingWithPrefix();
//- check if device range is overloaded //- check if device range is overloaded
if(argout[0] == 'O') //if(argout[0] == 'O')
_is_overloaded = true; // _is_overloaded = true;
else //else
_is_overloaded = false; // _is_overloaded = false;
//- return value : data begin at idx 4 //- return value : data begin at idx 4
argout = argout.substr(4); //argout = argout.substr(4);
return argout; return argout;
} }
...@@ -409,15 +414,15 @@ std::stringstream cmd_to_send; ...@@ -409,15 +414,15 @@ std::stringstream cmd_to_send;
std::string argout("no data"); std::string argout("no data");
//- send command : G0X -> show prefix ( = keithley type ) //- send command : G0X -> show prefix ( = keithley type )
this->enable_readingWithPrefix(); //this->enable_readingWithPrefix();
cmd_to_send.str(""); cmd_to_send.str("");
//- get status word //- get status word
cmd_to_send << "U1X" << std::endl; cmd_to_send << "U1X" << std::endl;
argout = _communication_link->write_read(cmd_to_send.str()); argout = _communication_link->write_read(cmd_to_send.str());
// std::cout << "\n\nKeithleyDDCProtocol::get_raw_status returns *" << argout << "*" << std::ends; std::cout << "KeithleyDDCProtocol::get_raw_status returns *" << argout << "*" << std::ends;
this->disable_readingWithPrefix(); // this->disable_readingWithPrefix();
return argout; return argout;
} }
...@@ -431,15 +436,15 @@ std::stringstream cmd_to_send; ...@@ -431,15 +436,15 @@ std::stringstream cmd_to_send;
std::string argout("no data"); std::string argout("no data");
//- send command : G0X -> show prefix ( = keithley type ) //- send command : G0X -> show prefix ( = keithley type )
this->enable_readingWithPrefix(); //this->enable_readingWithPrefix();
cmd_to_send.str(""); cmd_to_send.str("");
//- get status word //- get status word
cmd_to_send << "U0X" << std::endl; cmd_to_send << "U0X" << std::endl;
argout = _communication_link->write_read(cmd_to_send.str()); argout = _communication_link->write_read(cmd_to_send.str());
// std::cout << "\n\nKeithleyDDCProtocol::get_DDC_configuration returns *" << argout << "*" << std::ends; std::cout << "KeithleyDDCProtocol::get_DDC_configuration returns *" << argout << "*" << std::ends;
this->disable_readingWithPrefix(); //this->disable_readingWithPrefix();
return argout; return argout;
} }
......
...@@ -178,7 +178,8 @@ std::stringstream cmd_to_send; ...@@ -178,7 +178,8 @@ std::stringstream cmd_to_send;
std::string Keithley_485::electrometer_status (void) std::string Keithley_485::electrometer_status (void)
{ {
std::string _kstatus("undefined status"); std::string _kstatus("undefined status");
std::string argout("undefined status"); std::string defaultStatus("0000000000");
std::string argout("");
std::string tmp(""); std::string tmp("");
//- read keithley status from HW //- read keithley status from HW
...@@ -188,46 +189,52 @@ std::string Keithley_485::electrometer_status (void) ...@@ -188,46 +189,52 @@ std::string Keithley_485::electrometer_status (void)
try try
{ {
//- model number : //- model number :
std::string modelNum = _kstatus.substr(0,3); //std::string modelNum = _kstatus.substr(0,3);
//- if not expected data (here model number) ////- if not expected data (here model number)
if(modelNum.find("485") == std::string::npos) //if(modelNum.find("485") == std::string::npos)
//{
// set_electroState(ALARM);
// argout = "Invalid status string received";
// return argout;
//}
//argout = "Keithley Type : " + modelNum + "\n";
if ( _kstatus.size() < defaultStatus.size() )
{ {
argout = _kstatus;
set_electroState(ALARM); set_electroState(ALARM);
argout = "Invalid status string received";
return argout; return argout;
} }
argout = "Keithley Type : " + modelNum + "\n";
//- Zero check state //- Zero check state
tmp = _kstatus.substr(3,1); tmp = _kstatus.substr(0,1);
if(XString<short>::convertFromString(tmp)) if(XString<short>::convertFromString(tmp))
argout += "Zero Check : ON\n"; argout += "Zero Check : ON\n";
else else
argout += "Zero Check : OFF\n"; argout += "Zero Check : OFF\n";
//- Log state //- Log state
tmp = _kstatus.substr(4,1); tmp = _kstatus.substr(1,1);
if(XString<short>::convertFromString(tmp)) if(XString<short>::convertFromString(tmp))
argout += "Log : ON\n"; argout += "Log : ON\n";
else else
argout += "Log : OFF\n"; argout += "Log : OFF\n";
//- Range //- Range
tmp = _kstatus.substr(5,1); tmp = _kstatus.substr(2,1);
_range = XString<short>::convertFromString(tmp); _range = XString<short>::convertFromString(tmp);
_rangeStr = K485_rangeValue[_range]; _rangeStr = K485_rangeValue[_range];
argout += _rangeStr + "\n"; argout += _rangeStr + "\n";
//- Relative (baseline suppress) //- Relative (baseline suppress)
tmp = _kstatus.substr(6,1); tmp = _kstatus.substr(3,1);
if(XString<short>::convertFromString(tmp)) if(XString<short>::convertFromString(tmp))
argout += "Relative ON\n"; argout += "Relative ON\n";
else else
argout += "Relative OFF\n"; argout += "Relative OFF\n";
//- Relative (baseline suppress) //- Relative (baseline suppress)
tmp = _kstatus.substr(7,1); tmp = _kstatus.substr(4,1);
if(XString<short>::convertFromString(tmp)) if(XString<short>::convertFromString(tmp))
argout += "EOI : Send\n"; argout += "EOI : Send\n";
else else
argout += "EOI : Do Not Send\n"; argout += "EOI : Do Not Send\n";
//- Trigger //- Trigger
tmp = _kstatus.substr(8,1); tmp = _kstatus.substr(5,1);
short trigg = XString<short>::convertFromString(tmp); short trigg = XString<short>::convertFromString(tmp);
if(!trigg) if(!trigg)
argout += "Trigger : Continuous on Talk\n"; argout += "Trigger : Continuous on Talk\n";
...@@ -247,7 +254,7 @@ std::string Keithley_485::electrometer_status (void) ...@@ -247,7 +254,7 @@ std::string Keithley_485::electrometer_status (void)
if(trigg == 5) if(trigg == 5)
argout += "Trigger :One-Shot on \"X\"\n"; argout += "Trigger :One-Shot on \"X\"\n";
//- SRQ Data Mask //- SRQ Data Mask
tmp = _kstatus.substr(9,2); tmp = _kstatus.substr(6,2);
short srqInfo = XString<short>::convertFromString(tmp); short srqInfo = XString<short>::convertFromString(tmp);
if(!srqInfo) if(!srqInfo)
argout += "SRQ Data Mask : SRQ Disabled\n"; argout += "SRQ Data Mask : SRQ Disabled\n";
...@@ -273,7 +280,7 @@ std::string Keithley_485::electrometer_status (void) ...@@ -273,7 +280,7 @@ std::string Keithley_485::electrometer_status (void)
if(srqInfo == 25) if(srqInfo == 25)
argout += "SRQ Data Mask : Busy, Reading Done or Reading Overflow\n"; argout += "SRQ Data Mask : Busy, Reading Done or Reading Overflow\n";
//- SRQ Error Mask //- SRQ Error Mask
tmp = _kstatus.substr(9,2); tmp = _kstatus.substr(6,2);
short srqMaskErr = XString<short>::convertFromString(tmp); short srqMaskErr = XString<short>::convertFromString(tmp);
if(!srqMaskErr) if(!srqMaskErr)
argout += "SRQ Error Mask : SRQ Disabled\n"; argout += "SRQ Error Mask : SRQ Disabled\n";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment