innoaloe

Copy Structure Members to Array of Bytes

5 posts in this topic

Hello Everyone, haven't roamed here for a while.   So I'm having a little trouble using the Structure Data Type in Sysmac Studio/NJ. As an independent tool, it is powerful to create user data types, such as Ethernet/IP Tag Link to V680S RFID or any other EIP equipments. And it is way more powerful than the CJ2, since it has the ability for user defined offset, which CJ2 can't do.   But the problem is we cannot move/copy the content of the members to any other standard types. For example, I have a structure with 8 BYTE type members. Then I need to send those out via UDP or TCP/IP comms, which Function Block requires BYTE[] data type. Unfortunately data movement instructions such as MemCopy and AryMove didn't work at all to do the job. This was easily done in CJ2 since we can access each memory content directly. Currently I already resort to use customized Functions which will translates the Structure into BYTE[], but that would mean for every different protocols, I need to create a different Function.   I have seen this problem posted somewhere in the SS/NJ Improvement Request section, so I wonder has anyone know any update about this matter? Haven't checked the latest update yet (SS v1.14), but I'm certain that in SS v1.13 this feature is still unavailable.   Thanks!!!

Share this post


Link to post
Share on other sites
You can use the ToAryByte function.     Edited by Vahe

Share this post


Link to post
Share on other sites
Hi Vahe,   Wow, that one worked wonders! I thought that particular function is only for String input to array byte.. hahah Thank you very much!

Share this post


Link to post
Share on other sites

Does anyone know of comparable instructions to XFER and BSET in Sysmac Studio?

Share this post


Link to post
Share on other sites

Check the Data Movement Instructions.

There are multiple ways to do it depending on your requirement. TransBit, MemCopy, SetBlock etc..

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