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
Originally created by: scott_cunningham
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...
Log in to post a comment.