12 String

Last modified by Stone Wu on 2023/08/24 14:37

LEN/string length detection

LEN(P)

After detecting the length of the character string specified in (s), store it after the device number specified in (d).

The data from the device number designated in (s) to the device number of 00H is treated as a character string.

-[LEN (s) (d)]

Content, range and data type

ParameterContentRangeData typeData type (label)
(s)String or start number of the device storing the string-StringANYSTRING_SINGLE
(d)Store the device number of the detected character string length-Signed BIN 16 bitANY16

Device used

InstructionParameterDevices

Offset

modification

Pulse

extension

KnXKnYKnMKnSTCDRSD[D]XXP
LENParameter 1
Parameter 2 

Features

After detecting the length of the character string specified in (s), store it after the device number specified in (d).

The data from the device number specified in (s) to the stored device number of 00H is treated as a character string.

12_html_ed8cc486d8b12803.png

Error code

Error codeContent
4085H(s) The read address exceeds the device range
408AH(s) The length of the read string exceeds, and the continuous length of the string exceeds 400 characters
408BH(s) When reading a character string, the maximum range of the device is read, but 00H is not found and the end
4086H(d) When using offset, the offset address exceeds the device range

Example

12_html_bcef3cb437d484ef.png

For example, the above Circuit program

Use the asc instruction to write the string abcdef to the address starting from R0.

Then use the LEN instruction to determine the length. At this time, D0 will display 6.

LEFT/Extract from the left side of the string

LEFT(P)

For the character string data stored after the device number specified in (s), the data of (N) characters starting from the left side of the character string (the beginning of the character string) is stored in the device specified in (d) After numbering.

-[LEFT (s) (d) (N)]

Content, range and data type

ParameterContentRangeData typeData type (label)
(s)String or start number of the device storing the string-StringANYSTRING_SINGLE
(d)The start number of the device that stores the (N) character string from the left of (s)-StringANYSTRING_SINGLE
(N)Number of characters extracted1 to 400Signed BIN 16 bitANY16

Device used

InstructionParameterDevices

Offset

modification

Pulse

extension

KnXKnYKnMKnSTCDRSDKH[D]XXP
LEFTParameter 1  
Parameter 2   
Parameter 3 

Features

For the character string data stored after the device number specified in (s), the data of (N) characters starting from the left side of the character string (the beginning of the character string) is stored in the device specified in (d) After numbering.

12_html_dff27d9f4aac5f04.png

The character string specified in (s) is the data from the specified device to the position where "00H" is first detected in byte units.

(N)=7:

12_html_3ce6e66cbc96474a.png

The final NULL code (00H) representing the character string will be automatically appended to the end of the character string data.

If the number of extracted characters is an odd number, "00H" is stored in the upper byte of the device storing the final character. If the number of extracted characters is an even number, "0000H" is stored in the device after the device storing the final character.

When the number of characters specified in (N) is 0, the NULL code (00H) is stored in (d).

Note:

When handling character codes other than ASCII codes, pay attention to the following points.

✎The number of characters is handled in byte units (8 bits). Therefore, like the shifted JIS code, the character code of 1 character is represented by 2 bytes, and the number of characters of 1 character is "2".

✎When extracting a character string from a character string containing a character code representing one character in 2 bytes, such as the shift JIS code, the number of characters to be extracted should be considered in the unit of the character code of one character. If only 1 byte of the 2-byte character code is extracted, it will not be the expected character code, so be careful.

Error code

Error codeContent
4085H(s) The read address exceeds the device range
408AH(s) The length of the read string exceeds, and the continuous length of the string exceeds 400 characters
408BH(s) When reading a character string, the maximum range of the device is read, but 00H is not found and the end
4084H(N)<1 or (N)> string length
4086H(d) The write address exceeds the device range

Example

12_html_962780efc149e8d7.png

From the "a b c d e f" starting from D0, take out 5 characters from the left to the R0 type. The character string of R0 is "a b c d e".

12_html_fdba3f85ad8d63a.png

RIGHT/Extract from the right side of the string

RIGHT(P)

