NJ501/Sysmac, ARRAY[] of BYTES cannot be converted to BYTE[]

3 posts in this topic

This one has me stumped...   in Sysmac Studio, with an NJ501-1300, I have defined the following variables:
msgStr: STRING[256]
msgByte: ARRAY[0..99] of BYTE

(Don't worry about the different array lengths, that isn't germane to this question)

I'm attempting to use the contents of the string (msgStr) as a string of bytes that are input to sktTCPSend, as you can see in the rung screenshot.  This is to convert from a STRING[] type to a BYTE[] type, which is one of the things the docs say the StringToAry command can do.  Problem is, I'm getting the errors shown in the build output screenshot at build time, suggesting this conversion can't be accomplished.  I've spent the better part of today poring through Omron docs, and I'm not finding anything about this.

Any ideas?

Thanks!  --Alerrors.JPG.c54d8b573fd0ac361c482d33910f7



Edited by BassGroovin

Share this post

Link to post
Share on other sites

I think you need to point the StringToAry & SktTCPSend functions/function blocks to the first index of the array you want to use, instead of the whole array.

Try changing 'msgByte' to 'msgByte[0]'




1 person likes this

Share this post

Link to post
Share on other sites

Doh! Of course, thanks... not sure how I missed that one...  😕

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