#============================================================ # Keithley6517A #============================================================ package Keithley6517A; use Exporter; use MyGPIB::GPIBDevice; @ISA = qw(Exporter GPIBDevice); #公開したいサブルーチン @EXPORT = qw(); use strict; use Deps; #============================================================ # コンストラクタ、デストラクタ #============================================================ BEGIN { } sub new { my ($module, $interface, $devname) = @_; $interface = 'ni' if($interface eq ''); my $this = {}; bless $this; my ($name, $addr) = ($devname =~ /(\w+):(\d+)/); if(defined $addr) { $this->Open($interface, 0, $name, $addr, 0, GPIB->T1s, 1, 0); } return $this; } sub DESTROY { my $this = shift; } #============================================================ # 変数取得関数 #============================================================ #============================================================ # 一般関数 #============================================================ sub Initialize { my ($this) = @_; $this->print("*CLS"); $this->print("*RST"); $this->print(":outp:stat off"); $this->print(":sour:volt 0"); $this->print(":syst:zcheck off"); } sub Finish { my ($this) = @_; $this->print(":outp:stat off"); $this->print(":sour:volt 0"); } sub SetDCCurrentMode { my ($this, $ZeroCheck) = @_; $this->print(":syst:zcheck $ZeroCheck"); $this->print(":syst:zcorrect:state on"); $this->print(":syst:zcheck off"); #print "Zcheck/corr\n"; <>; $this->print(':sens:func "curr:dc"'); $this->print(":sens:curr:range:auto on"); #print "sense\n"; <>; } sub Measure { my ($this) = @_; $this->print(":read?"); my $ReturnStr = $this->read(); my ($ValueStr) = split(/,/, $ReturnStr); $ValueStr =~ s/NADC//; return $ValueStr; } sub MeasureAveraged { my ($this, $nAverage) = @_; my $avrI = 0.0; for(my $i = 0 ; $i < $nAverage ; $i++) { my $I = $this->Measure(); $avrI += $I; } return $avrI / $nAverage; } sub SetSourceVoltage { my ($this, $V) = @_; $this->print(":sour:volt $V"); } 1;