For the string data stored after the device number specified in (s), the data of (N) characters starting from the right side of the string (the end of the string) is stored in the device number specified in (d) after.

-[RIGHT (s) (d) (N)]

Content, range and data type

ParameterContentRangeData typeData type (label)
(s)String or start number of the device storing the string-StringANYSTRING_SINGLE
(d)The start number of the device that stores the (N) character string from the right of (s)-StringANYSTRING_SINGLE
(N)Number of characters extracted1 to 400Signed BIN 16 bitANY16

Device used

InstructionParameterDevice

Offset

modification

Pulse

expansion

KnXKnYKnMKnSTCDRSDKH[D]XXP
RIGHTParameter 1    
Parameter 2     
Parameter 3   

Features

For the string data stored after the device number specified in (s), the data of (N) characters starting from the right side of the string (the end of the string) is stored in the device number specified in (d) after.

12_html_9d5972269e607737.png

The character string specified in (s) is the data from the specified device to the position where "00H" is first detected in byte units.

(N)=5:

12_html_f4911228f8c2dbe9.png

The final NULL code (00H) representing the character string will be automatically appended to the end of the character string data.

If the number of extracted characters is an odd number, "00H" is stored in the upper byte of the device storing the final character. If the number of extracted characters is an even number, "0000H" is stored in the device after the device storing the final character.

When the number of characters specified in (N) is 0, the NULL code (00H) is stored in (d).

Note:

When handling character codes other than ASCII codes, pay attention to the following points.

✎The number of characters is handled in byte units (8 bits). Therefore, like the shifted JIS code, the character code of 1 character is represented by 2 bytes, and the number of characters of 1 character is "2".

✎When extracting a character string from a character string containing a character code representing one character in 2 bytes, such as the shift JIS code, the number of characters to be extracted should be considered in the unit of the character code of one character. If only 1 byte of the 2-byte character code is extracted, it will not be the expected character code, so be careful.

Error code

Error codeContent
4085H(s), (N) The read address exceeds the device range
408AH(s) The length of the read string exceeds, and the continuous length of the string exceeds 400 characters
408BH(s) When reading a character string, the maximum range of the device is read, but 00H is not found and the end
4084H(N)<1 or (N)> string length
4086H(d) The write address exceeds the device range

Example

12_html_ac9143331fbe5c33.png

Get 3 characters “890” from the right in the string "1234567890" and store them in R0

12_html_41ec2f74c80685b8.png

Any extraction from MIDR/string

MIDR(P)

Store the data at any position in the character string data after the device number specified in (d).

-[MIDR (s1) (d) (s2)]

Content, range and data type

ParameterContentRangeData typeData type (label)
(s1)String or start number of the device storing the string-StringANYSTRING_SINGLE
(d)Start number of the device storing the character string data of the operation result-StringANYSTRING_SINGLE
(s2)

The start number of the device that stores the start character position and the number of characters

(s2)+0: the position of the starting character, (s2)+1: the number of characters is signed

-Signed BIN 16 bitANY16_ARRAY

Device used

InstructionParameterDevices

Offset

modification

Pulse

extension

KnXKnYKnMKnSTCDRSD[D]XXP
MIDRParameter 1
Parameter 2 
Parameter 3

Features

For the character string data stored after the device number specified in (s1), the data of the character specified in (s2)+1 starting from the specified position in (s2) is stored to the device number specified in (d) and later .

12_html_f20321bfd116b1a8.png

  1. : The position of the 5th character (S2).
  2. : ASCII code (S2)+1 of the 5th character.

The character string specified in (s1) is the data from the specified device to the position where "00H" is first detected in byte units.

The final NULL code (00H) representing the character string will be automatically appended to the end of the character string data.

If the number of extracted characters "(s2)+1" is an odd number, "00H" is stored in the upper byte of the device storing the final character. If the number of extracted characters "(s2)+1" is an even number, "0000H" is stored in the device after the device storing the final character.

(s2) If the number of characters specified in +1 is 0, no processing is performed.

