只用来显示和位置赋值,四舍五入的话偏差会比较大 位置到达还是用指令的done标志
//将当前位置赋值给临时变量
temp:=in_当前位置;
//连乘小数位位数
for i:=1 to 保留小数点位数 by 1 do
temp:=temp*10.0;
end_for;
//先转换成整型除去剩余小数,再转换成浮点数
temp:=dint_to_real(real_to_dint(temp));
//连除获取保留设定小数点位数的浮点数
for i:=1 to 保留小数点位数 by 1 do
temp:=temp/10.0;
end_for;
out_当前位置:=temp;