機能
Modbus通信におけるバイト間のタイムアウト時間を設定します。
書式
ret = modbus_set_byte_timeout( ctx , to_sec , to_usec )
引数
ctx [ VB.NET: IntPtr ] [ C, C++: modbus_t * ] [ C#: IntPtr ] [ Python:ctypes.POINTER(modbus_t) ]
libmodbus構造体へのポインタを指定下さい。
to_sec [ VB.NET: Uinteger ] [ C, C++: uint32_t * ] [ C#:uint ] [ Python: ctypes.POINTER(ctypes.c_uint32) ]
タイムアウト時間における、1秒以上の部分(秒単位)を指定下さい。
to_usec [ VB.NET:Uinteger ] [ C, C++: uint32_t * ] [ C#:out uint ] [ Python: ctypes.POINTER(ctypes.c_uint32) ]
タイムアウト時間における、1秒未満の部分(μ秒単位)を指定下さい。
値の範囲:0-999999
戻り値
ret [ VB.NET:Integer ] [ C, C++: int ] [ C#: int ] [ Python: ctypes.c_int ]
成功時には0が入ります。失敗時には-1が入り、以下の errno が設定されます。
定義 |
意味 |
EINVAL |
CTXが不正か、to_usecが1000000以上か、 to_sec及びto_usecが両方0に設定されています。 |
説明
Modbus通信における、同メッセージ内のバイト間におけるタイムアウト時間を設定できます。
使用例
タイムアウト時間を1.234秒に設定します。
VB.NET |
Dim ret As Integer Dim ctx As IntPtr ret = modbus_set_byte_timeout(ctx,1, 234000)
|
C, C++ |
int ret; modbus_t *ctx; ret = modbus_set_byte_timeout(ctx, 1, 234000);
|
C# |
int ret; IntPtr ctx; ret = modbus_set_byte_timeout(ctx, 1, 234000);
|
Python |
ret = ctypes.c_int ctx = ctypes.POINTER(modbus_t) ret = modbus.modbus_set_byte_timeout(ctx, 1, 234000) |