When the number of characters specified in (s2)+1 is -1, the data up to the final character data specified in (s1) is stored in the device specified in (d) and later.

12_html_d1975a12aac01998.png

(1): The position of the 5th character (S2).

✎Note:

When handling character codes other than ASCII codes, pay attention to the following points.

✎The number of characters is handled in byte units (8 bits). Therefore, like the shifted JIS code, the character code of 1 character is represented by 2 bytes, and the number of characters of 1 character is "2".

✎When extracting a character string from a character string containing a character code representing one character in 2 bytes, such as the shift JIS code, the number of characters to be extracted should be considered in the unit of the character code of one character. If only 1 byte of the 2-byte character code is extracted, it will not be the expected character code, so be careful.

Error code

Error codeContent
4085H(s1), (s2) The read address exceeds the device range
408AH(s1) The length of the read string exceeds, and the continuous length of the string exceeds 400 characters
408BH(s1) When reading a character string, the maximum range of the device is read, but 00H is not found.
4084H

(s2) When the value of +1 is -2 (including -2) or less.

When the value of (s2) exceeds the number of characters in (s1).

When the value of (s2) is negative.

When the value of (s2)+1 exceeds the number of characters of (s1).

When the value of (s2) and (s2) + 1 after the addition operation exceeds the number of characters of (s1).

4086H(d) The write address exceeds the device range

Example

12_html_f08fb20d06bbf205.png

Get three characters "234" from the second character of the string "123456" into R0.

12_html_9c0e1c89a16023f8.png

$MOV/ string transfer

$MOV(P)

Transfer the character string data specified in (s) to the device number specified in (d) and later.

-[$MOV (s) (d)]

Content, range and data type

ParameterContentRangeData typeData type (label)
(s)Transmission string (maximum 255 characters) or the start number of the device storing the string-StringANYSTRING_SINGLE
(d)The start number of the device storing the transferred character string-StringANYSTRING_SINGLE

Device used

InstructionParameterDevice

Offset

modification

Pulse

expansion

KnXKnYKnMKnSTCDRSD[D]XXP
$MOVParameter 1
Parameter 2 

Features

Transfer the character string data specified in (s) to the device number specified in (d) and later. In the transmission of a character string, the character string enclosed by the "" (double quotation marks) specified in (s) or the character string starting from the device number to the device number storing 00H is transmitted once.

12_html_a7032fc187916cbb.png

Even if the device range (s) to (s)+n storing the transferred character string data overlaps with the device range (d) to (d)+n storing the transferred character string data, it will be normal To process. For example, when the character string stored in D10 to D13 is transferred to D11 to D14, the situation is as follows.

12_html_1e6ba98418b9bddd.png

(1): It directly becomes the character string before transmission.

When 00H is stored in the low byte of (s)+n, both the high byte and low byte of (d)+n will store 00H.

12_html_16e7ec8cd76e305d.png

(1): The upper byte cannot be transmitted.

(2): It directly becomes the character string before transmission.

(3): The upper byte automatically stores 00H.

Error code

Error codeContent
4085H(s) The read address exceeds the device range
408AH(s) The length of the read string exceeds, and the continuous length of the string exceeds 400 characters
408BH(s) When reading a character string, the maximum range of the device is read, but 00H is not found and the end
4086H(d) The write address exceeds the device range

Example

12_html_e5c7ac173fafd437.png

Copy the string "a b c d e" in D0 to R0.

12_html_d4f5be5a8a3b4c6c.png

Arbitrary replacement in MIDW/string

MIDW(P)

For the string data stored after the device number specified in (s1), the data of the character specified in (s2)+1 is stored in the string data stored after the device number specified in (d) After the position specified in (s2).

-[MIDW (s1) (d) (s2)]

Content, range and data type

ParameterContentRangeData typeData type (label)
(s1)String or start number of the device storing the string-StringANYSTRING_SINGLE
(d)Start number of the device storing the character string data of the operation result-StringANYSTRING_SINGLE
(s2)

The start number of the device that stores the start character position and the number of characters

(s2)+0: the position of the starting character, (s2)+1: the number of characters is signed

