Summary
This function converts a hexadecimal string to binary data. Convert the hexadecimal integer text in Parameter 2 (Convert-From Data Buffer) into an integer, and store it in Parameter 1(Convert-To Address).
Format
_hexasc2bin (Conversion result address, Conversion
source buffer)
Parameter 1: Internal Device, Temporary address
Parameter 2: Data Buffer
Example expression 1 (When the bit length is 16 bits)
_hexasc2bin ([w:[#INTERNAL]LS0100], databuf0)
The content of "databuf0" is as follows:
The above data are converted as follows:
Example expression 2 (When the bit length is 32 bits)
_hexasc2bin ([w:[#INTERNAL]LS0100], databuf0)
The content of "databuf0" is as follows:
The above data are converted as follows:
An error occurs
when the converted string is greater than 16 bits or 32 bits.
For example, when the bit length of the script is 16 bits:
_strset (databuf0,
"123456")
_hexasc2bin ([w:[#INTERNAL]LS0100], databuf0)
When the above expression is executed, Error Number 2 (string conversion error) of the String error status [e: STR_ERR_STAT] is generated.
An error occurs
during conversion of a string of data containing characters other
than "0" to "9", "A" to "F",
or "a" to "f".
For example, when the bit length of the script is 16 bits:
_strset (databuf0,
"123G")
_hexasc2bin ([w:[#INTERNAL]LS0100], databuf0)
When the above expression is executed, Error Number 2 (string conversion error) of the String error status [e: STR_ERR_STAT] is generated.
The processing is terminated when an error occurs and returns to the beginning of the Main function. (If the command comes while a function is running, it returns to the line that called that function.)