CODESYS - the IEC 61131-3 automation software

Welcome to the official CODESYS Forum
Deutsche Version English version russian version 
It is currently Fri May 25, 2018 9:36 pm

All times are UTC+01:00




Post new topic  Reply to topic  [ 8 posts ] 
Author Message
PostPosted: Wed Mar 14, 2018 2:41 pm 
Offline

Joined: Thu Jul 09, 2015 9:55 pm
Posts: 20
Hello

I got two function blocks programmed in SFC where one extends the other.

How can I call SUPER^(); without placing it in every action-step?


Top
   
PostPosted: Wed Mar 14, 2018 5:18 pm 
Offline

Joined: Fri May 19, 2017 8:06 am
Posts: 4
Hello,

I have FB_A and FB_B, and FB_B extends FB_A.

I call FB_B countinuosly from one task, but inside FB_B I have to write on his body super^() to get the base functionality of FB_A running.

Then When I call the FB_B methods from some point of the program, all the code is able to work.

Question is, maybe there is another way to achieve this without access the super pointer.

Someone know another way ?

Thanks.


Top
   
PostPosted: Thu Mar 15, 2018 2:30 pm 
Offline

Joined: Mon Oct 01, 2012 8:33 am
Posts: 30
Quote:
I have to write on his body super^() to get the base functionality of FB_A running.

Put the desired functionality into a FB_A method, which is inherited by FB_B. Then simply call the method, from FB_B. No need for ^super.


Top
   
PostPosted: Thu Mar 15, 2018 2:54 pm 
Offline

Joined: Fri May 19, 2017 8:06 am
Posts: 4
Yes, but what if the funtionality needs more than one scan cycle ? most of the time you need call another FBs and need several cycles.

My point is, seems that, on the contrary of OOP standar languages, in Codesys you have to call explicitly super function to execute the base code.


Top
   
PostPosted: Thu Mar 15, 2018 9:59 pm 
Offline
Frequent User
Frequent User

Joined: Wed May 04, 2016 6:00 pm
Posts: 227
Hi. Somlioy.

Create in extended fb an action where you will implements the sfc.

From the main program you can call the action with the grafcet, super, and any other action you want run parallel to sfc.

Be healty!


Top
   
PostPosted: Thu Mar 15, 2018 11:46 pm 
Offline

Joined: Thu Jul 09, 2015 9:55 pm
Posts: 20
I'm not quite sure I understand what you mean.

To clarify I have two fbs; FB_A and FB_B, both programmed with SFC where FB_B extends FB_A,
and I need to have FB_A running cyclically.

Do you mean I should create an action in FB_A with SUPER^() as content, and run that action in main program?


Top
   
PostPosted: Fri Mar 16, 2018 7:22 am 
Offline
Frequent User
Frequent User

Joined: Wed May 04, 2016 6:00 pm
Posts: 227
Hi.

Not.

Fb extends from Fa. And Fb will be programed in st.

Create in Fb an action to be programed in sfc mode.

From the main of fb call super^() and call his sfcAction...


Top
   
PostPosted: Fri Mar 16, 2018 4:32 pm 
Offline

Joined: Thu Jul 09, 2015 9:55 pm
Posts: 20
Oh I see.
Thought it didnt work with SFC in actions but turned out that's only the case if the fb is programmed in sfc.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 8 posts ] 

All times are UTC+01:00


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Limited