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()
//- For DDC models are very slow devices, so communication with
//- prefix is disabled !
this->disable_readingWithPrefix();
this->enable_readingWithPrefix();
return true;
}
......@@ -294,20 +294,19 @@ std::string KeithleyDDCProtocol::get_value (void)
std::stringstream cmd_to_send;
std::string argout("no data");
//- get data value
cmd_to_send << "X" << std::ends;
_communication_link->write_read(cmd_to_send.str());
argout = _communication_link->read();
std::cout << "KeithleyDDCProtocol::get_value = " << argout << std::endl;
//- get data value
cmd_to_send << "X" << std::ends;
_communication_link->write(cmd_to_send.str());
argout = _communication_link->read();
//- check if device range is overloaded : First char of the prefix !
//if(argout[0] == 'O')
// _is_overloaded = true;
//else
// _is_overloaded = false;
if(argout[0] == 'O')
_is_overloaded = true;
else
_is_overloaded = false;
////- return value : data begin at idx 4
//argout = argout.substr(4);
argout = argout.substr(4);
return argout;
}
......@@ -408,8 +407,6 @@ std::string argout("no data");
cmd_to_send << "U1X" << std::endl;
argout = _communication_link->write_read(cmd_to_send.str());
std::cout << "KeithleyDDCProtocol::get_raw_status returns *" << argout << "*" << std::ends;
return argout;
}
......@@ -424,9 +421,8 @@ std::string argout("no data");
cmd_to_send.str("");
//- get status word
cmd_to_send << "U0X" << std::endl;
argout = _communication_link->write_read(cmd_to_send.str());
std::cout << "KeithleyDDCProtocol::get_DDC_configuration returns *" << argout << "*" << std::ends;
_communication_link->write(cmd_to_send.str());
argout = _communication_link->read();
return argout;
}
......
......@@ -102,7 +102,7 @@ bool Keithley_485::init_protocol (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
electrometer_status();
......@@ -127,7 +127,7 @@ std::stringstream cmd_to_send("");
// ============================================================================
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
electrometer_status();
......@@ -162,7 +162,7 @@ std::string Keithley_485::get_ElectroMeterRange (void)
// ============================================================================
void Keithley_485::set_triggerMode (short trigMod)
{
std::stringstream cmd_to_send("");
std::stringstream cmd_to_send;
if(trigMod<0 || trigMod>K485_triggerModeLimit)
throw electrometer::ElectrometerException("OUT_OF_RANGE",
......@@ -181,7 +181,7 @@ std::stringstream cmd_to_send("");
std::string Keithley_485::electrometer_status (void)
{
std::string _kstatus("undefined status");
std::string defaultStatus("4850000000000");
std::string defaultStatus("4850010000000");
std::string argout("");
std::string tmp("");
......@@ -192,15 +192,16 @@ std::string Keithley_485::electrometer_status (void)
try
{
//- model number :
//std::string modelNum = _kstatus.substr(0,3);
////- if not expected data (here model number)
//if(modelNum.find("485") == std::string::npos)
//{
// set_electroState(ALARM);
// argout = "Invalid status string received";
// return argout;
//}
argout = "Keithley Type : " + MODEL_NUMBER + "\n";
std::string modelNum = _kstatus.substr(0,3);
//- if not expected data (here model number)
if(modelNum.find("485") == std::string::npos)
{
set_electroState(ALARM);
argout = "Invalid status string received";
return argout;
}
//argout = "Keithley Type : " + MODEL_NUMBER + "\n";
argout = "Keithley Type : " + modelNum + "\n";
if ( _kstatus.size() < defaultStatus.size() )
{
argout = _kstatus;
......@@ -208,36 +209,42 @@ std::string Keithley_485::electrometer_status (void)
return argout;
}
//- Zero check state
tmp = _kstatus.substr(0,1);
//tmp = _kstatus.substr(0,1);
tmp = _kstatus.substr(3,1);
if(XString<short>::convertFromString(tmp))
argout += "Zero Check : ON\n";
else
argout += "Zero Check : OFF\n";
//- Log state
tmp = _kstatus.substr(1,1);
//tmp = _kstatus.substr(1,1);
tmp = _kstatus.substr(4,1);
if(XString<short>::convertFromString(tmp))
argout += "Log : ON\n";
else
argout += "Log : OFF\n";
//- Range
tmp = _kstatus.substr(2,1);
//tmp = _kstatus.substr(2,1);
tmp = _kstatus.substr(5,1);
_range = XString<short>::convertFromString(tmp);
_rangeStr = K485_rangeValue[_range];
argout += "Range : " + _rangeStr + "\n";
//- Relative (baseline suppress)
tmp = _kstatus.substr(3,1);
//tmp = _kstatus.substr(3,1);
tmp = _kstatus.substr(6,1);
if(XString<short>::convertFromString(tmp))
argout += "Relative ON\n";
else
argout += "Relative OFF\n";
//- Relative (baseline suppress)
tmp = _kstatus.substr(4,1);
//tmp = _kstatus.substr(4,1);
tmp = _kstatus.substr(7,1);
if(XString<short>::convertFromString(tmp))
argout += "EOI : Send\n";
else
argout += "EOI : Do Not Send\n";
//- Trigger
tmp = _kstatus.substr(5,1);
//tmp = _kstatus.substr(5,1);
tmp = _kstatus.substr(8,1);
short trigg = XString<short>::convertFromString(tmp);
if(!trigg)
argout += "Trigger : Continuous on Talk\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