Jump to content

GXWorks2 and Structured Text FB Problems (Bugs?)


Recommended Posts

Posted
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
Posted
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.
Posted
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
Posted
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!
  • Like 1

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...