4758866
級別: 略有小成
|
sngX1 := UINT_TO_REAL (uintX1); sngX2 := UINT_TO_REAL (uintX2); sngY1 := UINT_TO_REAL (uintY1); sngY2 := UINT_TO_REAL (uintY2); sngX := UINT_TO_REAL (uintX)*EXPT (10.0, uintDecPtDiff); IF sngX <= sngX1 THEN uintY := REAL_TO_UINT (sngY1); ELSIF sngX >= sngX2 THEN uintY := REAL_TO_UINT (sngY2); ELSE uintY := REAL_TO_UINT (sngY1+(sngY2-sngY1)/(sngX2-sngX1)*(sngX-sngX1)); END_IF; |
---|---|
|
apei2014
工控的世界,我不懂
級別: 論壇先鋒
|
我沒用過歐姆龍的,不過這個看起來也不難理解吧。 sngX1 := UINT_TO_REAL (uintX1);這個是數據類型轉換,整型轉換成浮點型, IF sngX <= sngX1 THEN uintY := REAL_TO_UINT (sngY1); ELSIF sngX >= sngX2 THEN uintY := REAL_TO_UINT (sngY2); 比較,轉換,賦值。 ELSE uintY := REAL_TO_UINT (sngY1+(sngY2-sngY1)/(sngX2-sngX1)*(sngX-sngX1)); END_IF; 計算,賦值。 |
|
---|---|---|
|