ngch
深圳工控小匠
級別: 網(wǎng)絡(luò)英雄
|
圖片:
請教! omron串行通信接收數(shù)據(jù)如何轉(zhuǎn)換成浮點數(shù) ASCII碼:302E+3344=D300+D301=0.34 程序如何進行換算得到0.34 |
|
---|---|---|
|
hlq_0815
人生的成功不在于拿到一副好牌,而是怎樣將壞牌打好。
級別: 論壇版主
|
FVAL(449) |
|
---|---|---|
|
ngch
深圳工控小匠
級別: 網(wǎng)絡(luò)英雄
|
我這樣寫過了,但是還是不行啊! |
|
---|---|---|
|
hlq_0815
人生的成功不在于拿到一副好牌,而是怎樣將壞牌打好。
級別: 論壇版主
|
30 = 0 2E = . 33 = 3 34 = 4 (44=D,你看看你的數(shù)字有沒有錯誤) |
|
---|---|---|
|
jx_einstein
級別: 論壇先鋒
|
寫個塊: 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; |
---|---|
|
ngch
深圳工控小匠
級別: 網(wǎng)絡(luò)英雄
|
THANKS! |
|
---|---|---|
|