CODESYS - the IEC 61131-3 automation software

Welcome to the official CODESYS Forum
Deutsche Version English version russian version 
It is currently Wed Oct 18, 2017 8:41 am

All times are UTC+01:00




Post new topic  Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Fri May 20, 2016 11:28 am 
Offline

Joined: Mon Sep 28, 2009 1:25 pm
Posts: 17
I have a program written as a SFC but I now need to implement several instances of the program so I thought it best to have the code as a function block. Is there a way to convert the program into a function block or would I need to start again?

Thanks,

Tony


Top
   
PostPosted: Sat May 21, 2016 1:19 am 
Offline
Frequent User
Frequent User

Joined: Fri Sep 02, 2011 8:02 pm
Posts: 255
Open the object. Change the word PROGRAM to FUNCTION_BLOCK above where your variables are defined. Close the object. It should switch to an FB. I use v3.x now and this is how it is done in 3.x, but if I remember correctly, it was the same on v2.3.

_________________
Scott Cunningham
KEB America, Inc.
www.kebblog.com
www.kebamerica.com


Top
   
PostPosted: Sat May 21, 2016 12:07 pm 
Offline

Joined: Mon Sep 28, 2009 1:25 pm
Posts: 17
Thanks very much for your reply, I will try this.


Top
   
PostPosted: Mon May 30, 2016 6:07 pm 
Offline
Frequent User
Frequent User

Joined: Thu Jun 14, 2007 9:49 am
Posts: 978
not correct , as a program has no I/O defined.
however it is possible to do:

copy the program and give it other name (something like FB_SFC_blabla)
change indeed the name program to Function_block
now define what variables are used as Input
and as Output and which ones are global and local etc.
within the program no changes are needed.
check the real I/O Tags as you will mess it up when using double.

It is normal for a beginner to do it this way.
I only use Function blocks and my main program just calls blocks. so my main program is max one page, same for a sub btw make them max one page so you can overview what happens.

_________________
shooter@home.nl
computer shooter
paul deelen
jacob van wassenaerstraat 29
NL 5224 GG 's-Hertogenbosch
skype shooter paul.deelen
phone +31736139136


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

All times are UTC+01:00


Who is online

Users browsing this forum: No registered users and 2 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