Search the Community
Showing results for tags 'eint'.
-
EInt2Float Subroutine in Scripted Text on a Horner Series PLC. (******************************************************************) (* EInt2Float *) (* Convert Emotron EInt values to standard floating point. *) (******************************************************************) If And_Mask(EIntIn,16#8000) = 0 then EReal := ANY_TO_REAL(And_Mask(EIntIn,16#7FFF)); Return; End_If; (* Get Mantissa and convert to real *) TempWord := And_Mask(EIntIn,16#3FF); TempInt := ANY_TO_INT(TempWord); If And_Mask(EintIn,16#0400) = 16#0400 then TempInt := TempInt-16#0400; End_If; EReal1 := ANY_TO_REAL(TempInt); (* Get Exponent and convert to real *) TempWord := And_Mask(EIntIn,16#3800); TempInt := (ANY_TO_INT(TempWord))/2048; If And_Mask(EIntIn,16#4000)=16#4000 then TempInt := TempInt - 8; End_If; TempReal := ANY_TO_REAL(TempInt); (* Combine Mantisa and Exponent and output. *) EReal := EReal1 * EXPT(10, TempReal ); Typical Subroutine Call. DispCurrent := eint2floatST(FDU2Curr);