功能
读取报警代码。
格式
Ret = SmcWGetAlarmCode( Id , AxisNo , AlarmCode )
参数
Id [ C, C++: short ] [ Python: ctypes.c_short ]
指定由函数SmcWInit获取的硬件设备ID。
AxisNo [ C, C++: short ] [ Python: ctypes.c_short ]
指定轴号。
AlarmCode [ C, C++: short * ] [ Python: ctypes.POINTER(ctypes.c_short) ]
指定保存报警代码的变量地址。
返回值
Ret [ C, C++: long ] [ Python: ctypes.c_long ]
|
0 |
正常结束 |
|
0以外 |
异常结束 |
参照:错误代码列表
说明
参数AlarmCode的值表示输入信号IN5~IN7的状态。
如果电机驱动器具有报警代码输出,请把相关信号和板卡的IN5~IN7连接。
使用本函数可读取报警代码。
关于报警代码的详细说明请参考各电机驱动器的说明书。
本函数可在轴移动期间实行。
使用例
读取轴1的报警代码。
C, C++
long Ret;
short AlarmCode ;
Ret = SmcWGetAlarmCode( Id , 1, &AlarmCode );
Python
Ret = ctypes.c_long()
AlarmCode = ctypes.c_short()
Ret.value = csmc.SmcWGetAlarmCode( Id , 1, ctypes.byref(AlarmCode) )