各位大侠帮帮忙,解释一下这个功能块的作用,最好是一行一行的解释。正在学习中,实在不知道怎么办了。。
FUNCTION_BLOCK FB_Incremental_Homing
VAR_INPUT
i_toAxis : PosAxis;
i_sCMD : StructAxisOpe;
i_sPara : StructAxisPara;
END_VAR
VAR
l_i16CaseCount : INT := 0;
_MccRetDINT : DINT;
RT_increment_home_rtrig : R_TRIG;
END_VAR
RT_increment_home_rtrig(clk := i_sCMD.boAxisIncreHoming);
CASE l_i16CaseCount OF
0:
l_i16CaseCount := 1;
1:
IF i_toAxis.control = Active AND
i_toAxis.actormonitoring.drivestate = Active AND
i_toAxis.actormonitoring.Power = Active THEN
l_i16CaseCount := 10;
END_IF;
10:
IF (RT_increment_home_rtrig.q) THEN
l_i16CaseCount := 11;
END_IF;
11:
_MccRetDINT := _homing(axis := i_toAxis,
homingMode := ACTIVE_HOMING,
homePositionType := DIRECT,
homePosition := i_sPara.r64IncZeroOffset,
velocityType := DIRECT,
velocity := i_sPara.r64IncHomingVelocity,
velocityProfile := TRAPEZOIDAL,
mergeMode := IMMEDIATELY,
nextCommand := WHEN_BUFFER_READY,
commandId := _getCommandId());
l_i16CaseCount := 12;
12:
IF i_toAxis.motionstatedata.stillstandvelocity = active THEN
l_i16CaseCount := 16;
END_IF;
16:
l_i16CaseCount := 17;
17:
l_i16CaseCount := 0;
END_CASE;
END_FUNCTION_BLOCK
问题补充:
我知道这是类似于pascal的一种语言,整个架构我懂得,只是不明白这个功能。字面上解释是定义一个功能块,叫点动回原点。
产品版区:S110
悬赏西币:20 | 解决时间:2015-05-28 09:23:59 | 提问者: 影子梅 - 学长  第2级
最佳答案
RT_increment_home_rtrig(clk := i_sCMD.boAxisIncreHoming); 上升沿由 i_sCMD.boAxisIncreHoming触发, RT_increment_home_rtrig.q只会在一个扫描周期为1
CASE l_i16CaseCount OF :case语句,
0:
l_i16CaseCount := 1; :如果 l_i16CaseCount =0,执行
l_i16CaseCount =1
1: :如果l_i16CaseCount =1执行下面的语句
IF i_toAxis.control = Active AND :IF判断语句
i_toAxis.actormonitoring.drivestate = Active AND
i_toAxis.actormonitoring.Power = Active THEN
l_i16CaseCount := 10; :满足上面三个条件时 l_i16CaseCount := 10
END_IF;
10: :如果l_i16CaseCount =10执行下面的语句
IF (RT_increment_home_rtrig.q) THEN :前面定义了这个上升沿的动作
l_i16CaseCount := 11; 执行 l_i16CaseCount := 11
END_IF;
11: 等于11时开始执行回原点,这是一个系统的功能块,直接调用
_MccRetDINT := _homing(axis := i_toAxis,
homingMode := ACTIVE_HOMING,
homePositionType := DIRECT,
homePosition := i_sPara.r64IncZeroOffset,
velocityType := DIRECT,
velocity := i_sPara.r64IncHomingVelocity,
velocityProfile := TRAPEZOIDAL,
mergeMode := IMMEDIATELY,
nextCommand := WHEN_BUFFER_READY,
commandId := _getCommandId());
l_i16CaseCount := 12; 执行完,赋值 l_i16CaseCount := 12
12: 这是判断上面的动作是否完成
IF i_toAxis.motionstatedata.stillstandvelocity = active THEN
l_i16CaseCount := 16; 赋值16
END_IF;
16:
l_i16CaseCount := 17;
17:
l_i16CaseCount := 0; 全
回答者:
一直向前走
-
中级技术员  第6级
2015-05-27 15:22:05
提问者对于答案的评价:
非常感谢