#============================================================ # Keithley6517A #============================================================ package Keithley6517A; use Device::DeviceObject; @ISA = qw(DeviceObject); #公開したいサブルーチン @EXPORT = qw(); use strict; use Deps; #============================================================ # コンストラクタ、デストラクタ #============================================================ BEGIN { } sub new { my ($module, @args) = @_; my $this = {}; bless $this; return $this; } sub DESTROY { my $this = shift; $this->Finish(); } #============================================================ # 変数取得関数 #============================================================ #============================================================ # 一般関数 #============================================================ sub Initialize { my ($this) = @_; $this->Clear(); $this->Reset(); $this->SetVSourceOutput("off"); $this->SetSourceVoltage(0.0); $this->print(":syst:zcheck off\n"); } sub Finish { my ($this) = @_; $this->SetVSourceOutput("off"); $this->SetSourceVoltage(0.0); } sub Clear { my ($this) = @_; $this->print("*CLS\n"); } sub Reset { my ($this) = @_; $this->print("*RST\n"); } sub GetId { my ($this) = @_; $this->print("*IDN?\n"); return $this->read(); } sub SetDCCurrentMode { my ($this, $ZeroCheck) = @_; $this->print(':sens:func "curr:dc"' . "\n"); $this->print(":syst:zcheck $ZeroCheck\n"); $this->print(":syst:zcorrect:state on\n"); $this->print(":syst:zcheck off\n"); $this->print(":sens:curr:range:auto on\n"); } sub Measure { my ($this) = @_; $this->print(":read?\n"); my $ReturnStr = $this->read(); my ($ValueStr) = split(/,/, $ReturnStr); $ValueStr =~ s/NADC//; return $ValueStr; } sub SetSourceVoltage { my ($this, $V) = @_; $this->print(":sour:volt $V\n"); } sub SetVSourceOutput { my ($this, $f) = @_; # $f = 'on' or 'off'; $this->print(":outp:stat $f\n"); } sub SetVSourceLimit { my ($this, $VSourceLimit) = @_; $this->print(":sour:volt:limit:AMPL 1000\n"); # $this->print(":sour:volt:limit $VSourceLimit\n"); $this->print(":sour:volt:limit:stat off\n"); } sub SetAutoRangeForCurrent { my ($this, $f) = @_; # $f = 'ON' or 'OFF' $this->print(":sens:curr:rang:auto $f\n"); } 1;