AH500 Programming Manual API 2112 Symbol: S : String Word n : Number of characters which are retrieved Word D : Device in which the characters retrieved are stored Word Explanation: 1. The instruction is used to retrieve n characters in the string in S from the left, and the characters which are retrieved are stored in D . 2. If n is 0, the value in D is 0. b15 b0 b7 b8 b15 b0 b7 b8 S +1 S D +1 D ..................... ~ ~ ~ ........... If the data in S is ABCDEF12345 and n is 7, seven characters in the string in S are retrieved from the left. The conversion result is as follows. S b15 b0 b7 b8 b15 b0 b7 b8 D ABCDEF12345 +1 S +2 S +2 D +1 D +3 S +3 D +4 S +5 S Example:
When M0 is ON, the instruction $LEFT is executed. The six characters starting from the character in D100 are retrieved, and stored in D10~D12. 6-478 Instruction code Operand Function $LEFT P S, n, D The retrieve of the characters in the string begins from the left.
Device X Y M S T C HC D L SM SR E PR K 16# “$” DF S n D Pulse instruction 16-bit instruction (7-13 steps) 32-bit instruction AH500 AH500 - Second ASCII code First ASCII code Fourth ASCII code Third A SCII code Second ASCII code First ASCII code Fourth ASCII code Third A SCII code n-1 th A SCII code from the last n-2 th A SCII code from the last n+1 th AS CII code from the last n th ASCII code from the last n-1 th A SCII code from the last n-2 th A SCII code from the last 16#00 n th ASCII code from the last 16#00 Last A SCII code 16#42(B) 16#41(A) 16#42(B) 16#41(A) 16#44(D) 16#43(C) 16#46(F) 16#45(E) 16#00 16#31(1) Seventh character 16#42(B) 16#41(A) 16#44(D) 16#43(C) 16#44(D) 16#43(C) 16#46(F) 16#45(E) 16#46(F) 16#45(E) 16#32(2) 16#31(1) 16#00 16#31(1) 16#34(4) 16#33(3) 16#00 16#35(5)