diff --git a/include/AbstractElectrometerClass.h b/include/AbstractElectrometerClass.h index 0eea71faa96ce987fec8076a4607e096151fb6a3..8e96db92f08b59967b37cb526be7a3748ddad44b 100644 --- a/include/AbstractElectrometerClass.h +++ b/include/AbstractElectrometerClass.h @@ -9,9 +9,16 @@ // // $Author: xavela $ // -// $Revision: 1.4 $ +// $Revision: 1.5 $ // // $Log: not supported by cvs2svn $ +// Revision 1.4 2008/02/08 17:24:32 xavela +// xavier : for DDC part +// - trigger mode and buffer size management added. +// - TODO: DDC/SCPI +// integration time for ScanServer compatibility. +// SRQ management for Keithley Integration mode +// // Revision 1.3 2007/11/28 10:37:30 xavela // compile en MODE debug -> // modifier le(s) MakeFile ! @@ -89,7 +96,7 @@ public: * \brief Following functions are only supported for SCPI protocol * */ - void init_keithley (void); + virtual void init_keithley (void); void clear_registers (void); void averageStateON (void); void averageStateOFF (void); @@ -110,7 +117,7 @@ public: void start_storing (void); void enable_SRQBufferFull (void); void disable_SRQBufferFull (void); - std::string readStatusByteRegister (void); //- used to know if the integration cycle is done! + virtual bool readStatusByteRegister (void); //- used to know if the integration cycle is done! bool get_overloadRangeState (void); //- used to know if the device range is overloaded (DDC Keithley ONLY)! virtual void set_buffer_size (short); virtual void set_triggerMode (short); @@ -173,6 +180,10 @@ protected : std::string _mode; std::string _device_proxy_name; ElectrometerProtocol* _electrometerProtocol; + + //- for internal use -> to configure the Integration mode + short _size; + short _trigMod; private : public : diff --git a/include/CommunicationLink.h b/include/CommunicationLink.h index 848a9332c3008d6bd1af6188bc0ec658ef303b5d..8962a6bd59a1a53bc7174d728ebc771063a6a52c 100644 --- a/include/CommunicationLink.h +++ b/include/CommunicationLink.h @@ -10,11 +10,14 @@ // X. Elattaoui // // -// $Author: stephle $ +// $Author: xavela $ // -// $Revision: 1.1 $ +// $Revision: 1.2 $ // // $Log: not supported by cvs2svn $ +// Revision 1.1 2007/07/09 13:20:35 stephle +// initial import +// // // ============================================================================ @@ -75,6 +78,14 @@ public : */ virtual std::string write_read(std::string cmd_to_send) = 0; + /** + * \brief Returns the Gpib SRQ line state : used here to know if Keithley + * device is ready after an integration cycle. + * + * \throws Tango::DevFailed + */ + virtual bool isSRQLineUp(void)=0; + protected : std::string _communication_Device_name; diff --git a/include/ElectrometerProtocol.h b/include/ElectrometerProtocol.h index 0eb8fc0a0088403e87ed52bc555dcd78dd73b632..49f0d1035d8a327005f22918bc13f3f428f944ab 100644 --- a/include/ElectrometerProtocol.h +++ b/include/ElectrometerProtocol.h @@ -12,9 +12,16 @@ // // $Author: xavela $ // -// $Revision: 1.3 $ +// $Revision: 1.4 $ // // $Log: not supported by cvs2svn $ +// Revision 1.3 2008/02/08 17:24:32 xavela +// xavier : for DDC part +// - trigger mode and buffer size management added. +// - TODO: DDC/SCPI +// integration time for ScanServer compatibility. +// SRQ management for Keithley Integration mode +// // Revision 1.2 2007/11/27 10:17:46 xavela // xavier : // - modif done on Novelec part : @@ -74,7 +81,7 @@ public: virtual std::string get_range(void) = 0; virtual std::vector<double> get_integratedValue (void); virtual std::vector<double> get_fetchValue (void); - virtual std::string readStatusByteRegister (void); //- used to know if the integration cycle is done! + virtual bool readStatusByteRegister (void); //- used to know if the integration cycle is done! virtual bool get_overloadRangeState (void); //- used to know if the device range is overloaded! /** @@ -117,7 +124,7 @@ public: virtual void auto_zero_off (void); /** - * \brief Electrometer : Buffer config + * \brief Electrometer : Integration Mode configuration */ virtual void set_buffer_size (std::string size); virtual void clear_buffer (void); @@ -126,6 +133,15 @@ public: virtual void enable_SRQBufferFull (void); virtual void disable_SRQBufferFull(void); + virtual void set_conversionRate (void); + virtual void enable_readingWithPrefix (void); + virtual void disable_readingWithPrefix (void); + virtual void enable_ReadingsFromElectrometer (void); + virtual void enable_readingsFromBuffer_K617_6512(void); + virtual void enable_readingsFromBuffer_K486_487 (void); + //- only for K_486 and K_487 devices + virtual void enable_integrationPeriod (void); + /** * \brief Electrometer : Novelec protocol dependent commands. diff --git a/include/KeithleyDDCProtocol.h b/include/KeithleyDDCProtocol.h index 5ab6052375a195591f31a9426b18089ad5879fc0..23b19b84cb8fe7ae82d0fb5105ca79530923fc75 100644 --- a/include/KeithleyDDCProtocol.h +++ b/include/KeithleyDDCProtocol.h @@ -46,24 +46,26 @@ public: /** * \brief Electrometer Functions. */ - void set_range (std::string value); - void autoRange_on (void); - void autoRange_off (void); - void autoRange_OFF_forK486_487 (void); - void autoRange_OFF_forK617_6512(void); + void set_range (std::string value); + void autoRange_on (void); + void autoRange_off (void); + void autoRange_OFF_forK486_487 (void); + void autoRange_OFF_forK617_6512 (void); void zero_check_on (void); void zero_check_off (void); void zero_correct_on (void); void zero_correct_off (void); - void auto_zero_on (void); + void auto_zero_on (void); void auto_zero_off (void); - void reset (void); + void reset (void); // void local (void); // To be implemented in future library versions // void remote (void); - /** + bool readStatusByteRegister (void); //- used to know if the integration cycle is done! + + /** * \brief Electrometer : cmd to get electrometer data. */ std::string get_value(void); @@ -71,12 +73,12 @@ public: /** * \brief Electrometer Mode. */ - void setAmperMeterMode (void); - void setAmperMeterMode_forK487 (void); - void setVoltMeterMode (void); - void setOhmMeterMode (void); - void setCoulombMeterMode(void); - void clear_registers (void); + void setAmperMeterMode (void); + void setAmperMeterMode_forK487 (void); + void setVoltMeterMode (void); + void setOhmMeterMode (void); + void setCoulombMeterMode (void); + void clear_registers (void); /** * \brief Get Raw Electrometer Status. @@ -90,9 +92,27 @@ public: std::string get_range (void); bool get_overloadRangeState (void) { return _is_overloaded; };//- used to know if the device range is overloaded! - void set_buffer_size (std::string); - void set_triggerMode (std::string); - /* TODO : for next PicoLib evolution + /** + * \brief Methods to configure the Integration mode + */ + void set_buffer_size (std::string); + void set_triggerMode (std::string); + void enable_SRQBufferFull (void); + void disable_SRQBufferFull (void); + void set_conversionRate (void); + void enable_readingWithPrefix (void); + void disable_readingWithPrefix (void); + void enable_ReadingsFromElectrometer (void); + void enable_readingsFromBuffer_K617_6512(void); + void enable_readingsFromBuffer_K486_487 (void); + //- only for K_486 and K_487 devices + void enable_integrationPeriod (void); + + + + + + /* TODO : for next PicoLib evolution //- CMD B virtual void reading_source (void); //- CMD Q diff --git a/include/KeithleySCPIProtocol.h b/include/KeithleySCPIProtocol.h index 6ecadacff5d084c59012eb927ae9594bf645ed89..3d4b2ddd6ceaf14f1bacb325107c52fafb392ccf 100644 --- a/include/KeithleySCPIProtocol.h +++ b/include/KeithleySCPIProtocol.h @@ -76,7 +76,7 @@ public: std::string get_value (void); std::vector<double> get_integratedValue (void); std::vector<double> get_fetchValue (void); - std::string readStatusByteRegister (void); //- used to know if the integration cycle is done! + bool readStatusByteRegister (void); //- used to know if the integration cycle is done! void init_keithley (void); /** diff --git a/include/Keithley_486.h b/include/Keithley_486.h index 2e9c4fe6652bf862622571e9325f5e7b2958a110..e2719a6f10de88e8c7fa5a7fc395f2744fc56186 100644 --- a/include/Keithley_486.h +++ b/include/Keithley_486.h @@ -50,6 +50,7 @@ public: void autoRange_off (void); void set_buffer_size(short); void set_triggerMode(short); + void init_keithley (void); /** * \brief getter(s) & setter(s) diff --git a/include/Keithley_487.h b/include/Keithley_487.h index b5b14702d8dcea0534398f2c2f1b05801936f967..b27ca3e833c8cbacdb052ca1b8b8e9a3cd43473b 100644 --- a/include/Keithley_487.h +++ b/include/Keithley_487.h @@ -50,6 +50,7 @@ public: void autoRange_off (void); void set_buffer_size(short); void set_triggerMode(short); + void init_keithley (void); /** * \brief Electrometer Function(s). diff --git a/include/Keithley_617.h b/include/Keithley_617.h index b289dd57a9b9f76258118a27226b45e1802f23fb..ded8cf0cfde671b69cd8a6d3f79c871023062ae0 100644 --- a/include/Keithley_617.h +++ b/include/Keithley_617.h @@ -50,6 +50,7 @@ public: void range_down (void); void set_buffer_size (short not_used); void set_triggerMode (short); + void init_keithley (void); /** * \brief Electrometer Mode. diff --git a/include/Keithley_6512.h b/include/Keithley_6512.h index 860181301ba46bf80ef8e13f91fbd90bece08e8b..b4e0a9fe5b5a4167413fb6a9534df969a647a4cb 100644 --- a/include/Keithley_6512.h +++ b/include/Keithley_6512.h @@ -50,6 +50,7 @@ public: void range_down (void); void set_buffer_size (short not_used); void set_triggerMode (short); + void init_keithley (void); /** * \brief Electrometer Mode. diff --git a/include/TangoGpibLink.h b/include/TangoGpibLink.h index d03a03131c94d1992dc3dd5f07518f75937e16bb..22422d768a22c4267eefa6c08873ed08e2917ff5 100644 --- a/include/TangoGpibLink.h +++ b/include/TangoGpibLink.h @@ -68,6 +68,14 @@ public : */ std::string write_read(std::string cmd) throw (Tango::DevFailed); + /** + * \brief Returns the Gpib SRQ line state : used here to know if Keithley + * device is ready after an integration cycle. + * + * \throws Tango::DevFailed + */ + bool isSRQLineUp(void) throw (Tango::DevFailed); + private : /** diff --git a/include/TangoSerialLink.h b/include/TangoSerialLink.h index 826da785354403dbf789de069d60638709e5cd46..9cf2bf77b66c6f882fa3f48e0878743512decb95 100644 --- a/include/TangoSerialLink.h +++ b/include/TangoSerialLink.h @@ -68,6 +68,14 @@ public : */ std::string write_read(std::string cmd) throw (Tango::DevFailed); + /** + * \brief Returns the Gpib SRQ line state : used here to know if Keithley + * device is ready after an integration cycle. + * + * \throws Tango::DevFailed + */ + bool isSRQLineUp(void) throw (Tango::DevFailed); + private : /** * Creates a proxy on the specified Serial Device. diff --git a/src/AbstractElectrometerClass.cpp b/src/AbstractElectrometerClass.cpp index 846bafb69933865e0a801c4ededcaa1de1cbcabc..b600a9a225f561ea57f69eb889016108325784e4 100644 --- a/src/AbstractElectrometerClass.cpp +++ b/src/AbstractElectrometerClass.cpp @@ -11,9 +11,16 @@ // // $Author: xavela $ // -// $Revision: 1.5 $ +// $Revision: 1.6 $ // // $Log: not supported by cvs2svn $ +// Revision 1.5 2008/02/08 17:24:33 xavela +// xavier : for DDC part +// - trigger mode and buffer size management added. +// - TODO: DDC/SCPI +// integration time for ScanServer compatibility. +// SRQ management for Keithley Integration mode +// // Revision 1.4 2007/11/28 10:37:20 xavela // compile en MODE debug -> // modifier le(s) MakeFile ! @@ -148,7 +155,9 @@ void AbstractElectrometerClass::auto_zero_off (void) // ============================================================================ void AbstractElectrometerClass::init_keithley (void) { - _electrometerProtocol->init_keithley( ); + throw electrometer::ElectrometerException("COMMAND_NOT_SUPPORTED", + "This Electrometer does not support this command.", + "AbstractElectrometerClass::init_keithley( )."); } // ============================================================================ @@ -451,7 +460,7 @@ void AbstractElectrometerClass::disable_SRQBufferFull (void) // ============================================================================ // AbstractElectrometerClass::readStatusByteRegister // ============================================================================ -std::string AbstractElectrometerClass::readStatusByteRegister (void) +bool AbstractElectrometerClass::readStatusByteRegister (void) { return _electrometerProtocol->readStatusByteRegister(); } diff --git a/src/ElectrometerProtocol.cpp b/src/ElectrometerProtocol.cpp index 0f69a8a6bec575651cdf1176ae938762fd548069..1dd1cb680038858cc576db490931909fd0a478f7 100644 --- a/src/ElectrometerProtocol.cpp +++ b/src/ElectrometerProtocol.cpp @@ -583,7 +583,7 @@ void ElectrometerProtocol::disable_SRQBufferFull (void) // ============================================================================ // ElectrometerProtocol::readStatusByteRegister // ============================================================================ -std::string ElectrometerProtocol::readStatusByteRegister (void) +bool ElectrometerProtocol::readStatusByteRegister (void) { throw electrometer::ElectrometerException("COMMAND_NOT_SUPPORTED", "This Electrometer does not support this command.", @@ -600,3 +600,73 @@ bool ElectrometerProtocol::get_overloadRangeState (void) "ElectrometerProtocol::get_overloadRangeState( )."); } +// ============================================================================ +// ElectrometerProtocol::set_conversionRate +// ============================================================================ +void ElectrometerProtocol::set_conversionRate (void) +{ + throw electrometer::ElectrometerException("COMMAND_NOT_SUPPORTED", + "This Electrometer does not support this command.", + "ElectrometerProtocol::set_conversionRate( )."); +} + +// ============================================================================ +// ElectrometerProtocol::enable_readingWithPrefix +// ============================================================================ +void ElectrometerProtocol::enable_readingWithPrefix (void) +{ + throw electrometer::ElectrometerException("COMMAND_NOT_SUPPORTED", + "This Electrometer does not support this command.", + "ElectrometerProtocol::enable_readingWithPrefix( )."); +} + +// ============================================================================ +// ElectrometerProtocol::disable_readingWithPrefix +// ============================================================================ +void ElectrometerProtocol::disable_readingWithPrefix (void) +{ + throw electrometer::ElectrometerException("COMMAND_NOT_SUPPORTED", + "This Electrometer does not support this command.", + "ElectrometerProtocol::disable_readingWithPrefix( )."); +} + +// ============================================================================ +// ElectrometerProtocol::enable_ReadingsFromElectrometer +// ============================================================================ +void ElectrometerProtocol::enable_ReadingsFromElectrometer (void) +{ + throw electrometer::ElectrometerException("COMMAND_NOT_SUPPORTED", + "This Electrometer does not support this command.", + "ElectrometerProtocol::enable_ReadingsFromElectrometer( )."); +} + +// ============================================================================ +// ElectrometerProtocol::enable_readingsFromBuffer_K617_6512 +// ============================================================================ +void ElectrometerProtocol::enable_readingsFromBuffer_K617_6512 (void) +{ + throw electrometer::ElectrometerException("COMMAND_NOT_SUPPORTED", + "This Electrometer does not support this command.", + "ElectrometerProtocol::enable_readingsFromBuffer_K617_6512( )."); +} + +// ============================================================================ +// ElectrometerProtocol::enable_readingsFromBuffer_K486_487 +// ============================================================================ +void ElectrometerProtocol::enable_readingsFromBuffer_K486_487 (void) +{ + throw electrometer::ElectrometerException("COMMAND_NOT_SUPPORTED", + "This Electrometer does not support this command.", + "ElectrometerProtocol::enable_readingsFromBuffer_K486_487( )."); +} + +// ============================================================================ +// ElectrometerProtocol::enable_integrationPeriod +// ============================================================================ +void ElectrometerProtocol::enable_integrationPeriod (void) +{ + throw electrometer::ElectrometerException("COMMAND_NOT_SUPPORTED", + "This Electrometer does not support this command.", + "ElectrometerProtocol::enable_integrationPeriod( )."); +} + diff --git a/src/KeithleyDDCProtocol.cpp b/src/KeithleyDDCProtocol.cpp index d0fbcadb3147972446da4194b8c468061da785ca..9562737cce2d7437a695dc03f148be6ff44219fb 100644 --- a/src/KeithleyDDCProtocol.cpp +++ b/src/KeithleyDDCProtocol.cpp @@ -276,16 +276,17 @@ std::stringstream cmd_to_send; std::string argout("no data"); //- send command : G0X -> prefix (to check if device overload !) and second X to get data - cmd_to_send << "G0" << std::ends; - _communication_link->write(cmd_to_send.str()); - +// cmd_to_send << "G0" << std::ends; +// _communication_link->write(cmd_to_send.str()); + this->enable_readingWithPrefix(); //- get data value - cmd_to_send << "X" << std::ends; - argout = _communication_link->write_read(cmd_to_send.str()); +// cmd_to_send << "X" << std::ends; + argout = _communication_link->read(); //- send command : G1X -> no prefix and second X to get data - cmd_to_send << "G1X" << std::ends; - _communication_link->write(cmd_to_send.str()); +// cmd_to_send << "G1X" << std::ends; +// _communication_link->write(cmd_to_send.str()); + this->disable_readingWithPrefix(); //- check if device range is overloaded if(argout[0] == 'O') @@ -355,7 +356,7 @@ void KeithleyDDCProtocol::set_buffer_size (std::string cmd) } // ============================================================================ -// KeithleyDDCProtocol::set_buffer_size() +// KeithleyDDCProtocol::set_triggerMode() // ============================================================================ void KeithleyDDCProtocol::set_triggerMode (std::string cmd) { @@ -363,9 +364,139 @@ void KeithleyDDCProtocol::set_triggerMode (std::string cmd) _communication_link->write(cmd); } +// ============================================================================ +// KeithleyDDCProtocol::enable_SRQBufferFull() +// ============================================================================ +void KeithleyDDCProtocol::enable_SRQBufferFull (void) +{ + std::string cmd_to_send("M2X"); + + //- send command : enable buffer full in the Measurement event enable register + _communication_link->write(cmd_to_send); + +} + +// ============================================================================ +// KeithleyDDCProtocol::disable_SRQBufferFull() +// ============================================================================ +void KeithleyDDCProtocol::disable_SRQBufferFull (void) +{ +std::string cmd_to_send("M0X"); + + //- send command : disable buffer full event + _communication_link->write(cmd_to_send); + +} + +// ============================================================================ +// KeithleyDDCProtocol::readStatusByteRegister() +// ============================================================================ +bool KeithleyDDCProtocol::readStatusByteRegister (void) +{ + //- if asserted -> the programmed event occurs : the device can be asked ! + return _communication_link->isSRQLineUp(); +} + +// ============================================================================ +// KeithleyDDCProtocol::set_conversionRate() +// ============================================================================ +void KeithleyDDCProtocol::set_conversionRate (void) +{ +std::string cmd_to_send("Q0X"); + + //- send command : ADC default conversion rate + _communication_link->write(cmd_to_send); +} + +// ============================================================================ +// KeithleyDDCProtocol::enable_readingWithPrefix() +// ============================================================================ +void KeithleyDDCProtocol::enable_readingWithPrefix (void) +{ +std::string cmd_to_send("G0X"); + + //- send command : ADC default conversion rate + _communication_link->write(cmd_to_send); +} + +// ============================================================================ +// KeithleyDDCProtocol::disable_readingWithPrefix() +// ============================================================================ +void KeithleyDDCProtocol::disable_readingWithPrefix (void) +{ +std::string cmd_to_send("G1X"); + + //- send command : ADC default conversion rate + _communication_link->write(cmd_to_send); +} + +// ============================================================================ +// KeithleySCPIProtocol::enable_ReadingsFromElectrometer() +// ============================================================================ +void KeithleyDDCProtocol::enable_ReadingsFromElectrometer (void) +{ +std::string cmd_to_send("B0X"); + + //- send command : readings from Electrometer + _communication_link->write(cmd_to_send); + +} + +// ============================================================================ +// KeithleyDDCProtocol::enable_readingsFromBuffer_K617_6512() +// ============================================================================ +void KeithleyDDCProtocol::enable_readingsFromBuffer_K617_6512 (void) +{ +std::string cmd_to_send("B1X"); + + //- send command : ADC default conversion rate + _communication_link->write(cmd_to_send); +} + +// ============================================================================ +// KeithleyDDCProtocol::enable_readingsFromBuffer_K486_487() +// ============================================================================ +void KeithleyDDCProtocol::enable_readingsFromBuffer_K486_487 (void) +{ +std::string cmd_to_send("B2X"); + + //- send command : ADC default conversion rate + _communication_link->write(cmd_to_send); +} + +// ============================================================================ +// KeithleyDDCProtocol::enable_integrationPeriod() +// ============================================================================ +void KeithleyDDCProtocol::enable_integrationPeriod (void) +{ +std::string cmd_to_send("S1X"); + + //- + //- send command : this command is only for k_486 or K_487 + //- S1 is for : "Line cycle integration period (5-I /2d resolution)" + _communication_link->write(cmd_to_send); +} + + +/*// ============================================================================ +// KeithleyDDCProtocol::init_keithley to perform reading(s) data +// ============================================================================ +void KeithleyDDCProtocol::init_keithley (void) +{ + //- Set default conversion rate (internal keithley device conversion rate) + this->set_conversionRate(); + //- Set default conversion rate (internal keithley device conversion rate) + this->set_conversionRate(); + //- Disable readings with prefix + this->disable_readingWithPrefix(); + + //- send command : INIT to trigg readings ! + _communication_link->write(cmd_to_send); +} + // Following functions are part of commands supported via the DDC protocol. // We may have to implement them after first tests on beamlines -/* + // ============================================================================ // KeithleyDDCProtocol::setExternalFeedbackMeterMode (617 & 6512 Keithley DDC models // ============================================================================ diff --git a/src/KeithleySCPIProtocol.cpp b/src/KeithleySCPIProtocol.cpp index 1b96a68871bc5998d97ab0b3fbc701becb06a85f..9e404cc9bcddd698380f346a897c1feda9b9bdef 100644 --- a/src/KeithleySCPIProtocol.cpp +++ b/src/KeithleySCPIProtocol.cpp @@ -490,7 +490,7 @@ std::string cmd_to_send(""); _communication_link->write(cmd_to_send); //- set buffer size ( = number of triggers ) - set_buffer_size(nbTrigCount); +// set_buffer_size(nbTrigCount); } @@ -789,12 +789,10 @@ std::string cmd_to_send("STAT:MEAS?"); // ============================================================================ // KeithleySCPIProtocol::readStatusByteRegister() // ============================================================================ -std::string KeithleySCPIProtocol::readStatusByteRegister (void) +bool KeithleySCPIProtocol::readStatusByteRegister (void) { -std::string cmd_to_send("*STB?"); - - //- if asserted -> the event sets a bit in the Status Byte Register - return _communication_link->write_read(cmd_to_send); + //- if asserted -> the programmed event occurs : the device can be asked ! + return _communication_link->isSRQLineUp(); //- Cf Keithley doc to know how the to get the wanted event //- Chapter : Status Structure diff --git a/src/Keithley_486.cpp b/src/Keithley_486.cpp index bd5004272aa0a8b7e789fbb17626e3c783d59d7b..49e6374c9a4a43ccff34830aa5977051a17e9734 100644 --- a/src/Keithley_486.cpp +++ b/src/Keithley_486.cpp @@ -45,6 +45,8 @@ Keithley_486::Keithley_486 (std::string& comLink_device_name):AbstractElectromet //- build the keithley Electrometer obj _electrometerProtocol = new KeithleyDDCProtocol(_device_proxy_name); + _size = -1; + _trigMod = -1; std::cout << "Keithley_486::Keithley_486 ->" << std::endl; } @@ -138,6 +140,9 @@ void Keithley_486::set_buffer_size (short size) { std::stringstream cmd_to_send; + //- just for internal use + _size = size; + //- send command : size = number of triggers cmd_to_send << "N" << size << "X" << std::endl; _electrometerProtocol->set_buffer_size(cmd_to_send.str()); @@ -156,12 +161,36 @@ void Keithley_486::set_triggerMode (short trigMod) std::stringstream cmd_to_send; - cmd_to_send << trigMod << std::endl; + //- just for internal use + _trigMod = trigMod; + + cmd_to_send << "T" << trigMod << "X" << std::endl; _electrometerProtocol->set_triggerMode(cmd_to_send.str()); } +// ============================================================================ +// Keithley_486::init_keithley : command to perform an integration cycle +// ============================================================================ +void Keithley_486::init_keithley (void) +{ + //- default conversion rate +// _electrometerProtocol->set_conversionRate( ); + //- set default integration period +// _electrometerProtocol->enable_integrationPeriod( ); + //- set trigger mode + this->set_triggerMode(_trigMod); + //- set buffer size + this->set_buffer_size(_size); + //- enable readings from device buffer + _electrometerProtocol->enable_readingsFromBuffer_K486_487( ); + //- force readings with no prefix + _electrometerProtocol->disable_readingWithPrefix(); + //- enable SRQ on buffer full + _electrometerProtocol->enable_SRQBufferFull (); +} + // ============================================================================ // Keithley_486::electrometer_status // ============================================================================ diff --git a/src/Keithley_487.cpp b/src/Keithley_487.cpp index 4d64c42f1e1acf56cec08ce038d30011b7fefd7f..941e80a238240f490fa87a3ae3d7b297b68a1ed3 100644 --- a/src/Keithley_487.cpp +++ b/src/Keithley_487.cpp @@ -141,6 +141,12 @@ void Keithley_487::set_buffer_size (short size) { std::stringstream cmd_to_send; + //- check if size is valid + if(size<0 || size>512) + throw electrometer::ElectrometerException("OUT_OF_RANGE", + "Buffer size value invalid. Please enter a value in the range 0 - 512.", + "Keithley_487::set_buffer_size( )."); + //- send command : size = number of triggers cmd_to_send << "N" << size << "X" << std::endl; _electrometerProtocol->set_buffer_size(cmd_to_send.str()); @@ -192,6 +198,23 @@ void Keithley_487::setAmperMeterMode (void) "Keithley_487::setAmperMeterMode( )."); } +// ============================================================================ +// Keithley_487::init_keithley : command to perform an integration cycle +// ============================================================================ +void Keithley_487::init_keithley (void) +{ + //- default conversion rate + _electrometerProtocol->set_conversionRate( ); + //- set default integration period + _electrometerProtocol->enable_integrationPeriod( ); + //- enable readings from device buffer + _electrometerProtocol->enable_readingsFromBuffer_K486_487( ); + //- force readings with no prefix + _electrometerProtocol->disable_readingWithPrefix(); + //- enable SRQ on buffer full + _electrometerProtocol->enable_SRQBufferFull (); +} + // ============================================================================ // Keithley_487::electrometer_status // ============================================================================ diff --git a/src/Keithley_617.cpp b/src/Keithley_617.cpp index 4b9dbca68b0df2697c9229f5a06127209bf897c1..b2fbcbb086c5092d1ee0a54b99825a941024ff86 100644 --- a/src/Keithley_617.cpp +++ b/src/Keithley_617.cpp @@ -212,6 +212,21 @@ void Keithley_617::setCoulombMeterMode (void) _electrometerProtocol->setCoulombMeterMode( ); } +// ============================================================================ +// Keithley_617::init_keithley : command to perform an integration cycle +// ============================================================================ +void Keithley_617::init_keithley (void) +{ + //- default conversion rate + _electrometerProtocol->set_conversionRate( ); + //- force readings with no prefix + _electrometerProtocol->disable_readingWithPrefix(); + //- force readings from device buffer + _electrometerProtocol->enable_readingsFromBuffer_K617_6512(); + //- enable SRQ on buffer full + _electrometerProtocol->enable_SRQBufferFull (); +} + // ============================================================================ // Keithley_617::electrometer_status // ============================================================================ diff --git a/src/Keithley_6512.cpp b/src/Keithley_6512.cpp index 645a6276615cd0f64386b7d5a129792f006d2693..87564b6c93759d54a9d6cf29207c663c475b9a55 100644 --- a/src/Keithley_6512.cpp +++ b/src/Keithley_6512.cpp @@ -43,7 +43,9 @@ static short K6512_triggerModeLimit = 7; // ============================================================================ // Keithley_6512::Keithley_6512 // ============================================================================ -Keithley_6512::Keithley_6512 (std::string& comLink_device_name):AbstractElectrometerClass(comLink_device_name) +Keithley_6512::Keithley_6512 (std::string& comLink_device_name) +: AbstractElectrometerClass(comLink_device_name) + { std::cout << "Keithley_6512::Keithley_6512 <-" << std::endl; @@ -210,6 +212,21 @@ void Keithley_6512::setCoulombMeterMode (void) _electrometerProtocol->setCoulombMeterMode( ); } +// ============================================================================ +// Keithley_6512::init_keithley : command to perform an integration cycle +// ============================================================================ +void Keithley_6512::init_keithley (void) +{ + //- default conversion rate + _electrometerProtocol->set_conversionRate( ); + //- force readings with no prefix + _electrometerProtocol->disable_readingWithPrefix(); + //- force readings from device buffer + _electrometerProtocol->enable_readingsFromBuffer_K617_6512(); + //- enable SRQ on buffer full + _electrometerProtocol->enable_SRQBufferFull (); +} + // ============================================================================ // Keithley_6512::electrometer_status // ============================================================================ diff --git a/src/TangoGpibLink.cpp b/src/TangoGpibLink.cpp index 92ee23a3745f0216c9caf01d041505188632f609..c50bbdc7d8e75ef76fb496c70a80065a6572a751 100644 --- a/src/TangoGpibLink.cpp +++ b/src/TangoGpibLink.cpp @@ -163,3 +163,34 @@ std::string TangoGpibLink::write_read (std::string command_to_send) throw (Tango } +// ============================================================================ +// TangoGpibLink::isSRQLineUp +// ============================================================================ +bool TangoGpibLink::isSRQLineUp (void) throw (Tango::DevFailed) +{ + TangoSys_OMemStream description; + bool result = false; + + if(!_is_gpib_proxy_created) + create_gpib_proxy(); + + try + { + //- try + this->_gpib_proxy->read_attribute("isSRQLineAsserted", result); + return result; + + } + catch(Tango::DevFailed& df ) + { + description << "Unable to get Gpib SRQ line state." << ends; + + Tango::Except::re_throw_exception (df, + (const char*)"COMMUNICATION_ERROR", + description.str(), + (const char*)"TangoGpibLink::isSRQLineUp"); + + } + +} + diff --git a/src/TangoSerialLink.cpp b/src/TangoSerialLink.cpp index e87c01b2f8c0f07b5f725498f47da443713515c2..75b4ab861e523dd27844bb9992ddab0afd288327 100644 --- a/src/TangoSerialLink.cpp +++ b/src/TangoSerialLink.cpp @@ -154,3 +154,14 @@ std::string TangoSerialLink::write_read (std::string command_to_send) throw (Tan return respTmp; } +// ============================================================================ +// TangoSerialLink::isSRQLineUp +// ============================================================================ +bool TangoSerialLink::isSRQLineUp (void) throw (Tango::DevFailed) +{ + Tango::Except::throw_exception ( + (const char*)"COMMAND_NOT_SUPPORTED", + (const char*)"This protocol does not support this command.", + (const char*)"TangoSerialLink::isSRQLineUp"); + return false; +}