-Signed BIN 16 bitANY16_ARRAY

Device used

InstructionParametersDevice

Offset

modification

Pulse

extension

KnXKnYKnMKnSTCDRSD[D]XXP
MIDWParameter 1
Parameter 2 
Parameter 3

Features

For the string data stored after the device number specified in (s1), the data of the character specified in (s2)+1 is stored in the string data stored after the device number specified in (d) After the position specified in (s2).

12_html_eaf06779c7008d8d.png

  • The character string specified in (s1) or (d) is the data from the specified device to the position where "00H" is first detected in byte units.
  • The final NULL code (00H) representing the character string will be automatically appended to the end of the character string data.
  • If the number of characters specified in (s2)+1 is 0, no processing is performed.
  • If the number of characters specified in (s2)+1 exceeds the last character of the character string data specified in (d), the data up to the last character of (d) is stored.

12_html_22b26f8331ae8bf1.png

When the number of characters specified in (s2)+1 is -1, the data up to the final character data specified in (s1) is stored in the device specified in (d) and later.

12_html_93e0c05274baf0f8.png

✎Note:

  • When handling character codes other than ASCII codes, pay attention to the following points.
  • The number of characters is handled in byte units (8 bits). Therefore, like the shifted JIS code, the character code of 1 character is represented by 2 bytes, and the number of characters of 1 character is "2".
  • When extracting a character string from a character string containing a character code representing one character in 2 bytes, such as the shift JIS code, the number of characters to be extracted should be considered in the unit of the character code of one character. If only 1 byte of the 2-byte character code is extracted, it will not be the expected character code, so be careful.

Error code

Error codeContent
4085H(s1) (s2) (d) The read address exceeds the device range
408AH(s1) (d) The length of the read string exceeds, and the continuous length of the string exceeds 400 characters
408BH(s1) (d) When reading a character string, the maximum range of the device is read, but 00H is not found.
4084H

(s2) When the value of +1 is -2 (including -2) or less.

When the value of (s2) exceeds the number of characters in (d).

When the value of (s2) is negative.

When the value of (s2)+1 exceeds the number of characters of (s1).

4086H(d) The write address exceeds the device range

Example

12_html_3ddcabdcaf657946.png

Replace the three-character-length characters starting with the second character in the character string "q w e r y" stored in R0 with the first three characters in D20.

The result of R0 is "q123y".

12_html_336d7baf1ba02b9e.png

STR/BIN 16-bit data → character string conversion

STR(P)

The BIN 16-bit data specified in (s2) is converted into a character string after a decimal point is added to the position specified in (s1), and stored in the device number specified in (d) or later.

-[STR (s1) (s2) (d)]

Content, range and data type

ParameterContentRangeData typeData type (label)
(s1)The start number of the device that stores the number of digits of the converted value-Signed BIN 16 bitANY16_S_ARRAY
(s2)Converted BIN data-32768 to +32767Signed BIN 16 bitANY16_S
(d)Start number of the device storing the converted character string-StringANYSTRING_SINGLE

Device used

InstructionParametersDevice

Offset

modification

Pulse

extension

KnXKnYKnMKnSTCDRSDKH[D]XXP
STRParameter 1  
Parameter 2
Parameter 3      

Features

The BIN 16-bit data specified in (s2) is converted into a character string after a decimal point is added to the position specified in (s1), and stored in the device number specified in (d) or later.

12_html_ab97c25bb7ec51e8.png

All digits that can be specified in (s1) are 2 to 8 digits.

The number of decimal places that can be specified in (s1)+1 is 0 to 5 digits. However, the setting should satisfy the condition that the number of decimal places ≤ (all digits-3).

The converted character string data will be stored in the device numbers after (d) as follows.

• In the sign, BIN 16-bit data will store 20H (blank) when it is positive, and 2DH (—) when it is negative.

• When the number of decimal places is set to other than 0, 2EH(.) is automatically stored in the specified digit + 1 digit. When the decimal place is 0, 2EH(.) is not stored.

12_html_ac029ec797f87912.png

