Mitsubishi GXWorks 3 Function Blocks

Qubit

Member
Join Date
Jul 2010
Location
Newark
Posts
9
Hi Folks
I have made a function block that has the EN input enabled. (FBD language)
In want to run some code at the top of the function block as soon as the EN input becomes active, and only this one time, until it becomes active again.
It must happen before the rest of the code in the block runs.
What I would really like to do is generate a pulse each time the EN input comes on which will enable my code, but I cannot get this to work.
Does anybody have any ideas how to do this?
Thanks for looking.
 
The EN is what allows the function block to run if it is tied to the left hand side without a contact or logic to control when it is called it will be called every scan
To only run it when you want it to you must have some logic that becomes true when you want it.
So if it is always enabled then any logic before the FB call will be processed.
If you want it to run only when the logic above runs then you need to either create a oneshot off the previous logic to enable the FB or use effectively the same logic to enable the FB.
Your explanation is not really clear but here is an explanation of oneshots or enables, this is in GXworks2 but similar note the logic before the call to the Motor FB in this case is just a simple bit logic. I have used the same variables on the rungs just to demonstrate the way a puls or on contact works in enabling a FB.
perhaps post a screenshot of the bits of code you mean remember a PLC scans the program top to bottom left to right so the code effectively runs in that order, the way you control when code runs is by putting it into a FB & calling that with some logic on the EN input, also the ENO is just a reflection of the state of the input in other words if the EN is true the ENO is true.

Enable.png
 
Last edited:
Hi Parky
Thanks for your detailed reply.
I think my original post was a little bit confusing as you said.
What I would really like to do is have some code run INSIDE the FB once it is enabled, but only on the first scan.
To be honest I don't think it is possible.
 
If I get what you want to do then I think it is possible.
but a bit more detail is required, for example assume the FB is called by some enable bit not true all the time but that bit may be on for more than one scan but you want some code inside the FB only to run once the first time the block is enabled then again when it is enabled again is this correct ?
Put it in short form
The condition to call the FB goes true, in the FB some code only runs for one scan but also runs the rest of the code, during subsequent scans the FB runs the other code but not the one that should only run for the one scan.
If this is correct I could post something I think may help, I believe there could be two ways of doing it.
 
I'm assuming if you have GXWorks3 then you have GXWorks2 bundled & the GX Simulator so try this code.
I have created a simple FB that is being called in a program block, when the enable to the function block goes true I'm using the EN bit s a oneshot (contact with up arrow to trigger some code to take the current plc clock seconds & move it to a register, the other bit of code runs all the time the FB is enabled.
Note I have added an input variable to the FB just for information you could use the same bit that enables the FB in the FB the same as the EN bit, just rforyour information when you enter a variable an select local variables you should notice that with the IN/Out type variables passed to the FB will also contain the EN & ENO bits
Just unzip the file & load it into GXW2 (note: the project is saved as a single file format not a project).
 
Just tried it on GXW3 & FX5U, it does appear that on the GXW3 you cannot use EN as the local variable it does not exist so see this code for a FX5
It is the same but the input variable is used within the FB to copy the seconds to a variable this would be your oneshot run oflogic.
Also it does appear that using the pulse contact does not work when using FX5
so in the program block call to the FB we have M0 as the EN to enable the FB
And the same M0 as a pulse as the input local var My_In
Not bothered adding the logic that will run while the FB is enabled as we know this will work

Seems to be a little bug as at first I tried linking EN to My_Var & use the pulse contact inside the FB but it did not work but it works on GXW2 using an FX or Q PLC
 
Hi every one, I have a seeku HMI plc compatable with mitsubishi, plc logic can bewritten in gx woks, but for hmi, need HMI studio software, please share a link if any member have this software.
thanks for helping
 
You can buy the GxWorks software from a Mitsubishi Electric distributors. In this forum people do not normally distribute pirated software.
 
Hi Parky.
That has worked perfectly.
To be honest I was nearly there. I had exactly the same set-up as you except I was trying to pulse the input on the inside of the block.
I never thought to try it on the outside!
My bad, but thanks for the help my code is a lot tidier now.
🍻
 
It does depend on what plc you are programming On an FX5 for example it uses GXW3 but on the FX3, Q series it loads a version of GXW2, the editors are quite different, on the FX5 (GXW3) if you connect the two input pins i.e EN & the input for the pulse the pulse is always on even if the contact for the enable is off not sure if this is a bug but it does let you draw pin to pin, on the GXW2 it works like you expect it to.
I must admit I prefer the IDE of GXW2 seems simpler to use, I like the function box selection just place your cursor on one of the visible functions & press a letter i.e. A, then it jumps to all functions with A, don't like the multiple grouping of the functions that open up.
 

Similar Topics

Hello Friends I am a rookie in mitsubishi. I have many conditions in my program, How can I add several lines to a rung? For example: How can I...
Replies
1
Views
1,520
I am trying to do a subroutine using a Q series (Q06UDEH) plc and GXWorks 2. The manual says to use a FEND and then start the subroutines. Each...
Replies
3
Views
4,002
Hello! If someone can help me with the following problem. I can't change the phone number. Do I really need the interface (AL-232CAB - Programming...
Replies
0
Views
45
how to communicate FactoryTalk Optix and Mitsubishi Q Series. I want to know the details of that
Replies
0
Views
39
Back
Top Bottom