Syntax:
stringvar = SingleToHex(number)
Command Availability:
Available on all microcontrollers.
Explanation:
The SingleToHex function converts a Single (floating-point) number into hexadecimal format, representing its raw 4-byte in-memory encoding
rather than a decimal-to-hex conversion of its numeric value. The input number should be a Single variable. After running the function, the string variable stringvar contains an 8-digit hexadecimal number (4 bytes, since a Single occupies 32 bits).
Example:
'Set chip model
#chip 16F1936
'Set up hardware serial connection
#define USART_BAUD_RATE 9600
#define USART_TX_BLOCKING
Dim CurrSingle As Single
CurrSingle = 3.14159
HSerPrint SingleToHex(CurrSingle) ' <<< the SingleToHex instruction
HSerPrintCRLFKey line: SingleToHex(CurrSingle) — returns the 8-digit hex representation of the 4 raw bytes that make up the Single value, useful for inspecting or transmitting a floating-point value byte-for-byte.
See Also:

