Skip to content
Snippets Groups Projects
Commit 0a94c6e5 authored by ELATTAOUI's avatar ELATTAOUI
Browse files

xavier :

Keithley DDC part ->devices are very slow (exp 485 model) so write_read cmd is splitted !
parent d4800cd3
No related branches found
No related tags found
No related merge requests found
...@@ -60,7 +60,7 @@ bool KeithleyDDCProtocol::build_communicationLink() ...@@ -60,7 +60,7 @@ bool KeithleyDDCProtocol::build_communicationLink()
//- For DDC models are very slow devices, so communication with //- For DDC models are very slow devices, so communication with
//- prefix is disabled ! //- prefix is disabled !
this->disable_readingWithPrefix(); this->enable_readingWithPrefix();
return true; return true;
} }
...@@ -294,20 +294,19 @@ std::string KeithleyDDCProtocol::get_value (void) ...@@ -294,20 +294,19 @@ std::string KeithleyDDCProtocol::get_value (void)
std::stringstream cmd_to_send; std::stringstream cmd_to_send;
std::string argout("no data"); std::string argout("no data");
//- get data value //- get data value
cmd_to_send << "X" << std::ends; cmd_to_send << "X" << std::ends;
_communication_link->write_read(cmd_to_send.str()); _communication_link->write(cmd_to_send.str());
argout = _communication_link->read(); argout = _communication_link->read();
std::cout << "KeithleyDDCProtocol::get_value = " << argout << std::endl;
//- check if device range is overloaded : First char of the prefix ! //- check if device range is overloaded : First char of the prefix !
//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;
} }
...@@ -408,8 +407,6 @@ std::string argout("no data"); ...@@ -408,8 +407,6 @@ std::string argout("no data");
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 << "KeithleyDDCProtocol::get_raw_status returns *" << argout << "*" << std::ends;
return argout; return argout;
} }
...@@ -424,9 +421,8 @@ std::string argout("no data"); ...@@ -424,9 +421,8 @@ std::string argout("no data");
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()); _communication_link->write(cmd_to_send.str());
argout = _communication_link->read();
std::cout << "KeithleyDDCProtocol::get_DDC_configuration returns *" << argout << "*" << std::ends;
return argout; return argout;
} }
......
...@@ -102,7 +102,7 @@ bool Keithley_485::init_protocol (void) ...@@ -102,7 +102,7 @@ bool Keithley_485::init_protocol (void)
// ============================================================================ // ============================================================================
void Keithley_485::range_up (void) void Keithley_485::range_up (void)
{ {
std::stringstream cmd_to_send(""); std::stringstream cmd_to_send;
// force read of range on instrument to update _range variable // force read of range on instrument to update _range variable
electrometer_status(); electrometer_status();
...@@ -127,7 +127,7 @@ std::stringstream cmd_to_send(""); ...@@ -127,7 +127,7 @@ std::stringstream cmd_to_send("");
// ============================================================================ // ============================================================================
void Keithley_485::range_down (void) void Keithley_485::range_down (void)
{ {
std::stringstream cmd_to_send(""); std::stringstream cmd_to_send;
// force read of range on instrument to update _range variable // force read of range on instrument to update _range variable
electrometer_status(); electrometer_status();
...@@ -162,7 +162,7 @@ std::string Keithley_485::get_ElectroMeterRange (void) ...@@ -162,7 +162,7 @@ std::string Keithley_485::get_ElectroMeterRange (void)
// ============================================================================ // ============================================================================
void Keithley_485::set_triggerMode (short trigMod) void Keithley_485::set_triggerMode (short trigMod)
{ {
std::stringstream cmd_to_send(""); std::stringstream cmd_to_send;
if(trigMod<0 || trigMod>K485_triggerModeLimit) if(trigMod<0 || trigMod>K485_triggerModeLimit)
throw electrometer::ElectrometerException("OUT_OF_RANGE", throw electrometer::ElectrometerException("OUT_OF_RANGE",
...@@ -181,7 +181,7 @@ std::stringstream cmd_to_send(""); ...@@ -181,7 +181,7 @@ 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 defaultStatus("4850000000000"); std::string defaultStatus("4850010000000");
std::string argout(""); std::string argout("");
std::string tmp(""); std::string tmp("");
...@@ -192,15 +192,16 @@ std::string Keithley_485::electrometer_status (void) ...@@ -192,15 +192,16 @@ 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); set_electroState(ALARM);
// argout = "Invalid status string received"; argout = "Invalid status string received";
// return argout; return argout;
//} }
argout = "Keithley Type : " + MODEL_NUMBER + "\n"; //argout = "Keithley Type : " + MODEL_NUMBER + "\n";
argout = "Keithley Type : " + modelNum + "\n";
if ( _kstatus.size() < defaultStatus.size() ) if ( _kstatus.size() < defaultStatus.size() )
{ {
argout = _kstatus; argout = _kstatus;
...@@ -208,36 +209,42 @@ std::string Keithley_485::electrometer_status (void) ...@@ -208,36 +209,42 @@ std::string Keithley_485::electrometer_status (void)
return argout; return argout;
} }
//- Zero check state //- Zero check state
tmp = _kstatus.substr(0,1); //tmp = _kstatus.substr(0,1);
tmp = _kstatus.substr(3,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(1,1); //tmp = _kstatus.substr(1,1);
tmp = _kstatus.substr(4,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(2,1); //tmp = _kstatus.substr(2,1);
tmp = _kstatus.substr(5,1);
_range = XString<short>::convertFromString(tmp); _range = XString<short>::convertFromString(tmp);
_rangeStr = K485_rangeValue[_range]; _rangeStr = K485_rangeValue[_range];
argout += "Range : " + _rangeStr + "\n"; argout += "Range : " + _rangeStr + "\n";
//- Relative (baseline suppress) //- Relative (baseline suppress)
tmp = _kstatus.substr(3,1); //tmp = _kstatus.substr(3,1);
tmp = _kstatus.substr(6,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(4,1); //tmp = _kstatus.substr(4,1);
tmp = _kstatus.substr(7,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(5,1); //tmp = _kstatus.substr(5,1);
tmp = _kstatus.substr(8,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";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment