Compatible with:
DOS Maximite CMM MM150 MM170
MM+ MMX Picromite ArmiteL4
Armite F4 ArmiteH7 Picomite CMM2
Syntax:
STR2BIN(type, string$ [,BIG])
BIN2STR$(type, value [,BIG])
Description:
STR2BIN(type, string$ [,BIG])
Returns a number equal to the binary representation in 'string$'. 'type' can be:
INT64 converts 8 byte string representing a signed 64-bit integer to
an integer
UINT64 converts 8 byte string representing an unsigned 64-bit integer to
an integer
INT32 converts 4 byte string representing a signed 32-bit integer to an
integer
UINT32 converts 4 byte string representing an unsigned 32-bit integer to
an integer
INT16 converts 2 byte string representing a signed 16-bit integer to an
integer
UINT16 converts 2 byte string representing an unsigned 16-bit integer to
an integer
INT8 converts 1 byte string representing a signed 8-bit integer to an
integer
UINT8 converts 1 byte string representing an unsigned 8-bit integer to an
integer
SINGLE converts 4 byte string representing single precision float to a
float
DOUBLE converts 8 byte string representing single precision float to a
float
By default the string must contain the number in little-endian format (ie,
the least significant byte is the first one in the string).
Setting the third parameter to 'BIG' will interpret the string in
big-endian format (ie, the most significant byte is the first one in the
string).
This function makes it easy to read data from binary data files, interpret
numbers from sensors or efficiently read binary data from flash memory
chips.
An error will be generated if the string is the incorrect length for the
conversion requested
BIN2STR$(type, value [,BIG])
Returns a string containing the binary representation of 'value'. 'type' can be:
INT64 signed 64-bit integer converted to an 8 byte string
UINT64 unsigned 64-bit integer converted to an 8 byte string
INT32 signed 32-bit integer converted to a 4 byte string
UINT32 unsigned 32-bit integer converted to a 4 byte string
INT16 signed 16-bit integer converted to a 2 byte string
UINT16 unsigned 16-bit integer converted to a 2 byte string
INT8 signed 8-bit integer converted to a 1 byte string
UINT8 unsigned 8-bit integer converted to a 1 byte string
SINGLE single precision floating point number converted to a 4 byte
string
DOUBLE double precision floating point number converted to a 8 byte
string
By default the string contains the number in little-endian format (ie, the
least significant byte is the first one in the string).
Setting the third parameter to 'BIG' will return the string in big-endian
format (ie, the most significant byte is the first one in the string)
In the case of the integer conversions, an error will be generated if the
'value' cannot fit into the 'type' (eg, an attempt to store the value 400 in a
INT8).
This function makes it easy to prepare data for efficient binary file I/O or for
preparing numbers for output to sensors and saving to flash memory.
Last edited: 29 September, 2020