Jump to content

Recommended Posts

Posted

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,

 


Posted (edited)

Hi,

 

There are multiple solutions depends on you use local or global label.

  1. 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.
  2. 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.

Global_Lable.thumb.png.da0d066278bad6e5aSample_Program.thumb.png.1eca992d95ad6ae

 

 

 

 

 

Edited by tosza93
  • Like 1

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...