機能
モータの停止位置(総出力パルス数)を設定します。
書式
Ret = SmcWSetStopPosition( Id , AxisNo , Coordinate, StopPosition )
引数
Id
[ VB.NET: Short ] [ C, C++: short ] [ C#: short ] [ Python: ctypes.c_short
]
SmcWInit 関数で取得したデバイスIDを指定します。
AxisNo
[ VB.NET: Short ] [ C, C++: short ] [ C#: short ] [ Python: ctypes.c_short
]
軸番号を指定します。
Coordinate
[ VB.NET: Short ] [ C, C++: short ] [ C#: short ] [ Python: ctypes.c_short
]
位置の座標タイプを指定します。
0 |
絶対座標 |
1 |
相対座標 |
StopPosition
[ VB.NET: Integer ] [ C, C++: long ] [ C#: int ] [ Python: ctypes.c_long
]
停止位置を設定します。
利用デバイスによって、設定範囲が異なります。詳細は、デバイス別使用の項目を参照ください。
設定可能範囲 :
絶対座標 : -134,217,728 ~
+134,217,727
相対座標 : -134,217,728 ~
+134,217,727 ( 0を除く )
戻り値
Ret [ VB.NET: Integer ] [ C, C++: long ] [ C#: int ] [ Python: ctypes.c_long ]
0 |
正常終了 |
0以外 |
異常終了 |
参照:エラーコード詳細
説明
Coordinateに絶対座標を指定し、StopPositionにSmcWGetOutPulseで取得した値を
指定した場合、移動距離は0となるため戻り値はエラーコードが返ります。
Coordinateに絶対座標を指定した場合、「0」の位置を基準点とします。
座標はSmcWGetOutPulseで取得した値です。また、SmcWSetOutPulseでプリセット可能です。
例えば、現在位置を基準点とする場合、SmcWSetOutPulseで「0」をプリセットしてください。
型式 |
パルスコントロールLSIの型式 |
StopPosition設定範囲 |
SMC-4DL-PE |
PCL6145相当 (32ビット) |
絶対座標:-2,147,483,648~+2,147,483,647 |
PCL6143相当 (28ビット) |
絶対座標:-134,217,728
~+134,217,727 |
|
SMC-4DF2-PCI |
PCL6045BL相当 (28ビット) |
絶対座標:-134,217,728
~+134,217,727 |
利用デバイスのパルスコントロールLSIは、診断レポートでご確認ください。
使用例
軸番号1のモータの停止位置(総出力パルス数)を設定します。
相対座標で1000パルスを設定します。
VB.NET
Dim Ret As Integer
Dim Coordinate As Short
Dim StopPosition As Integer
Coordinate = 1
StopPosition = 1000
Ret = SmcWSetStopPosition( Id , 1, Coordinate , StopPosition )
C, C++
long Ret;
short Coordinate ;
long StopPosition ;
Coordinate = 1;
StopPosition = 1000;
Ret = SmcWSetStopPosition( Id , 1, Coordinate , StopPosition ) ;
C#
int Ret;
short Coordinate ;
int StopPosition ;
Coordinate = 1;
StopPosition = 1000;
Ret = Smc.WSetStopPosition( Id , 1, Coordinate , StopPosition ) ;
Python
Ret = ctypes.c_long()
Coordinate = ctypes.c_short()
StopPosition = ctypes.c_long()
Coordinate.value = 1
StopPosition.value = 1000
Ret.value = csmc.SmcWSetStopPosition( Id , 1, Coordinate , StopPosition
)
関連項目