$Unbin

From m204wiki
Revision as of 15:49, 18 July 2013 by Dme (talk | contribs)
Jump to navigation Jump to search

The $UNBIN function converts a value from its fixed-point binary form to the corresponding character string representation. The $UNBIN function reverses the effect of the $BINARY function.

Most $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $UnBin function is the BinaryToInteger function.

Syntax

The format of the $UNBIN function is:

$UNBIN(value [,scale] )

where:

  • value is a string argument. This argument must be either two or four bytes long; its value is interpreted as a bit string. If the length of the argument is not two or four bytes, Model 204 issues a counting error message and returns a null string.
  • scale indicates the number of fractional digits (bits) in the specified value. If the scale argument is omitted, a default value of 0 (integer) is used.

For $UNBIN the useful range for scale seems to be about 0-38 or 0-42, depending on the value of the first parameter.