This is to write a command to a floboss computer, because the floboss reads in another way than deltaV, (Most and least words)
In reply to lsocorro:
In reply to Andre Dicaire:
Since this helped me figure out how to write the code I figured I would share it here to make it easier on some one else. The code is not bullet proof but it will get you on the right path. REM Figure out what the sign bit is. SGN is Boolean type parameter. '^/SGN.CV' := ('^/FLOAT.CV' < 0)?1:0; REM Figure out the exponent part. EXPONENT is signed 8 bit integer parameter. '^/EXPONENT.CV' := -127; WHILE ((2 ** '^/EXPONENT.CV') > '^/FLOAT.CV' OR (2 ** ('^/EXPONENT.CV' + 1)) < '^/FLOAT.CV') AND '^/EXPONENT.CV' < 128 DO '^/EXPONENT.CV' := '^/EXPONENT.CV' + 1; END_WHILE; REM Figure out mantissa. MANTISSA is 32 bit unsigned integer. '^/MANTISSA.CV' := (('^/FLOAT.CV' - (2 ** '^/EXPONENT.CV')) / (2 ** '^/EXPONENT.CV')) * 8388608; REM Put bits in their correct spots for two integers. '^/MSW_OUT.CV' := SHL((SHL('^/SGN.CV', 9) | '^/EXPONENT.CV' + 127 ), 7) | SHR('^/MANTISSA.CV',16); '^/LSW_OUT.CV' := '^/MANTISSA.CV' & 65535;
In reply to Virginijus Vaiciulis:
Andre Dicaire