Civet Posted July 4, 2024 Report Posted July 4, 2024 Hello, How do I move a string literal (e.g. 'stop') into an array of unsigned (or signed) words on an iQ-R PLC? The manual refers to the instruction $MOV, but it doesn't seem to exist for the iQ-R. I've tried the STRINGMOV (e.g., STRINGMOV(TRUE, 'stop', unsignedWordArray[0])), but I get an "Unable to convert type 'ANYSTRING_SINGLE' to type 'WORD' error. I would expect the following values after the operation: unsignedWordArray[0] = H7473 (0x73 = ASCII code for 's', 0x74 = ASCII code for 't') unsignedWordArray[1] = H706F (0x6F = ASCII code for 'o', 0x70 = ASCII code for 'p') unsignedWordArray[2] = H0000 (null characters) I tried searching the forum, but I get an error when I try to search. Thanks, Quote
tosza93 Posted July 4, 2024 Report Posted July 4, 2024 (edited) Hi, There are multiple solutions depends on you use local or global label. If you use global label, you can assign your string and your unsignedWordArray to the same device area. In my example to D1000. Its a useful trick that mitsu allows. If you use local label than you can use the BMOV instruction, which transfers n points of 16 bit data from the starting adress of the device connected to s, to the area starting with the device connected to d. With this solution you can handle it easily. Edited July 4, 2024 by tosza93 1 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.