Sign in to follow this  
Followers 0
Civet

Moving and comparing against string literals (iQ-R)

3 posts in this topic

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,

 

Share this post


Link to post
Share on other sites

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
1 person likes this

Share this post


Link to post
Share on other sites

Perfect. Thank you very much.

1 person likes this

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0