Sign in to follow this  
Followers 0
KenE

GXWorks2 and Structured Text FB Problems (Bugs?)

4 posts in this topic

I've experienced some very strange behavior in Structured Text programs and was wondering if anyone else has seen similar? I'm using GX Works2 Version 1.64S. Here is the strange-ness: If I check [just] En/Eno in the function block properties some of my function blocks did not write back Data that was passed in as "Input/Output" type. In my example I was just assigning some values and making one simple calculation from within the ST function block. If I check off "En/Eno", MacroCode, and MCR checkboxes some function blocks work and others seem like they run code internally *EVEN WHEN NOT ENABLED*. So far it seems that checking MacroCode and En/Eno *ONLY* [i.e. all options except MCR] is the secret sauce to getting a function block that does what you think it would do. I don't think this problem is unique to GX Works 2 but is manifesting itself on a machine I'm working on that was created in GX IEC Developer 7 and had the "Compile as IEC Developer 6.0" option checked. Since GX Works doesn't have this option I think that this is what had caused my problems to emerge when using GX Works 2. I've asked one of our factory guys through email and I hope they will look into it, but I wanted to hear from other users here as well. Needless to say its dang scary when crap executes that is not supposed to. I'm not a newbie to ST or structured ladder, I've been using IEC developer for years. Ken

Share this post


Link to post
Share on other sites
The compiler tends to use SET/RST when controlling EN/ENO, so this may leave a function active which may not be desired. Compiler options can be adjusted in the Tool menu under Options. It's on Compile Condition 2 under Compile/Structured Ladder I found this when performing some comparison instructions. When the box is checked, it uses SET/RST to control the outputs, and the result of a compare was set, even after the compare instruction was no longer being activated. It was the same in the GX IEC Developer software, an option which can be adjusted by the user.

Share this post


Link to post
Share on other sites
I am aware of the Set/Res issue but that isn't what is causing the odd behavior. Why someone would want a function block ENO to be stuck on when EN is off is too bizarre to contemplate, but that is another matter. I can literally go in and uncheck "Macrocode" from the function block properties and the function bock no longer runs properly. Check it back on and everything is fine. I changed all our FBs to macrocode (without MCR) and they are now working fine. I could post an example project to the forum if there is a place to post files. This isn't the first time we've run into these kinds of problems, just that this was the first time I went to this extent to test all of the different options. Thanks, Ken

Share this post


Link to post
Share on other sites
Macrocode means that the FB will be inserted into the project at any given point and executed every instance of the FB. If you uncheck macrocode it will work in the same way as a subroutine, where you call the code from the given point in the program. Basically if the FB requires some sort of "memory" or will use more than one PLC cycle to complete (e.g. if you use a timer inside the FB) you MUST use macrocode. If you have a FB that will finish it's operation during the same scan you can uncheck macrocode. Unchecking macrocode is only useful if you have a lot of instances of the same FB (e.g. 10 or more) AND the DB will operate as described above. Basically; always use macrocode unless you have special requirements.... Post if I've explained myself "unclear".... And as a small note: The reason why EN/ENO is using SET/RST is a IEC standard issue. The reason why Mitsubishi changed this functionality in IEC (and of course in GX Works2) is because of the international IEC standard and not Mitsubishi, however I totally agree with you!
1 person likes this

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
Sign in to follow this  
Followers 0