用FX2nPLC控制三相六拍步进电机的实例,我用指令表写出,不习惯指令表的朋友可用FXGP翻成梯形图。
输入端为X0 X1 X2 X3
输出端为Y0驱动A相功放电路
Y1驱动B相功放电路
Y2驱动C相功放电路
LD XI
AND T246
AND DECO(p) D1 M10 K3 指定脉冲列输出顺序
AND INC (p) D1 移位值
LD M16
RST D1 复位
LD M11
ANI X0 当X0为OFF,电动机正转
LD M14
AND X0 当X0为ON,电动机反转
ORB
OR M10
OR M15
OUT Y0
LD M11
ANI X0
LD M14
AND X0
ORB
OR M12
OR M13
OUT Y1
LD M13
OR M14
OR M15
ANI X0
LD M10
AND X0
ORB
OR M11
OR M12
OUT Y2
LD M8000 脉冲频率初值
MOV K500 D0
LD T246 脉冲列形成
RST T246
LD X1
OUT T246 D0
LD X2 减速调整
AND M8012
ANI M4
INC(p) D0
LD X3 加速调整
AND M8012
ANI M4
DEC(p) D0
LD X2 频率调整限制
OR X3
ANI T0
OUT T0 K480
LD TO
SET M4
LD(p) X3
OR(p) X4
RST M4
END