Syntax:
stringvar = SingleToHex(number)
Command Availability:
Available on all microcontrollers
Explanation:
The Hex
function will convert a Single number into hexadecimal format. The input number
should be a Single variable, or a fixed number between -3.4x10 ^ 38 and +3.4x10 ^ 38 inclusive. After running the function,
the string variable stringvar
will contain an 4 digit hexadecimal number.
Example:
'Set chip model #chip 16F1936 'Set up hardware serial connection #define USART_BAUD_RATE 9600 #define USART_TX_BLOCKING 'Send EEPROM data over serial connection 'Uses Hex to display as hexadecimal For CurrentLocation = 0 to 9999999 'Send location HSerPrint SingleToHex(CurrentLocation) HSerPrint ":" 'Read Single and send EPRead CurrentLocation, CurrSingle HSerPrint Hex(CurrSingle) 'Send carriage return/line feed HSerPrintCRLF Next
See Also ByteToHex,WordToHex, LongToHex, IntegerToHex