SingleToBin

Syntax:

    stringvar = SingleToBin(Singlevar)

Command Availability:

Available on all microcontrollers.

Explanation:

The SingleToBin function creates a string of ANSI characters representing a Single’s binary value. It converts a number into a 32-character string consisting of ones and zeros.

Note: Supports Single variables only. For Byte variables use ByteToBin, for Word variables use WordToBin, and for Integer variables use IntegerToBin.

Example:

    string = SingleToBin( 1 )   ' Returns "00000000000000000000000000000001"          ' <<< the SingleToBin instruction

    string = SingleToBin( 254 ) ' Returns "00000000000000000000000011111110"

Key line: SingleToBin( 1 ) — returns a fixed 32-character binary string, since a Single occupies 4 bytes (32 bits) of storage.

See Also: