功能
设置输出脉冲的宽度(占空比)。
格式
Ret = SmcWSetPulseDuty( Id , AxisNo , DutyType )
参数
Id [ C, C++: short ] [ Python: ctypes.c_short ]
指定由函数SmcWInit获取的硬件设备ID。
AxisNo [ C, C++: short ] [ Python: ctypes.c_short ]
指定轴号。
DutyType [ C, C++: short * ] [ Python: ctypes.POINTER(ctypes.c_short) ]
设置占空比。
|
0 |
脉冲宽度根据输出速度而变化 |
|
1 |
占空比固定为50% |
返回值
Ret [ C, C++: long ] [ Python: ctypes.c_long ]
|
0 |
正常完成 |
|
0以外 |
异常完成 |
参照:错误代码列表
初始值
DL系列 1 : 占空比固定为50%
DF系列 0 : 脉冲宽度根据输出速度而变化
说明
DutyType = 0时,输出速度小于2.4kpps时脉冲宽度固定为200μsec、大于2.4kpps占空比固定为50%。
对于DL系列,DutyType 固定为 1。
本函数不可在轴移动期间实行。
使用例
设置轴1的占空比。
占空比固定为50%
C, C++
long Ret;
short DutyType;
DutyType = 1;
Ret = SmcWSetPulseDuty( Id , 1, DutyType );
Python
Ret = ctypes.c_long()
DutyType = ctypes.c_short()
DutyType.value = 1
Ret.value = csmc.SmcWSetPulseDuty( Id , 1, DutyType )
相关函数