(1): Number of decimal places

(2): Automatically attach

If the value of the decimal place is greater than the number of digits of the BIN 16-bit data, 0 is automatically appended and converted to "0.***" right-aligned.

12_html_ab5fdaf7985c6b0f.png

(1): Automatically attach

In the value of all digits, excluding the sign, and if the number of digits after the decimal point is greater than the number of BIN 16-bit data, 20H (blank) is stored between the sign and the value. If the digit of BIN 16-bit data is larger, it will be in error status.

12_html_11ebc511ddf34975.png

(1): Change to 20H (SP).

00H is automatically stored at the end of the converted character string.

• When the total digits are even digits, "0000H" is stored in the device after the device storing the final character. In the case of an odd number of digits, "00H" is stored in the upper byte (8 bits) of the device storing the final character.

Error code

Error codeContent
4085H(s1), (s2) The read address exceeds the device range
4084H

(s1) or (s1+1) parameter setting value is out of range. E.g:

1. The value of (s1) is not in the range of 2-8

2. The value of (s1+1) is not in the range of 0-5

3. The value of (s1+1) is greater than the value of (s1) minus 3

4. When (s1+1) is 0, the number of digits specified in (s1) is less than the number of BIN 16-bit data specified in (s2)+1.

When (s1+1) is not 0, the number of digits specified in (s1) is less than the number of BIN 16-bit data specified in (s2) + 2.

(The number of digits of (s1) <the number of BIN 16-bit data that does not contain a sign of (s2) + the number of signs (+ or -) + the number of decimal points (.))

4086H(d) When using offset, the offset address exceeds the device range

Example

12_html_247596356e588e50.png

After M8 is turned ON, according to the setting of all digits, 6 decimal places and 0 digits, it is converted into a character string "12345" (with a space before 1)

.

12_html_d9023eb3c8ddb67d.png

DSTR/BIN 32-bit data → string conversion

DSTR(P)

The BIN 32-bit data specified in (s2) is converted into a character string after a decimal point is added to the position specified in (s1), and stored in the device number specified in (d) or later.

-[DSTR (s1) (s2) (d)]

Content, range and data type

ParameterContentRangeData typeData type (label)
(s1)The start number of the device that stores the number of digits of the converted value-Signed BIN 16 bitANY16_S_ARRAY
(s2)Converted BIN data-2147483648 to 2147483647Signed BIN 32 bitANY32_S
(d)Start number of the device storing the converted character string-StringANYSTRING_SINGLE

Device used

InstructionParametersDevice

Offset

modification

Pulse

extension

KnXKnYKnMKnSTCDRSDLCHSCKH[D]XXP
DSTRParameter 1    
Parameter 2
Parameter 3        

Features

The BIN 32-bit data specified in (s2) is converted into a character string after a decimal point is added to the position specified in (s1), and stored in the device number specified in (d) or later. -654.321 is specified in S2.

12_html_3cca0f6ef2d0c3d9.png

All digits that can be specified in (s1) are 2 to 13 digits.

The number of decimal places that can be specified in (s1)+1 is 0 to 10 digits. However, the setting should satisfy the condition that the number of decimal places ≤ (all digits-3).

The converted character string data will be stored in the device numbers after (d) as follows.

• In the sign, when the BIN 32-bit data is positive, 20H (blank) is stored, and when it is negative, 2DH (—) is stored.

• When the number of decimal places is set to other than 0, 2EH(.) is automatically stored in the specified digit + 1 digit. When the decimal place is 0, 2EH(.) is not stored.

12_html_3f7d9df483d77cb7.png

  1. : Number of decimal places
  2. : Automatically attach

• If the value of the decimal place is greater than the number of digits in the BIN 32-bit data, 0 is automatically added and converted to "0.***" right-justified.

12_html_cd46d5b63b1ebedd.png

(1): Automatically attach

• If the sign is excluded from the value of all digits, and the number of digits after the decimal point is greater than the number of BIN 32-bit data, 20H (blank) is stored between the sign and the value. If the digit of BIN 16-bit data is larger, it will be in error status.

