Summary
This function is used to convert a decimal string to integers. Convert the decimal integer text in Parameter 2 (Convert-From Data Buffer) into an integer, and store it in Parameter 1 (Convert-to Address).
Format
_decasc2bin (Conversion result address, Conversion source buffer)
Parameter 1: Internal Device, Temporary address
Parameter 2: Data Buffer
Example expression 1 (When the data length is 16 bits)
_decasc2bin ([w:[#INTERNAL]LS0100], databuf0)
The content of "databuf0" is as follows:
The above data are converted as follows:
Example expression 2 (When the data length is 32 bits)
_decasc2bin ([w:[#INTERNAL]LS0100], databuf0)
The content of "databuf0" is as follows:
The above data are converted as follows:
An error occurs when the converted bit length is greater than the bit length of the D-Script Editor.
For example, When the bit length of the script is 16 bits:
_strset (databuf0, "123456") // When a 6-digit decimal string is set accidentally.
_decasc2bin ([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. However, the bit returns to the beginning of the Main function when an error occurs. Therefore, you cannot reference other functions directly after _decasc2bin executes. (If the command comes while a function is running, it returns to the line that called that function.)
An error occurs during conversion of string data containing characters other than "0" to "9".
For example, when the bit length of the script is 16 bits:
_strset (databuf0, "12AB") // When something other than a decimal string is set accidentally.
_decasc2bin ([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. However, the bit returns to the beginning of the Main function when an error occurs. Therefore, you cannot reference other functions directly after _decasc2bin executes. (If the command comes while a function is running, it returns to the line that called that function.)
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.)