IB Statements/decihex
From CometWiki
DECIHEX function
Syntax: DECIHEX(numeric-argument)
Discussion: The DECIHEX function converts the numeric-argument (up to length.precision of 10.0) into a 4-byte Intel hex formatted string.
Note: Intel-based systems store numeric data in "Intel hex format." Windows passes data in this format to Comet and expects the same in return. This function, along with the IHEXDEC function, provide a streamlined way to convert formats.
For example, consider the numeric value 6636321. The DECIHEX function converts this value to the equivalent Intel format, which is "@21436500@".
Example:
Set TestHex$ = "@21436500@" ! 0x00654321 Set TestDec = 6636321 ! Length 4 & Local Hex$ Length 10.0 & Local Dec ! Print (Cs);(Et) ! Hex$ = TestHex$ Dec = IHexDec(Hex$) If (Dec EQ TestDec) Print "IHexDec succeeded" Else Print "IHexDec failed" EndIf ! Hex$ = DecIHex(Dec) If (Hex$ EQ TestHex$) Print "DecIHex succeeded" Else Print "DecIHex failed" EndIf ! Wait Stop