12_html_a998daadb6fd7e64.png

(1): Change to 20H (SP)

• 00H is automatically stored at the end of the converted character string.

• When the total digits are even digits, "0000H" is stored in the device after the device storing the final character. In the case of an odd number of digits, "00H" is stored in the upper byte (8 bits) of the device storing the final character.

Error code

Error codeContent
4085H(s1), (s2) The read address exceeds the device range
4084H

(s1) or (s1+1) parameter setting value is out of range. E.g:

1. The value of (s1) is not in the range of 2 to 13.

2. The value of (s1+1) is not in the range of 0 to 10.

3. The value of (s1+1) is greater than the value of (S1) minus 3.

4. When (s1+1) is 0, the number of digits specified in (s1) is less than the number of BIN 16-bit data specified in (s2)+1.

When (s1+1) is not 0, the number of digits specified in (s1) is less than the number of BIN 16-bit data specified in (s2) + 2.

(The number of digits of (s1) <the number of BIN 16-bit data that does not contain a sign of (s2) + the number of signs (+ or -) + the number of decimal points (.))

4086H(d) When using offset, the offset address exceeds the device range.

xample

12_html_5b0a20751a964e17.png

As shown in the example

We need to convert 123456 into a floating point string with 9 lengths after the decimal point and 3 lengths,

The result of the conversion should be 123.456. The previous value will have two spaces to supplement the insufficient number.

12_html_430d3795add9e0b4.png

$+/ Combination of strings

$+(P)

Connect the string data stored after the device number specified in (s2) to the string data stored after the device number specified in (s1), and store it after the device number specified in (d).

-[$+ (s1) (s2) (d)]

Content, range and data type

ParameterContentRangeData typeData type (label)
(s1)Connection data or the start number of the device storing the data or a directly specified character string-StringANYSTRING_SINGLE
(s2)The connected data or the start number of the device storing the connected data or the directly specified character string-StringANYSTRING_SINGLE
(d)Start number of the device storing the connection result-StringANYSTRING_SINGLE

Device used

InstructionParametersDevice

Offset

modification

Pulse

extension

KnXKnYKnMKnSTCDRSD[D]XXP
$+Parameter 1
Parameter 2
Parameter 3 

Features

Connect the string data stored after the device number specified in (s2) to the string data stored after the device number specified in (s1), and store it after the device number specified in (d).

The character strings of (s1) and (s2) start with the specified device number until the device number of 00H is stored.

12_html_f7a3e0a5d0287093.png

When merging character strings, 00H indicating the end of the character string specified in (s1) is ignored, and the character string specified in (s2) is connected at the final character of (s1).

If the character string is merged, 00H will be automatically appended at the end. If the number of characters after connection is an odd number, 00H is stored in the upper byte of the device that stores the final character, and if the number of characters after connection is an even number, the device after the device that stores the final character is stored 0000H will be stored.

Error code

Error codeContent
4085H(s1) or (s2) read address out of device range
408AH(s1) or (s2) The length of the read string exceeds, and the continuous length of the string exceeds 400 characters
408BH(s1) or (s2) When reading a character string, the maximum range of the device is read, but 00H is not found.
4086H(d) The write address exceeds the device range

Example

12_html_ef811f595067af30.png

The result of combining the string "12345" and the string "abcde" is "12345abcde"

12_html_870490af1bec3c8c.png

INSTR/string search

INSTR(P)

Starting from the left (s3) character of the string data stored after the device number specified in (s2), search for the string data stored after the device number specified in (s1), and store the search result in In the device specified in (d).

-[ INSTR (s1) (s2) (d) (s3)]

Content, range and data type

ParameterContentRangeData typeData type (label)
(s1)Search string or the start number of the device storing the search string-StringANYSTRING_SINGLE
(s2)The searched character string or the start number of the device storing the searched character string-StringANYSTRING_SINGLE
(d)Start number of the device storing the search result-Signed BIN 16 bitANY16
(s3)Search start position1 to 400Signed BIN 16 bitANY16

Device used

