IO_Rack

NJ Tag Substitution

6 posts in this topic

Is it possible to substitute a portion of a tag (with a variable) to be used for indexing? For example:

AnyBus_Input_USINT_1 of type USINT. I have 128 of these tags total. I need to convert them to a Byte Array and the only way I've been able to do this is to convert each one individually. Indexing them would seem to be a more concise method and lend itself to less typos if it were possible. 

I'm using an AnyBus Communicator for Serial to EtherCAT communications. I've tried using a STRUCT and a UNION in the I/O Map but they apparently are not allowed.

Share this post


Link to post
Share on other sites

Correct on the I/O map.  Nothing with a period in it is allowed.  Not sure why.

There is no way to index a tag name, why can you not just create an array?

Share this post


Link to post
Share on other sites

11 hours ago, Crossbow said:

Correct on the I/O map.  Nothing with a period in it is allowed.  Not sure why.

Apparently no variable modifiers are allowed.

SMS_Array_Prohibition.thumb.jpg.aafd99fb

11 hours ago, Crossbow said:

There is no way to index a tag name, why can you not just create an array?

This is what I did but I find it a bit cumbersome. For this project I'll only be using 40 or 50 Bytes but if I were to need hundreds then this would be a huge list of mistakes waiting to happen.

SMS_ByteArray.thumb.jpg.f4a6a14650148146

This will work for me. Am I missing an easier method?

Share this post


Link to post
Share on other sites

Use a FOR NEXT loop routine in structured text.

You can mix both ladder and structured text in the same POU in Sysmac Studio.

Share this post


Link to post
Share on other sites
21 hours ago, BITS N BYTES said:

Use a FOR NEXT loop routine in structured text.

Are you saying you can index a non array variable in ST?

Share this post


Link to post
Share on other sites
2 hours ago, IO_Rack said:

Are you saying you can index a non array variable in ST?

OOPS! Sorry for confusion.

My error, failed to see the problem of creating an array that references the PDO mapping variables.

This may be possible but I don't know how.

 

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