IO_Rack Posted August 10, 2016 Report Posted August 10, 2016 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.
Crossbow Posted August 11, 2016 Report Posted August 11, 2016 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?
IO_Rack Posted August 11, 2016 Author Report Posted August 11, 2016 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. 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. This will work for me. Am I missing an easier method?
BITS N BYTES Posted August 11, 2016 Report Posted August 11, 2016 Use a FOR NEXT loop routine in structured text. You can mix both ladder and structured text in the same POU in Sysmac Studio.
IO_Rack Posted August 12, 2016 Author Report Posted August 12, 2016 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?
BITS N BYTES Posted August 12, 2016 Report Posted August 12, 2016 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.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now