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

DDC part : no more data with prefix, this slow down the communication.

parent 1174b201
No related branches found
No related tags found
No related merge requests found
...@@ -32,7 +32,7 @@ KeithleyDDCProtocol::KeithleyDDCProtocol (std::string& gpib_device_name) ...@@ -32,7 +32,7 @@ KeithleyDDCProtocol::KeithleyDDCProtocol (std::string& gpib_device_name)
_commDevName = gpib_device_name; _commDevName = gpib_device_name;
std::cout << "KeithleyDDCProtocol::KeithleyDDCProtocol ->" << std::endl; std::cout << "KeithleyDDCProtocol::KeithleyDDCProtocol -> " << _commDevName << std::endl;
} }
// ============================================================================ // ============================================================================
...@@ -58,7 +58,8 @@ bool KeithleyDDCProtocol::build_communicationLink() ...@@ -58,7 +58,8 @@ bool KeithleyDDCProtocol::build_communicationLink()
if (!_communication_link) if (!_communication_link)
return false; return false;
//- Read data with no prefix //- For DDC models are very slow devices, so communication with
//- prefix is disabled !
this->disable_readingWithPrefix(); this->disable_readingWithPrefix();
return true; return true;
...@@ -203,7 +204,6 @@ std::stringstream cmd_to_send; ...@@ -203,7 +204,6 @@ std::stringstream cmd_to_send;
//- send command //- send command
cmd_to_send << "R12X" << std::ends; cmd_to_send << "R12X" << std::ends;
_communication_link->write(cmd_to_send.str()); _communication_link->write(cmd_to_send.str());
} }
// ============================================================================ // ============================================================================
...@@ -222,7 +222,6 @@ std::stringstream cmd_to_send; ...@@ -222,7 +222,6 @@ std::stringstream cmd_to_send;
//- send command //- send command
cmd_to_send << "F1X" << std::ends; cmd_to_send << "F1X" << std::ends;
_communication_link->write(cmd_to_send.str()); _communication_link->write(cmd_to_send.str());
} }
// ============================================================================ // ============================================================================
...@@ -295,28 +294,19 @@ std::string KeithleyDDCProtocol::get_value (void) ...@@ -295,28 +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");
//- send command : G0X -> prefix (to check if device overload !) and second X to get data //- get data value
// cmd_to_send << "G0" << std::ends; cmd_to_send << "X" << std::ends;
//this->disable_readingWithPrefix(); _communication_link->write_read(cmd_to_send.str());
argout = _communication_link->read();
//- get data value std::cout << "KeithleyDDCProtocol::get_value = " << argout << std::endl;
cmd_to_send << "X" << std::ends;
_communication_link->write(cmd_to_send.str()); //- check if device range is overloaded : First char of the prefix !
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
// cmd_to_send << "G1X" << std::ends;
// _communication_link->write(cmd_to_send.str());
//- 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;
} }
...@@ -413,16 +403,12 @@ std::string KeithleyDDCProtocol::get_raw_status (void) ...@@ -413,16 +403,12 @@ std::string KeithleyDDCProtocol::get_raw_status (void)
std::stringstream cmd_to_send; std::stringstream cmd_to_send;
std::string argout("no data"); std::string argout("no data");
//- send command : G0X -> show prefix ( = keithley type )
//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 << "KeithleyDDCProtocol::get_raw_status returns *" << argout << "*" << std::ends; std::cout << "KeithleyDDCProtocol::get_raw_status returns *" << argout << "*" << std::ends;
// this->disable_readingWithPrefix();
return argout; return argout;
} }
...@@ -435,16 +421,12 @@ std::string KeithleyDDCProtocol::get_DDC_configuration (void) ...@@ -435,16 +421,12 @@ std::string KeithleyDDCProtocol::get_DDC_configuration (void)
std::stringstream cmd_to_send; std::stringstream cmd_to_send;
std::string argout("no data"); std::string argout("no data");
//- send command : G0X -> show prefix ( = keithley type )
//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 << "KeithleyDDCProtocol::get_DDC_configuration returns *" << argout << "*" << std::ends; std::cout << "KeithleyDDCProtocol::get_DDC_configuration returns *" << argout << "*" << std::ends;
//this->disable_readingWithPrefix();
return argout; return argout;
} }
......
...@@ -22,6 +22,10 @@ ...@@ -22,6 +22,10 @@
#include "KeithleyDDCProtocol.h" #include "KeithleyDDCProtocol.h"
#include "Keithley_485.h" #include "Keithley_485.h"
/* /*
* model number
*/
static std::string MODEL_NUMBER = "485";
/*
* Valid Range values for a K_485 * Valid Range values for a K_485
*/ */
static const std::string K485_rangeValue[] = {"AUTO ON","2E-9","2E-8","2E-7","2E-6","2E-5","2E-4","2E-3"}; static const std::string K485_rangeValue[] = {"AUTO ON","2E-9","2E-8","2E-7","2E-6","2E-5","2E-4","2E-3"};
...@@ -98,7 +102,7 @@ bool Keithley_485::init_protocol (void) ...@@ -98,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();
...@@ -123,8 +127,7 @@ std::stringstream cmd_to_send; ...@@ -123,8 +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();
...@@ -159,7 +162,7 @@ std::string Keithley_485::get_ElectroMeterRange (void) ...@@ -159,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",
...@@ -178,7 +181,7 @@ std::stringstream cmd_to_send; ...@@ -178,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("0000000000"); std::string defaultStatus("4850000000000");
std::string argout(""); std::string argout("");
std::string tmp(""); std::string tmp("");
...@@ -197,7 +200,7 @@ std::string Keithley_485::electrometer_status (void) ...@@ -197,7 +200,7 @@ std::string Keithley_485::electrometer_status (void)
// argout = "Invalid status string received"; // argout = "Invalid status string received";
// return argout; // return argout;
//} //}
//argout = "Keithley Type : " + modelNum + "\n"; argout = "Keithley Type : " + MODEL_NUMBER + "\n";
if ( _kstatus.size() < defaultStatus.size() ) if ( _kstatus.size() < defaultStatus.size() )
{ {
argout = _kstatus; argout = _kstatus;
...@@ -220,7 +223,7 @@ std::string Keithley_485::electrometer_status (void) ...@@ -220,7 +223,7 @@ std::string Keithley_485::electrometer_status (void)
tmp = _kstatus.substr(2,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 += "Range : " + _rangeStr + "\n";
//- Relative (baseline suppress) //- Relative (baseline suppress)
tmp = _kstatus.substr(3,1); tmp = _kstatus.substr(3,1);
if(XString<short>::convertFromString(tmp)) if(XString<short>::convertFromString(tmp))
...@@ -279,31 +282,29 @@ std::string Keithley_485::electrometer_status (void) ...@@ -279,31 +282,29 @@ std::string Keithley_485::electrometer_status (void)
else else
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
tmp = _kstatus.substr(6,2);
short srqMaskErr = XString<short>::convertFromString(tmp);
if(!srqMaskErr)
argout += "SRQ Error Mask : SRQ Disabled\n";
else else
if(srqMaskErr == 1) if(srqInfo == 32)
argout += "SRQ Error Mask : IDDCO\n"; argout += "SRQ Error Mask : Clear SRQ Errol mask\n";
else
if(srqInfo == 33)
argout += "SRQ Error Mask : IDDCQ\n";
else else
if(srqMaskErr == 2) if(srqInfo == 34)
argout += "SRQ Error Mask : IDDC\n"; argout += "SRQ Error Mask : IDDC\n";
else else
if(srqMaskErr == 3) if(srqInfo == 35)
argout += "SRQ Error Mask : IDDCO or IDDC\n"; argout += "SRQ Error Mask : IDDC or IDDCO\n";
else else
if(srqMaskErr == 4) if(srqInfo == 36)
argout += "SRQ Error Mask : Not in Remote\n"; argout += "SRQ Error Mask : Not in Remote\n";
else else
if(srqMaskErr == 5) if(srqInfo == 37)
argout += "SRQ Error Mask : Not in Remote or IDDCO\n"; argout += "SRQ Error Mask : Not in Remote or IDDCO\n";
else else
if(srqMaskErr == 6) if(srqInfo == 38)
argout += "SRQ Error Mask : Not in Remote or IDDC\n"; argout += "SRQ Error Mask : Not in Remote or IDDC\n";
else else
if(srqMaskErr == 7) if(srqInfo == 39)
argout += "SRQ Error Mask : Not in Remote, IDDCO or IDDC\n"; argout += "SRQ Error Mask : Not in Remote, IDDCO or IDDC\n";
} }
catch(std::out_of_range) catch(std::out_of_range)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment