jesawyers63
Hello All,

I have a project that has multiple POU's written only as FBD. 

Is there a way to set what POU is executed first?  I am writing software for a Automation Direct P1AM-100 and wish to run a POU that initializes the hardware using the P1AM_INIT FB before proceeding?

Also, is there a way to enable/disable cyclic tasks?

Thanks,
John
Reply 0 0
thiagoralves
In essence, the order of execution should follow the order of programs in your program tree on the left panel. There is no concurrency. Programs are executed one by one in order, assuming they all have the same time cycle. But you can enforce that by using the EN pin of blocks. Just create a global BOOL variable that will be used to trigger your EN. Once the P1AM is configured, you set this var to TRUE and then all blocks that depend on it will be executed.
Reply 1 0
jesawyers63
@thiagoralves Thanks for the feedback.

Another question...It appears that there is no way to move, thus change execution order, of FBD in the project tree.  I could just put a prefix on each POU like 01_ or 02_ to change the order of execution.

Can the ability to drag and drop POU's in the project tree be added?

Thanks...John
Reply 0 0
jesawyers63
@thiagoralves  Just tried to use the prefix method and 01_INIT is not a valid identifier.  Disappointing to say the least.
Reply 0 0
kinsa
Have you tried playing with the Execution Order or the Execution Control properties?

order.png
Reply 0 0
jesawyers63
Hi @kinsa

I am aware of the Execution Order and Execution Control properties.

However, what I'm trying to set is the execution order of the programs in the program tree.
Reply 0 0
kinsa
@jesawyers63, I will try to clarify .

There are two possible scenarios:

Case 1 Multiple Function Blocks
case1.png

Case 2 Multiple Programs
case2.png

For Case 1 the order of execution is defined by the Execution Order, where 0 is the highest.
If the blocks have the same order, then the sequence will be at random.
Note that if the POU is not used/referenced in any program, it will not be executed.

case1-s.png

For Case 2 the order of execution is defined under the Config -> Instances window. The order can be rearranged using the arrow icons.


case2-s.png

If you want a non-cyclical task, you can try the Interrupt Triggering. The task is executed when the trigger variable is True.
(Although on the current implementation, the trigger condition is evaluated at every cycle - it is not a true interrupt).


trig1.png



Reply 2 0
jesawyers63
@kinsa...Thank you for the clarification!!  It helped out a lot.  I was trying to make it too complicated.
Reply 0 0
Reply