InstructionParametersDevice

Offset

modification

Pulse

extension

KnXKnYKnMKnSTCDRSDKH[D]XXP
INSTRParameter 1      
Parameter 2      
Parameter 3  
Parameter 4

Features

Starting from the left (s3) character of the string data stored after the device number specified in (s2), search for the string data stored after the device number specified in (s1), and store the search result in In the device specified in (d). The search result will store the first character from the start character of the string data specified in (s2).

12_html_fb3930cfe47ce231.png

(1): Search start position (S3): 3rd character

(2): The fifth character from the start character

  • If there is no matching character string data, 0 is stored in (d).
  • If the search start position (s3) is "0", no processing is performed.
  • The searched character string (s1) can be directly specified.

12_html_f423f049e854194f.png

(1): Search start position (s3): 3rd character

(2): The fifth character from the start character

Error code

Error codeContent
4085H(s1), (s2), (s3) The read address exceeds the device range
408AH(s1), (s2) The length of the read string exceeds, and the continuous length of the string exceeds 400 characters
408BH(s1), (s2) When reading a character string, the maximum range of the device is read, but 00H is not found.
4086H(d) The write address exceeds the device range
4084H(s3) <0 or (s3)>=string length

Example

12_html_bd3a37e71062cac5.png

Search for the string "ef" in the continuous string "abcdefg" from the first to the fifth position.

ASC/ASCII data input

ASC

A command to convert a character string of half-width/English numbers into ASCII code.

Used to select and display multiple messages on the external display.

-[ASC (s) (d)]

Content, range and data type

ParameterContentRangeData typeData type (label)
(s)32-character half-width English numbers input from the computer-String (ASCI code only)ANY_ASC
(d)Start word device number for storing ASCII data-BIN16 bitANY16_S

Device used

InstructionParametersDevice

Offset modification

Pulse extension

TCDRSD[D]XXP
ASCParameter 1       
Parameter 2 

Features

1. 16-bit arithmetic (ASC)

After converting the half-width, English, and numeric character strings specified in (S) into ASCII codes, they are transferred to (D) in sequence.

• Process A to Z, 0 to 9, and half-width characters of Signs in (S). (Full-width character strings are not processed.)When programming with a programming tool, enter a character string.

• The converted ASCII code is stored in (D) every 2 characters/1 word in the order of low 8 bits and high 8 bits.

Extensions

After SM161 is turned ON, the extended function becomes effective. At this time, the half-width/alphanumeric character string specified in S is converted into ASCII code, and then it is transmitted to the lower 8 bits (1 byte) of D in sequence.

Note:

(1) Number of occupied points of the device

1) When the extended function is OFF

- D occupies the number of characters ÷ 2 points (if not evenly divisible, the decimal point is rounded up.)

2) When the extended function is ON

-The number of points occupied by D is the same as the number occupied by characters.

(2) When using etc.

The extended function flag SM161 is a flag bit common to other instructions.

When using the above instructions and ASC instructions, please note that the SM161 ON or OFF program is written before the ASC instruction so as not to affect it.

Error code

Error codeContent
4085HThe output result of reading application instruction(s) exceeds the device range
4086H(D) The output result exceeds the device range in writing application instructions

Example

1. Procedure

12_html_e275c447761351e0.png

When X20 = ON, the assignment of D200 to D203:

12_html_4d73a151fc88e54a.png

If the special register SM161 is set to ON, each ASCII character occupies a 16-bit variable after conversion, as shown in the figure below, the high byte of each variable is filled with 0 (hexadecimal):

 DS
High 8 bitsLow 8 bitsString
12_html_2ef48fa39ec10c22.png0041A
12_html_2ef48fa39ec10c22.png +10042B
12_html_2ef48fa39ec10c22.png +20043C
12_html_2ef48fa39ec10c22.png +30044D
12_html_2ef48fa39ec10c22.png +40045E
12_html_2ef48fa39ec10c22.png +50046F
12_html_2ef48fa39ec10c22.png +60047G
12_html_2ef48fa39ec10c22.png +70048H