Author |
Message |
twdi
|
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
|
|
Top |
|
 |
scott_cunningham
|
PostPosted: Mon May 28, 2018 4:49 am |
|
Offline |
Frequent User |
 |
Joined: Fri Sep 02, 2011 8:02 pm Posts: 309
|
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:
VAR MyBool : BOOL := True; MyCount : UINT := 27; END_VAR
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. www.kebblog.comwww.kebamerica.com
|
|
Top |
|
 |