#============================================================ # SteppingmotorD92 #============================================================ package SteppingmotorD92; use Device::DeviceObject; @ISA = qw(DeviceObject); #公開したいサブルーチン @EXPORT = qw(); use strict; use Deps; my $DefaultWaitForGratingChange = 10; my $UseRead = 0; #============================================================ # コンストラクタ、デストラクタ #============================================================ BEGIN { } sub new { my ($module, @args) = @_; my $this = {}; bless $this; # $this->Initialize(); return $this; } sub DESTROY { my $this = shift; $this->Finish(); } #============================================================ # 変数取得関数 #============================================================ #============================================================ # 一般関数 #============================================================ sub Initialize { my ($this) = @_; } sub Finish { my ($this) = @_; } sub GetId { my ($this) = @_; return 'Fixed: Stepping motor controller model D92'; } sub SetPPS #立ち上がり速度設定 { my ($this, $speed) = @_; $this->print("XL${speed}UG\r\n"); return $this->read(); } sub SetPresentPosition { my ($this, $Pos) = @_; if(!defined $Pos) { $this->print("XS\r\n"); } else { $this->print("XS$Pos\r\n"); } } sub GetPosition #ポジション要求 { my ($this, $axis) = @_; $this->print('?X' . "\r\n"); return $this->read(); } sub SetX #現在位置(ポジション)設定;x軸 { my ($this, $positionX) = @_; my $PresentPos = $this->GetPosition(); # my $PresentPos = 0; my $Move = $positionX - $PresentPos; $this->MoveRelativeX($Move); } sub MoveRelativeX { my ($this, $Move) = @_; if($Move > 0) { $this->print("XP${Move}UG\r\n"); } elsif($Move < 0) { $Move = -$Move; $this->print("XP${Move}DG\r\n"); } } sub GetAxis #座標軸要求 { my ($this, $axis) = @_; $this->print('&' . "\n"); return $this->read(); } sub QuickStop #急停止 { my ($this) = @_; $this->print('E' . "\n"); } sub SlowStop #減速停止 { my ($this) = @_; $this->print('H' . "\n"); } sub SetSpeed #駆動速度設定 { my ($this, $speed) = @_; $this->print("XF${speed}UG\n"); } sub SetAcceleration #加減速レート設定 { my ($this, $acceleration) = @_; $this->print("XR${acceleration}UG\n"); return $this->read(); } 1;