lekraut

Label Help

3 posts in this topic

I am using GX Works2 and I cannot use the format "Label.1" to access the first bit in the word represented by label. Is this a function that just does not work or is it abnormal. Is there a way to do this easily. I am using structured ladder.

Also is there a way to use the K*, notation with an array of bools represented by a label. I saw elsewhere the syntax K8<Label>, but that will not compile for me. 

 

Share this post


Link to post
Share on other sites

You are correct - you can't do either of these. Take a look at the options below

  1. When using ".x" addressing you need to use the device actual address, but what I normally do is to define the label in the Global Label list, using e.g. D0.1 = "Variable123". In other words, just define the variable in the label editor together with the correct address.
  2. Not possible since it interprets "K4" as both part of the name and as addressing syntax. That's why you wont get the option to define the name, but at the same time it won't compile due to an error label... As above you can solve it by defining an array of bits (e.g. M0 = BitVariable123 = Array32) and use the instruction "BITARR_TO_DINT" to do a move into a double word.

Why Mitsu has chosen to do this is for me unknown, but it's the way it is.

Share this post


Link to post
Share on other sites

Thanks. Those suggestions are spot on, and are what I have ended up doing. 

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