HEX$ (n) HEX$ (n, d) {* Applicable only to F-series & M+ PLC models} |
Purpose | To return a string that represents the hexadecimal value of
the integer argument n. If the second format is used then this function will return a
string of d number of characters. Note that if n is a float, this function
will convert n into an integer by truncating the float number to only its whole number
portion. HEX$ will then return the hexadecimal representation of the converted integer. If you want to obtain a hexadecimal string that shows the IEEE integer that represent the floating point number, then you must use the float2bits() function to convert the floating point number into its IEEE representation before applying HEX$ function |
Examples | A$ = HEX$(1234) B$ = HEX$(1234,7) C$ = HEX$(float2bits(A#),4) ' C$ will contain IEEE representation of the float number A#. |
Comments: | A$ will contain the string : "4D2" , B$ will contain the string "00004D2". |
See Also | HEXVAL( ), STR$( ), VAL( ) |