寫個塊:
IF S_INT1<58 AND S_INT1>47 THEN
S_INT1R:= INT_TO_REAL(S_INT1)-48.0;
ELSE
;
END_IF;
IF S_INT1=46 THEN
ZeroPoint:=1;
ELSE
;
END_IF;
IF S_INT2<58 AND S_INT2>47 THEN
S_INT2R:= INT_TO_REAL(S_INT2)-48.0;
ELSIF S_INT2=46 THEN
ZeroPoint:=2;
ELSE
;
END_IF;
IF S_INT3<58 AND S_INT3>47 THEN
S_INT3R:= INT_TO_REAL(S_INT3)-48.0;
ELSIF S_INT3=46 THEN
ZeroPoint:=3;
ELSE
;
END_IF;
IF S_INT4<58 AND S_INT4>47 THEN
S_INT4R:= INT_TO_REAL(S_INT4)-48.0;
ELSIF S_INT4=46 THEN
ZeroPoint:=4;
ELSE
ZeroPoint:=14;
END_IF;
IF S_INT5<58 AND S_INT5>47 THEN
S_INT5R:= INT_TO_REAL(S_INT5)-48.0;
ELSIF S_INT5=46 THEN
ZeroPoint:=5;
ELSE
;
END_IF;
IF S_INT6<58 AND S_INT6>47 THEN
S_INT6R:= INT_TO_REAL(S_INT6)-48.0;
ELSIF S_INT6=46 THEN
ZeroPoint:=6;
ELSE
;
END_IF;
CASE ZeroPoint OF
1:
Value:=(S_INT2R*0.1+S_INT3R*0.01+S_INT4R*0.001+S_INT5R*0.0001+S_INT6R*0.00001)*1000.0;
2:
Value:=(S_INT1R*1.0+S_INT3R*0.1+S_INT4R*0.01+S_INT5R*0.001+S_INT6R*0.0001)*1000.0;
3:
Value:=(S_INT1R*10.0+S_INT2R+S_INT4R*0.1+S_INT5R*0.01+S_INT6R*0.001)*1000.0;
4:
Value:=(S_INT1R*100.0+S_INT2R*10.0+S_INT3R+S_INT5R*0.1+S_INT6R*0.01)*1000.0;
5:
Value:=(S_INT1R*1000.0+S_INT2R*100.0+S_INT3R*10.0+S_INT4R+S_INT6R*0.1)*1000.0;
6:
Value:=(S_INT1R*10000.0+S_INT2R*1000.0+S_INT3R*100.0+S_INT4R*10.0+S_INT5R)*1000.0;
ELSE
;
END_CASE;