CODESYS - the IEC 61131-3 automation software

Welcome to the official CODESYS Forum by 3S-Smart Software Solutions GmbH | A member of the CODESYS Group
Deutsche Version English version russian version 
It is currently Wed Feb 26, 2020 8:47 pm

All times are UTC+01:00

Post new topic  Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Thu May 24, 2018 7:25 am 

Joined: Wed May 23, 2018 12:56 pm
Posts: 1
I'm using Codesys to learn PLC programming and now I have to make an assigment in SFC.

First, I can't find an explanation about the different variable types. I see just VAR or VAR_INPUT etc.
What are the differences?

Second, can I use logic in transitions like "bStart AND (seDockingUp AND seLidlifterOutwards)"?

bStart is declared as VAR and seDockingUp and seLidlifterOutwards are declared as VAR_INPUT

if I run a program with this transition in simulation mode, the program does not continue when I make them all TRUE. I don't see why. My idea is to reset the bStart in the next step.

Where and how do I declare initial start values for specific booleans?

Thanks for you help

PostPosted: Mon May 28, 2018 4:49 am 
Frequent User
Frequent User

Joined: Fri Sep 02, 2011 8:02 pm
Posts: 312
The CoDeSys help should explain the variable types, but basically:

VAR_INPUT = input variable to a POU (outside passing into your program or function or function block). You should not modify a var input inside your POU, but you can, but the outside programs cannot see it. So treat it as a read only...

VAR_OUTPUT = output variable of a POU (your program passing out to an outside program or function or function block). Treat as a write always.

VAR = internal variables to your POU (outside POUs cannot or should not access these variables. FBs and Functions hide VAR types but PROGRAMS do not.

Declare initial values for variables like this:

MyBool : BOOL := True;
MyCount : UINT := 27;

You can declare like this for any var type (input, output..)

Regarding SFC transitions, you can use complicated Boolean expressions or I think even method calls that return a Boolean.

I don’t know why you have issues with the simulation mode. Just make sure your POU is actually called by a program or task that is running - it is a common error to have a POU. It not actually call it...

Scott Cunningham
KEB America, Inc.

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

All times are UTC+01:00

Who is online

Users browsing this forum: No registered users and 1 guest

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