1.前言
使用软PLC最好是多创建action,这样编程比较清晰,主程序里代码比较少,实现语言我推荐使用结构化文本(ST)。
2.常用功能块
①.power
VAR:
power1 : mc_power;
power_do : BOOL;
action:
power1(
Axis:=axis1 ,
Enable:=power_do ,
Enable_Positive:= ,
Enable_Negative:= ,
Override:= ,
BufferMode:= ,
Options:= ,
Status=> ,
Busy=> ,
Active=> ,
Error=> ,
ErrorID=> );
②.stop
VAR:
stop1 : MC_Stop;
stop_do : BOOL;
action:
stop1(
Axis:=axis1 ,
Execute:=stop_do ,
Deceleration:= ,
Jerk:= ,
Options:= ,
Done=> ,
Busy=> ,
Active=> ,
CommandAborted=> ,
Error=> ,
ErrorID=> );
③.reset
VAR:
reset1 :mc_reset;
reset_do: BOOL;
action:
reset1(
Axis:=axis1 ,
Execute:=reset_do ,
Done=> ,
Busy=> ,
Error=> ,
ErrorID=> );
④.jog
VAR:
jog1 : MC_Jog;
jog_forward,jog_backward : BOOL;
action:
jog1(
Axis:=axis1 ,
JogForward:=jog_forward ,
JogBackwards:=jog_backward ,
Mode:= ,
Position:= ,
Velocity:= ,
Acceleration:= ,
Deceleration:= ,
Jerk:= ,
Done=> ,
Busy=> ,
Active=> ,
CommandAborted=> ,
Error=> ,
ErrorID=> );
⑤.move_relative
VAR:
move_r1 : MC_MoveRelative;
mover_do : BOOL;
action:
move_r1(
Axis:=axis1 ,
Execute:=mover_do ,
Distance:=10000 ,
Velocity:=100 ,
Acceleration:= ,
Deceleration:= ,
Jerk:= ,
BufferMode:= ,
Options:= ,
Done=> ,
Busy=> ,
Active=> ,
CommandAborted=> ,
Error=> ,
ErrorID=> );
⑥.move_absolute
VAR:
move_a1: MC_MoveAbsolute;
movea_do;
action:
move_a1(
Axis:=axis1 ,
Execute:=movea_do ,
Position:=0 ,
Velocity:=100 ,
Acceleration:= ,
Deceleration:= ,
Jerk:= ,
BufferMode:= ,
Options:= ,
Done=> ,
Busy=> ,
Active=> ,
CommandAborted=> ,
Error=> ,
ErrorID=> );
⑦.
VAR:
camin : mc_camin;
camout : mc_camout;
camin_do: BOOL;
camin_out: BOOL;
action:
camin(
Master:=axis1 ,
Slave:=axis2 ,
Execute:=camin_do ,
MasterOffset:= ,
SlaveOffset:= ,
MasterScaling:= ,
SlaveScaling:= ,
StartMode:= ,
CamTableID:=1 ,
BufferMode:= ,
Options:= ,
InSync=> ,
Busy=> ,
Active=> ,
CommandAborted=> ,
Error=> ,
ErrorID=> );
camout(
Slave:=axis2,
Execute:=camout_do ,
Options:= ,
Done=> ,
Busy=> ,
Error=> ,
ErrorID=> );
⑧.gear
VAR:
gearin2 : MC_GearIn;
gearout2 : MC_GearOut;
greain_do: BOOL;
gearout_do: BOOL;
action:
gearin2(
Master:=axis1 ,
Slave:=axis2 ,
Execute:=greain_do ,
RatioNumerator:= 1,
RatioDenominator:= 1,
Acceleration:= ,
Deceleration:= ,
Jerk:= ,
BufferMode:= ,
Options:= ,
InGear=> ,
Busy=> ,
Active=> ,
CommandAborted=> ,
Error=> ,
ErrorID=> );
gearout2(
Slave:=axis2 ,
Execute:=gearout_do ,
Options:= ,
Done=> ,
Busy=> ,
Error=> ,
ErrorID=> );
⑨.setposition
VAR:
setpos1: mc_setposition;
set_do :BOOL;
action:
setpos1(
Axis:=axis1 ,
Execute:=set_do ,
Position:=0 ,
Mode:= ,
Options:= ,
Done=> ,
Busy=> ,
Error=> ,
ErrorID=> );
⑩.home
VAR:
home1 : mc_home;
home_do : BOOL;
sensor : BOOL;
action:
home(
Axis:=axis1 ,
Execute:=home_do ,
Position:= ,
HomingMode:= ,
BufferMode:= ,
Options:= ,
bCalibrationCam:=sensor ,
Done=> ,
Busy=> ,
Active=> ,
CommandAborted=> ,
Error=> ,
ErrorID=> );