From dd5a20265f5cc8c73727da6f72ed714fb4ae5908 Mon Sep 17 00:00:00 2001 From: Xavier Elattaoui <xavier.elattaoui@synchrotron-soleil.fr> Date: Wed, 14 May 2008 09:42:37 +0000 Subject: [PATCH] xavier : - attributes management : -> integrationTime, buffersize and triggerMode now well initialised TODO : after a Start command -> declare all attributes INVALID !? --- include/AbstractElectrometerClass.h | 8 +- include/Keithley_617.h | 4 +- src/AbstractElectrometerClass.cpp | 10 ++- src/Keithley_485.cpp | 47 +++++------ src/Keithley_486.cpp | 107 ++++++++++++------------- src/Keithley_487.cpp | 118 ++++++++++++++++------------ src/Keithley_617.cpp | 25 +++--- src/Keithley_6512.cpp | 67 ++++++++-------- 8 files changed, 215 insertions(+), 171 deletions(-) diff --git a/include/AbstractElectrometerClass.h b/include/AbstractElectrometerClass.h index 134b7f3..30c50a1 100644 --- a/include/AbstractElectrometerClass.h +++ b/include/AbstractElectrometerClass.h @@ -9,9 +9,14 @@ // // $Author: xavela $ // -// $Revision: 1.11 $ +// $Revision: 1.12 $ // // $Log: not supported by cvs2svn $ +// Revision 1.11 2008/04/30 15:57:29 xavela +// xavier : +// 6517 model management added and tested : +// -> problem to check : no SRQ ! +// // Revision 1.10 2008/04/15 12:51:59 xavela // xavier : // - SRQ management changed : @@ -157,6 +162,7 @@ public: virtual void set_triggerMode (short); virtual void set_integrationTime (double); virtual short get_buffer_size (void); + virtual short get_triggerMode (void) { return _trigMod;}; /** * \brief Novelec Electrometer methods diff --git a/include/Keithley_617.h b/include/Keithley_617.h index ded8cf0..6ece226 100644 --- a/include/Keithley_617.h +++ b/include/Keithley_617.h @@ -65,8 +65,8 @@ public: */ std::string get_ElectroMeterMode (void); std::string get_ElectroMeterRange(void); - - /** + + /** * \brief Electrometer status. */ std::string electrometer_status (void); diff --git a/src/AbstractElectrometerClass.cpp b/src/AbstractElectrometerClass.cpp index b00792d..c17921d 100644 --- a/src/AbstractElectrometerClass.cpp +++ b/src/AbstractElectrometerClass.cpp @@ -11,9 +11,14 @@ // // $Author: xavela $ // -// $Revision: 1.12 $ +// $Revision: 1.13 $ // // $Log: not supported by cvs2svn $ +// Revision 1.12 2008/04/30 15:57:31 xavela +// xavier : +// 6517 model management added and tested : +// -> problem to check : no SRQ ! +// // Revision 1.11 2008/04/15 12:52:14 xavela // xavier : // - SRQ management changed : @@ -90,6 +95,9 @@ AbstractElectrometerClass::AbstractElectrometerClass (std::string comLink_device : _device_proxy_name(comLink_device_name), _range(0), _rangeStr("NOT INITIALISED"), + _mode("NOT INITIALISED"), + _size(-1), + _trigMod(-1), electrometerState(UNKNOWN) { // std::cout << "AbstractElectrometerClass::AbstractElectrometerClass <-" << std::endl; diff --git a/src/Keithley_485.cpp b/src/Keithley_485.cpp index e5dd786..b3c0cb1 100644 --- a/src/Keithley_485.cpp +++ b/src/Keithley_485.cpp @@ -195,72 +195,75 @@ std::string Keithley_485::electrometer_status (void) argout += "EOI : Do Not Send\n"; //- Trigger tmp = _kstatus.substr(8,1); - if(!XString<short>::convertFromString(tmp)) + short trigg = XString<short>::convertFromString(tmp); + if(!trigg) argout += "Trigger : Continuous on Talk\n"; else - if(XString<short>::convertFromString(tmp) == 1) + if(trigg == 1) argout += "Trigger :One-Shot on Talk\n"; else - if(XString<short>::convertFromString(tmp) == 2) + if(trigg == 2) argout += "Trigger :Continuous on Get\n"; else - if(XString<short>::convertFromString(tmp) == 3) + if(trigg == 3) argout += "Trigger :One-Shot on Get\n"; else - if(XString<short>::convertFromString(tmp) == 4) + if(trigg == 4) argout += "Trigger :Continuous on \"X\"\n"; else - if(XString<short>::convertFromString(tmp) == 5) + if(trigg == 5) argout += "Trigger :One-Shot on \"X\"\n"; //- SRQ Data Mask tmp = _kstatus.substr(9,2); - if(!XString<short>::convertFromString(tmp)) + short srqInfo = XString<short>::convertFromString(tmp); + if(!srqInfo) argout += "SRQ Data Mask : SRQ Disabled\n"; else - if(XString<short>::convertFromString(tmp) == 1) + if(srqInfo == 1) argout += "SRQ Data Mask : Reading Overflow\n"; else - if(XString<short>::convertFromString(tmp) == 8) + if(srqInfo == 8) argout += "SRQ Data Mask : Reading Done\n"; else - if(XString<short>::convertFromString(tmp) == 9) + if(srqInfo == 9) argout += "SRQ Data Mask : Reading Done or Reading Overflow\n"; else - if(XString<short>::convertFromString(tmp) == 16) + if(srqInfo == 16) argout += "SRQ Data Mask : Busy\n"; else - if(XString<short>::convertFromString(tmp) == 17) + if(srqInfo == 17) argout += "SRQ Data Mask : Busy or Reading Overflow\n"; else - if(XString<short>::convertFromString(tmp) == 24) + if(srqInfo == 24) argout += "SRQ Data Mask : Busy or Reading Done\n"; else - if(XString<short>::convertFromString(tmp) == 25) + if(srqInfo == 25) argout += "SRQ Data Mask : Busy, Reading Done or Reading Overflow\n"; //- SRQ Error Mask tmp = _kstatus.substr(9,2); - if(!XString<short>::convertFromString(tmp)) + short srqMaskErr = XString<short>::convertFromString(tmp); + if(!srqMaskErr) argout += "SRQ Error Mask : SRQ Disabled\n"; else - if(XString<short>::convertFromString(tmp) == 1) + if(srqMaskErr == 1) argout += "SRQ Error Mask : IDDCO\n"; else - if(XString<short>::convertFromString(tmp) == 2) + if(srqMaskErr == 2) argout += "SRQ Error Mask : IDDC\n"; else - if(XString<short>::convertFromString(tmp) == 3) + if(srqMaskErr == 3) argout += "SRQ Error Mask : IDDCO or IDDC\n"; else - if(XString<short>::convertFromString(tmp) == 4) + if(srqMaskErr == 4) argout += "SRQ Error Mask : Not in Remote\n"; else - if(XString<short>::convertFromString(tmp) == 5) + if(srqMaskErr == 5) argout += "SRQ Error Mask : Not in Remote or IDDCO\n"; else - if(XString<short>::convertFromString(tmp) == 6) + if(srqMaskErr == 6) argout += "SRQ Error Mask : Not in Remote or IDDC\n"; else - if(XString<short>::convertFromString(tmp) == 7) + if(srqMaskErr == 7) argout += "SRQ Error Mask : Not in Remote, IDDCO or IDDC\n"; } catch(std::out_of_range) diff --git a/src/Keithley_486.cpp b/src/Keithley_486.cpp index 8951221..d8c6d11 100644 --- a/src/Keithley_486.cpp +++ b/src/Keithley_486.cpp @@ -242,114 +242,117 @@ std::string Keithley_486::electrometer_status (void) argout = "Keithley Type : " + modelNum + "\n"; //- Display Intensity ('A') tmp = _kstatus.substr(_kstatus.find('A')+1,1); -// std::cout << "\nDisplay Intensity = *" << tmp <<"*" << std::endl; - if(!XString<short>::convertFromString(tmp)) + short dintensity = XString<short>::convertFromString(tmp); + if(!dintensity) argout += "Display Intensity : NORMAL\n"; else - if(XString<short>::convertFromString(tmp) == 1) + if(dintensity == 1) argout += "Display Intensity : DIM\n"; else - if(XString<short>::convertFromString(tmp) == 2) + if(dintensity == 2) argout += "Display Intensity : OFF\n"; //- Reading Source ('B') tmp = _kstatus.substr(_kstatus.find('B')+1,1); -// std::cout << "\nReading Source = *" << tmp <<"*" << std::endl; - if(!XString<short>::convertFromString(tmp)) + short rSource = XString<short>::convertFromString(tmp); + if(!rSource) argout += "Reading Source : A/D Reading\n"; else - if(XString<short>::convertFromString(tmp) == 1) + if(rSource == 1) argout += "Reading Source : One Data Store Reading\n"; else - if(XString<short>::convertFromString(tmp) == 2) + if(rSource == 2) argout += "Reading Source : All Data Store Reading\n"; else - if(XString<short>::convertFromString(tmp) == 3) + if(rSource == 3) argout += "Reading Source : Max Data Store Reading\n"; else - if(XString<short>::convertFromString(tmp) == 4) + if(rSource == 4) argout += "Reading Source : Min Data Store Reading\n"; //- Zero check state ('C') tmp = _kstatus.substr(_kstatus.find('C')+1,1); -// std::cout << "\nZero check state = *" << tmp <<"*" << std::endl; if(XString<short>::convertFromString(tmp)) argout += "Zero Check : Enabled\n"; else argout += "Zero Check : Disabled\n"; //- Data Format ('G') tmp = _kstatus.substr(_kstatus.find('G')+1,1); - if(!XString<short>::convertFromString(tmp)) + short dformat = XString<short>::convertFromString(tmp); + if(!dformat) argout += "Data Format : Reading With Prefix (ASCII)\n"; else - if(XString<short>::convertFromString(tmp) == 1) + if(dformat == 1) argout += "Data Format : Reading Without Prefix (ASCII)\n"; else - if(XString<short>::convertFromString(tmp) == 2) + if(dformat == 2) argout += "Data Format : Reading and Buffer Location With Prefix (ASCII)\n"; else - if(XString<short>::convertFromString(tmp) == 3) + if(dformat == 3) argout += "Data Format : Reading and Buffer Location Without Prefix (ASCII)\n"; else - if(XString<short>::convertFromString(tmp) == 4) + if(dformat == 4) argout += "Data Format : Binary Reading - precision, bytes reversed for Intel CPUs\n"; else - if(XString<short>::convertFromString(tmp) == 5) + if(dformat == 5) argout += "Data Format : Binary Reading - precision, bytes in normal order for Motorola CPUs\n"; else - if(XString<short>::convertFromString(tmp) == 6) + if(dformat == 6) argout += "Data Format : Binary Reading - counts and exponent, bytes reversed for Intel CPUs\n"; else - if(XString<short>::convertFromString(tmp) == 7) + if(dformat == 7) argout += "Data Format : Binary Reading - counts and exponent, bytes in normal order for Motorola CPUs\n"; //- Self Test ('J') tmp = _kstatus.substr(_kstatus.find('J')+1,1); - if(!XString<short>::convertFromString(tmp)) + short stest = XString<short>::convertFromString(tmp); + if(!stest) argout += "Self Test : No Errors\n"; else - if(XString<short>::convertFromString(tmp) == 1) + if(stest == 1) argout += "Self Test : ROM Error\n"; else - if(XString<short>::convertFromString(tmp) == 2) + if(stest == 2) argout += "Self Test : RAM Error\n"; else - if(XString<short>::convertFromString(tmp) == 3) + if(stest == 3) argout += "Self Test : ROM and RAM Error\n"; //- EOI & Bus Hold Off ('K') tmp = _kstatus.substr(_kstatus.find('J')+1,1); - if(!XString<short>::convertFromString(tmp)) + short ebhoff = XString<short>::convertFromString(tmp); + if(!ebhoff) argout += "EOI & Bus Hold Off : EOI and Hold-Off\n"; else - if(XString<short>::convertFromString(tmp) == 1) + if(ebhoff == 1) argout += "EOI & Bus Hold Off : No EOI and Hold-Off\n"; else - if(XString<short>::convertFromString(tmp) == 2) + if(ebhoff == 2) argout += "EOI & Bus Hold Off : EOI and no Hold-Off\n"; else - if(XString<short>::convertFromString(tmp) == 3) + if(ebhoff == 3) argout += "EOI & Bus Hold Off : No EOI and no Hold-Off\n"; //- SRQ ('M') tmp = _kstatus.substr(_kstatus.find('M')+1,3); - if(!XString<short>::convertFromString(tmp)) + short srqInfo = XString<short>::convertFromString(tmp); + if(!srqInfo) argout += "SRQ : Disabled\n"; else - if(XString<short>::convertFromString(tmp) == 1) + if(srqInfo == 1) argout += "SRQ : Reading Overflow\n"; else - if(XString<short>::convertFromString(tmp) == 2) + if(srqInfo == 2) argout += "SRQ : Data Store Full\n"; else - if(XString<short>::convertFromString(tmp) == 4) + if(srqInfo == 4) argout += "SRQ : Data Store 1/2 full\n"; else - if(XString<short>::convertFromString(tmp) == 8) + if(srqInfo == 8) argout += "SRQ : Reading Done\n"; else - if(XString<short>::convertFromString(tmp) == 16) + if(srqInfo == 16) argout += "SRQ : Ready\n"; else - if(XString<short>::convertFromString(tmp) == 32) + if(srqInfo == 32) argout += "SRQ : Error\n"; else - if(XString<short>::convertFromString(tmp) == 128) + if(srqInfo == 128) argout += "SRQ : Voltage Source Error\n"; //- Data Store Size ('N') tmp = _kstatus.substr(_kstatus.find('N')+1,3); @@ -359,31 +362,28 @@ std::string Keithley_486::electrometer_status (void) argout += "Data Store Size : " + tmp + "\n"; //- Filters ('P') tmp = _kstatus.substr(_kstatus.find('P')+1,1); - if(!XString<short>::convertFromString(tmp)) + short filters = XString<short>::convertFromString(tmp); + if(!filters) argout += "Filters : Both Filters Disabled\n"; else - if(XString<short>::convertFromString(tmp) == 1) + if(filters == 1) argout += "Filters : Digital Filter Enabled, Analog Filter Disabled\n"; else - if(XString<short>::convertFromString(tmp) == 2) + if(filters == 2) argout += "Filters : Digital Filter Disabled, Analog Filter Enabled\n"; else - if(XString<short>::convertFromString(tmp) == 3) + if(filters == 3) argout += "Filters : Both Filters Enabled\n"; //- Range ('Rmn') //- check AutoRange tmp = _kstatus.substr(_kstatus.find('R')+1,2); -// std::cout << "\ncheck AutoRange = *" << tmp[0] << "*" << std::endl; -// if(atoi(&tmp[0]) == 0) if(tmp[0] == '0') argout += "Range : AutoRange Disabled\n"; else argout += "Range : AutoRange Enabled\n"; //- range value -// tmp = _kstatus.substr(_kstatus.find('R')+2,1); _range = atoi(&tmp[1]); _rangeStr = K486_rangeValue[_range]; -// std::cout << "\nRange = *" << _range <<"*" << ", RangeStr=" << _rangeStr << std::endl; argout += _rangeStr + "\n"; //- Integration Period ('S') tmp = _kstatus.substr(_kstatus.find('S')+1,1); @@ -393,34 +393,35 @@ std::string Keithley_486::electrometer_status (void) argout += "Integration Period : Line Cycle (5-1/2d)\n"; //- Trigger ('T') tmp = _kstatus.substr(_kstatus.find('T')+1,1); - if(!XString<short>::convertFromString(tmp)) + short trigg = XString<short>::convertFromString(tmp); + if(!trigg) argout += "Trigger : Multiple On Talk\n"; else - if(XString<short>::convertFromString(tmp) == 1) + if(trigg == 1) argout += "Trigger : One-shot On Talk\n"; else - if(XString<short>::convertFromString(tmp) == 2) + if(trigg == 2) argout += "Trigger : Multiple On Get\n"; else - if(XString<short>::convertFromString(tmp) == 3) + if(trigg == 3) argout += "Trigger : One-shot On Get)\n"; else - if(XString<short>::convertFromString(tmp) == 4) + if(trigg == 4) argout += "Trigger : Multiple On X\n"; else - if(XString<short>::convertFromString(tmp) == 5) + if(trigg == 5) argout += "Trigger : One-shot On X\n"; else - if(XString<short>::convertFromString(tmp) == 6) + if(trigg == 6) argout += "Trigger : Multiple On External Trigger\n"; else - if(XString<short>::convertFromString(tmp) == 7) + if(trigg == 7) argout += "Trigger : One-shot On External Trigger\n"; else - if(XString<short>::convertFromString(tmp) == 8) + if(trigg == 8) argout += "Trigger : Multiple On Operate\n"; else - if(XString<short>::convertFromString(tmp) == 9) + if(trigg == 9) argout += "Trigger : One-shot On Operate\n"; //- Relative ('Z') (baseline suppress) tmp = _kstatus.substr(_kstatus.find('Z')+1,1); diff --git a/src/Keithley_487.cpp b/src/Keithley_487.cpp index e577dad..df3e23e 100644 --- a/src/Keithley_487.cpp +++ b/src/Keithley_487.cpp @@ -134,7 +134,7 @@ std::stringstream cmd_to_send; std::string Keithley_487::get_ElectroMeterRange (void) { // force read of range on instrument to update _range variable - electrometer_status(); +// electrometer_status(); return _rangeStr; } @@ -192,13 +192,24 @@ void Keithley_487::set_triggerMode (short trigMod) } +// ============================================================================ +// Keithley_487::get_triggerMode +// ============================================================================ +/*std::string Keithley_487::get_triggerMode (void) +{ + // force read of range on instrument to update _range variable +// electrometer_status(); + + return _trigMod; +} +*/ // ============================================================================ // Keithley_487::get_ElectroMeterMode // ============================================================================ std::string Keithley_487::get_ElectroMeterMode (void) { // force read of range on instrument to update _range variable - electrometer_status(); +// electrometer_status(); return _mode; } @@ -264,29 +275,31 @@ std::string Keithley_487::electrometer_status (void) argout = "Keithley Type : " + modelNum + "\n"; //- Display Intensity ('A') tmp = _kstatus.substr(_kstatus.find('A')+1,1); - if(!XString<short>::convertFromString(tmp)) + short dintensity = XString<short>::convertFromString(tmp); + if(!dintensity) argout += "Display Intensity : NORMAL\n"; else - if(XString<short>::convertFromString(tmp) == 1) + if(dintensity == 1) argout += "Display Intensity : DIM\n"; else - if(XString<short>::convertFromString(tmp) == 2) + if(dintensity == 2) argout += "Display Intensity : OFF\n"; //- Reading Source ('B') tmp = _kstatus.substr(_kstatus.find('B'),1); - if(!XString<short>::convertFromString(tmp)) + short rsource = XString<short>::convertFromString(tmp); + if(!rsource) argout += "Reading Source : A/D Reading\n"; else - if(XString<short>::convertFromString(tmp) == 1) + if(rsource == 1) argout += "Reading Source : One Data Store Reading\n"; else - if(XString<short>::convertFromString(tmp) == 2) + if(rsource == 2) argout += "Reading Source : All Data Store Reading\n"; else - if(XString<short>::convertFromString(tmp) == 3) + if(rsource == 3) argout += "Reading Source : Max Data Store Reading\n"; else - if(XString<short>::convertFromString(tmp) == 4) + if(rsource == 4) argout += "Reading Source : Min Data Store Reading\n"; //- Zero check state ('C') tmp = _kstatus.substr(_kstatus.find('C')+1,1); @@ -308,79 +321,83 @@ std::string Keithley_487::electrometer_status (void) } //- Data Format ('G') tmp = _kstatus.substr(_kstatus.find('G')+1,1); - if(!XString<short>::convertFromString(tmp)) + short dformat = XString<short>::convertFromString(tmp); + if(!dformat) argout += "Data Format : Reading With Prefix (ASCII)\n"; else - if(XString<short>::convertFromString(tmp) == 1) + if(dformat == 1) argout += "Data Format : Reading Without Prefix (ASCII)\n"; else - if(XString<short>::convertFromString(tmp) == 2) + if(dformat == 2) argout += "Data Format : Reading and Buffer Location With Prefix (ASCII)\n"; else - if(XString<short>::convertFromString(tmp) == 3) + if(dformat == 3) argout += "Data Format : Reading and Buffer Location Without Prefix (ASCII)\n"; else - if(XString<short>::convertFromString(tmp) == 4) + if(dformat == 4) argout += "Data Format : Binary Reading - precision, bytes reversed for Intel CPUs\n"; else - if(XString<short>::convertFromString(tmp) == 5) + if(dformat == 5) argout += "Data Format : Binary Reading - precision, bytes in normal order for Motorola CPUs\n"; else - if(XString<short>::convertFromString(tmp) == 6) + if(dformat == 6) argout += "Data Format : Binary Reading - counts and exponent, bytes reversed for Intel CPUs\n"; else - if(XString<short>::convertFromString(tmp) == 7) + if(dformat == 7) argout += "Data Format : Binary Reading - counts and exponent, bytes in normal order for Motorola CPUs\n"; //- Self Test ('J') tmp = _kstatus.substr(_kstatus.find('J')+1,1); - if(!XString<short>::convertFromString(tmp)) + short stest = XString<short>::convertFromString(tmp); + if(!stest) argout += "Self Test : No Errors\n"; else - if(XString<short>::convertFromString(tmp) == 1) + if(stest == 1) argout += "Self Test : ROM Error\n"; else - if(XString<short>::convertFromString(tmp) == 2) + if(stest == 2) argout += "Self Test : RAM Error\n"; else - if(XString<short>::convertFromString(tmp) == 3) + if(stest == 3) argout += "Self Test : ROM and RAM Error\n"; //- EOI & Bus Hold Off ('K') tmp = _kstatus.substr(_kstatus.find('K')+1,1); - if(!XString<short>::convertFromString(tmp)) + short ebhoff = XString<short>::convertFromString(tmp); + if(!ebhoff) argout += "EOI & Bus Hold Off : EOI and Hold-Off\n"; else - if(XString<short>::convertFromString(tmp) == 1) + if(ebhoff == 1) argout += "EOI & Bus Hold Off : No EOI and Hold-Off\n"; else - if(XString<short>::convertFromString(tmp) == 2) + if(ebhoff == 2) argout += "EOI & Bus Hold Off : EOI and no Hold-Off\n"; else - if(XString<short>::convertFromString(tmp) == 3) + if(ebhoff == 3) argout += "EOI & Bus Hold Off : No EOI and no Hold-Off\n"; //- SRQ ('M') tmp = _kstatus.substr(_kstatus.find('M')+1,3); - if(!XString<short>::convertFromString(tmp)) + short srqInfo = XString<short>::convertFromString(tmp); + if(!srqInfo) argout += "SRQ : Disabled\n"; else - if(XString<short>::convertFromString(tmp) == 1) + if(srqInfo == 1) argout += "SRQ : Reading Overflow\n"; else - if(XString<short>::convertFromString(tmp) == 2) + if(srqInfo == 2) argout += "SRQ : Data Store Full\n"; else - if(XString<short>::convertFromString(tmp) == 4) + if(srqInfo == 4) argout += "SRQ : Data Store 1/2 full\n"; else - if(XString<short>::convertFromString(tmp) == 8) + if(srqInfo == 8) argout += "SRQ : Reading Done\n"; else - if(XString<short>::convertFromString(tmp) == 16) + if(srqInfo == 16) argout += "SRQ : Ready\n"; else - if(XString<short>::convertFromString(tmp) == 32) + if(srqInfo == 32) argout += "SRQ : Error\n"; else - if(XString<short>::convertFromString(tmp) == 128) + if(srqInfo == 128) argout += "SRQ : Voltage Source Error\n"; //- Data Store Size ('N') tmp = _kstatus.substr(_kstatus.find('N')+1,3); @@ -390,16 +407,17 @@ std::string Keithley_487::electrometer_status (void) argout += "Data Store Size : " + tmp + "\n"; //- Filters ('P') tmp = _kstatus.substr(_kstatus.find('P')+1,1); - if(!XString<short>::convertFromString(tmp)) + short filters = XString<short>::convertFromString(tmp); + if(!filters) argout += "Filters : Both Filters Disabled\n"; else - if(XString<short>::convertFromString(tmp) == 1) + if(filters == 1) argout += "Filters : Digital Filter Enabled, Analog Filter Disabled\n"; else - if(XString<short>::convertFromString(tmp) == 2) + if(filters == 2) argout += "Filters : Digital Filter Disabled, Analog Filter Enabled\n"; else - if(XString<short>::convertFromString(tmp) == 3) + if(filters == 3) argout += "Filters : Both Filters Enabled\n"; //- Range ('Rmn') //- check AutoRange @@ -418,36 +436,38 @@ std::string Keithley_487::electrometer_status (void) argout += "Integration Period : Fast (4-1/2d)\n"; else argout += "Integration Period : Line Cycle (5-1/2d)\n"; - //- Trigger ('T') + + //- Trigger ('T') tmp = _kstatus.substr(_kstatus.find('T')+1,1); - if(!XString<short>::convertFromString(tmp)) + _trigMod = XString<short>::convertFromString(tmp); + if(!_trigMod) argout += "Trigger : Multiple On Talk\n"; else - if(XString<short>::convertFromString(tmp) == 1) + if(_trigMod == 1) argout += "Trigger : One-shot On Talk\n"; else - if(XString<short>::convertFromString(tmp) == 2) + if(_trigMod == 2) argout += "Trigger : Multiple On Get\n"; else - if(XString<short>::convertFromString(tmp) == 3) + if(_trigMod == 3) argout += "Trigger : One-shot On Get)\n"; else - if(XString<short>::convertFromString(tmp) == 4) + if(_trigMod == 4) argout += "Trigger : Multiple On X\n"; else - if(XString<short>::convertFromString(tmp) == 5) + if(_trigMod == 5) argout += "Trigger : One-shot On X\n"; else - if(XString<short>::convertFromString(tmp) == 6) + if(_trigMod == 6) argout += "Trigger : Multiple On External Trigger\n"; else - if(XString<short>::convertFromString(tmp) == 7) + if(_trigMod == 7) argout += "Trigger : One-shot On External Trigger\n"; else - if(XString<short>::convertFromString(tmp) == 8) + if(_trigMod == 8) argout += "Trigger : Multiple On Operate\n"; else - if(XString<short>::convertFromString(tmp) == 9) + if(_trigMod == 9) argout += "Trigger : One-shot On Operate\n"; //- Relative ('Z') (baseline suppress) tmp = _kstatus.substr(_kstatus.find('Z')+1,1); diff --git a/src/Keithley_617.cpp b/src/Keithley_617.cpp index ff984fc..41172a4 100644 --- a/src/Keithley_617.cpp +++ b/src/Keithley_617.cpp @@ -85,7 +85,7 @@ void Keithley_617::range_up (void) std::stringstream cmd_to_send; // force read of range on instrument to update _range variable - electrometer_status(); +// electrometer_status(); _range += 1; @@ -111,7 +111,7 @@ void Keithley_617::range_down (void) std::stringstream cmd_to_send; // force read of range on instrument to update _range variable - electrometer_status(); +// electrometer_status(); _range -= 1; @@ -134,7 +134,7 @@ std::stringstream cmd_to_send; std::string Keithley_617::get_ElectroMeterRange (void) { // force read of range on instrument to update _range variable - electrometer_status(); +// electrometer_status(); return _rangeStr; } @@ -178,7 +178,7 @@ void Keithley_617::set_triggerMode (short trigMod) std::string Keithley_617::get_ElectroMeterMode (void) { // force read of mode on instrument to update _mode variable - electrometer_status(); +// electrometer_status(); return _mode; } @@ -328,28 +328,29 @@ std::string Keithley_617::electrometer_status (void) argout += "Suppress : OFF\n"; //- Trigger tmp = _kstatus.substr(9,1); - if(!XString<short>::convertFromString(tmp)) + _trigMod = XString<short>::convertFromString(tmp); + if(!_trigMod) argout += "Trigger : Continuous on Talk\n"; else - if(XString<short>::convertFromString(tmp) == 1) + if(_trigMod == 1) argout += "Trigger :One-Shot on Talk\n"; else - if(XString<short>::convertFromString(tmp) == 2) + if(_trigMod == 2) argout += "Trigger :Continuous on Get\n"; else - if(XString<short>::convertFromString(tmp) == 3) + if(_trigMod == 3) argout += "Trigger :One-Shot on Get\n"; else - if(XString<short>::convertFromString(tmp) == 4) + if(_trigMod == 4) argout += "Trigger :Continuous on \"X\"\n"; else - if(XString<short>::convertFromString(tmp) == 5) + if(_trigMod == 5) argout += "Trigger :One-Shot on \"X\"\n"; else - if(XString<short>::convertFromString(tmp) == 6) + if(_trigMod == 6) argout += "Trigger :Continuous on External\n"; else - if(XString<short>::convertFromString(tmp) == 7) + if(_trigMod == 7) argout += "Trigger :One-Shot on External\n"; //- Voltage Source tmp = _kstatus.substr(10,1); diff --git a/src/Keithley_6512.cpp b/src/Keithley_6512.cpp index b541dd5..5e1fcd7 100644 --- a/src/Keithley_6512.cpp +++ b/src/Keithley_6512.cpp @@ -320,101 +320,106 @@ std::string Keithley_6512::electrometer_status (void) argout += "Suppress : OFF\n"; //- Trigger tmp = _kstatus.substr(10,1); - if(!XString<short>::convertFromString(tmp)) + short trigg = XString<short>::convertFromString(tmp); + if(!trigg) argout += "Trigger : Continuous on Talk\n"; else - if(XString<short>::convertFromString(tmp) == 1) + if(trigg == 1) argout += "Trigger :One-Shot on Talk\n"; else - if(XString<short>::convertFromString(tmp) == 2) + if(trigg == 2) argout += "Trigger :Continuous on Get\n"; else - if(XString<short>::convertFromString(tmp) == 3) + if(trigg == 3) argout += "Trigger :One-Shot on Get\n"; else - if(XString<short>::convertFromString(tmp) == 4) + if(trigg == 4) argout += "Trigger :Continuous on \"X\"\n"; else - if(XString<short>::convertFromString(tmp) == 5) + if(trigg == 5) argout += "Trigger :One-Shot on \"X\"\n"; else - if(XString<short>::convertFromString(tmp) == 6) + if(trigg == 6) argout += "Trigger :Continuous on External\n"; else - if(XString<short>::convertFromString(tmp) == 7) + if(trigg == 7) argout += "Trigger :One-Shot on External\n"; //- Read Mode tmp = _kstatus.substr(12,1); - if(!XString<short>::convertFromString(tmp)) + short readingMode = XString<short>::convertFromString(tmp); + if(!readingMode) argout += "Read Mode : Electrometer\n"; else - if(XString<short>::convertFromString(tmp) == 1) + if(readingMode == 1) argout += "Read Mode : Data Store\n"; else - if(XString<short>::convertFromString(tmp) == 2) + if(readingMode == 2) argout += "Read Mode : Maximum\n"; else - if(XString<short>::convertFromString(tmp) == 3) + if(readingMode == 3) argout += "Read Mode : Minimum\n"; else - if(XString<short>::convertFromString(tmp) == 4) + if(readingMode == 4) argout += "Read Mode :Voltage Source\n"; //- Data Store tmp = _kstatus.substr(15,1); - if(!XString<short>::convertFromString(tmp)) + short dstore = XString<short>::convertFromString(tmp); + if(!dstore) argout += "Data Store : Conversion Rate\n"; else - if(XString<short>::convertFromString(tmp) == 1) + if(dstore == 1) argout += "Data Store : 1 RDG/Sec\n"; else - if(XString<short>::convertFromString(tmp) == 2) + if(dstore == 2) argout += "Data Store : 1 RDG/10Sec\n"; else - if(XString<short>::convertFromString(tmp) == 3) + if(dstore == 3) argout += "Data Store : 1 RDG/Min\n"; else - if(XString<short>::convertFromString(tmp) == 4) + if(dstore == 4) argout += "Data Store : 1 RDG/10Min\n"; else - if(XString<short>::convertFromString(tmp) == 5) + if(dstore == 5) argout += "Data Store : 1 RDG/1Hr\n"; else - if(XString<short>::convertFromString(tmp) == 6) + if(dstore == 6) argout += "Data Store : Trig Button\n"; else - if(XString<short>::convertFromString(tmp) == 7) + if(dstore == 7) argout += "Data Store : Disabled\n"; //- SRQ Mask tmp = _kstatus.substr(16,2); - if(!XString<short>::convertFromString(tmp)) + short srqInfo = XString<short>::convertFromString(tmp); + if(!srqInfo) argout += "SRQ Data Mask : SRQ Disabled\n"; else - if(XString<short>::convertFromString(tmp) == 1) + if(srqInfo == 1) argout += "SRQ Data Mask : Reading Overflow\n"; else - if(XString<short>::convertFromString(tmp) == 2) + if(srqInfo == 2) argout += "SRQ Data Mask : Data Store Full\n"; else - if(XString<short>::convertFromString(tmp) == 8) + if(srqInfo == 8) argout += "SRQ Data Mask : Reading Done\n"; else - if(XString<short>::convertFromString(tmp) == 16) + if(srqInfo == 16) argout += "SRQ Data Mask : Ready\n"; else - if(XString<short>::convertFromString(tmp) == 32) + if(srqInfo == 32) argout += "SRQ Data Mask : Error\n"; //- EOI & Bus Hold Off tmp = _kstatus.substr(18,1); - if(!XString<short>::convertFromString(tmp)) + short ebhoff = XString<short>::convertFromString(tmp); + if(!ebhoff) argout += "EOI & Bus Hold Off : EOI and Hold-Off\n"; else - if(XString<short>::convertFromString(tmp) == 1) + if(ebhoff == 1) argout += "EOI & Bus Hold Off : No EOI and Hold-Off\n"; else - if(XString<short>::convertFromString(tmp) == 2) + if(ebhoff == 2) argout += "EOI & Bus Hold Off : EOI and no Hold-Off\n"; else - if(XString<short>::convertFromString(tmp) == 3) + if(ebhoff == 3) argout += "EOI & Bus Hold Off : No EOI and no Hold-Off\n"; } catch(std::out_of_range) -- GitLab