Short curcuit if statement in st
CODESYS Forge
talk
(Thread)
Short curcuit if statement in st
Last updated: 2012-06-28
Assignment Efficiency - Repetitive Assignment vs IF statement
CODESYS Forge
talk
(Thread)
Assignment Efficiency - Repetitive Assignment vs IF statement
Last updated: 2025-03-08
Case statement
CODESYS Forge
talk
(Thread)
Case statement
Last updated: 2012-09-20
Codesys ST CASE statement
CODESYS Forge
talk
(Thread)
Codesys ST CASE statement
Last updated: 2022-07-19
how does the evaluation of the <condition> in an IF-statement work?
CODESYS Forge
talk
(Thread)
how does the evaluation of the <condition> in an IF-statement work?</condition>
Last updated: 2020-02-20
case statement in function
CODESYS Forge
talk
(Thread)
case statement in function
Last updated: 2012-10-02
From S.T CASE Statement to SFC
CODESYS Forge
talk
(Thread)
From S.T CASE Statement to SFC
Last updated: 2020-08-14
AT statement with Structured Data Types
CODESYS Forge
talk
(Thread)
AT statement with Structured Data Types
Last updated: 2010-07-10
UNION statement is not supported in the ethercat data exchange
CODESYS Forge
talk
(Thread)
UNION statement is not supported in the ethercat data exchange
Last updated: 2025-02-05
Trying to negate Boolean values inside of a case statement
CODESYS Forge
talk
(Thread)
Trying to negate Boolean values inside of a case statement
Last updated: 2021-10-29
Post by wayne-riesterer on Assignment Efficiency - Repetitive Assignment vs IF statement
CODESYS Forge
talk
(Post)
Hello Can anyone see any problems with constant assignment as in the following statement: Coils[0] := Coils[0] OR (Buttons[0] AND Sensors[0] > 6); Rather than using the more verbose and vertically-larger: IF NOT Coils[0] AND Buttons[0] AND (Sensors[0] > 6) THEN Coils[0] := TRUE; END_IF Also, is the test expression short-circuited in the latter case? In other words, will the runtime move on after it sees Coils[0] = FALSE AND? Thanks
Last updated: 2025-03-07
Post by pistola on Case Function - Multiple Conditions, Is it possible?
CODESYS Forge
talk
(Post)
Thanks for the information, I ended up just making a long if else statement as each variable had 3 possible options, I figured at least this way it would still work.
Last updated: 2024-11-05
Post by timvh on Assignment Efficiency - Repetitive Assignment vs IF statement
CODESYS Forge
talk
(Post)
You can consider using OR_ELSE: Coils[0] := Coils[0] OR_ELSE (Buttons[0] AND Sensors[0] > 6); https://content.helpme-codesys.com/en/CODESYS%20Development%20System/_cds_operator_or_else.html IF Coils[0] is TRUE, then the rest is not relevant anymore and doesn't have to be evaluated anymore. PS, there is also an AND_THEN https://content.helpme-codesys.com/en/CODESYS%20Development%20System/_cds_operator_and_then.html
Last updated: 2025-03-08
Post by wayne-riesterer on Assignment Efficiency - Repetitive Assignment vs IF statement
CODESYS Forge
talk
(Post)
Thanks for your responses. I like to write the leanest possible code that I can because it makes it much easier to read/maintain/debug. OR_ELSE is what I was looking for. I wasn't sure if CodeSys short-circuited evaluation and I didn't realize this operator existed. Thanks!
Last updated: 2025-03-08
How to know if output if function block is used
CODESYS Forge
talk
(Thread)
How to know if output if function block is used
Last updated: 2024-10-15
IF Anweisung in CFC
CODESYS Forge
talk
(Thread)
IF Anweisung in CFC
Last updated: 2006-07-12
IF not work
CODESYS Forge
talk
(Thread)
IF not work
Last updated: 2017-10-07
IF NOT AND question
CODESYS Forge
talk
(Thread)
IF NOT AND question
Last updated: 2018-11-26
Post by davidmic on What is this ST syntax?
CODESYS Forge
talk
(Post)
I found some structured text code which contained this statement: bHidden:= TRUE(*NOT _somevariable*) I haven't seen TRUE() used like a function before, and I also haven't seen the enclosing asterisks * * before. What do they do? (sorry if this is a duplicate question, I don't know what words to use to search for this syntax)
Last updated: 2024-10-11
Post by kumareasu on Start *.exe through PLC progem
CODESYS Forge
talk
(Post)
SysProcessExecuteCommand(pszComand:='start C:\Program Files\SharedMemory\SharedMemory.exe',pResult := ADR(Result)); the above statement hangs the PLC until I do cold reset
Last updated: 2024-04-17
Post by kumareasu on Start *.exe through PLC progem
CODESYS Forge
talk
(Post)
SysProcessExecuteCommand(pszComand:='start C:\Program Files\SharedMemory\SharedMemory.exe',pResult := ADR(Result)); the above statement hangs the PLC until I do cold reset
Last updated: 2024-04-17
Post by mubeta on UNION statement is not supported in the ethercat data exchange
CODESYS Forge
talk
(Post)
Hi all, I am using a unionn statement for merge in integer data type some values that are received in byte from the i/o cards, but, using this simple and light technique, is not recognized by the ethercat data exchange and in fact the tags are not updated. In my opinion it's a very big bug.
Last updated: 2025-02-05
Post by alexgooi on Is it possible in the log to see previous shutdown
CODESYS Forge
talk
(Post)
Hi DavidBo, In general Codesys is used to control equipment and an exception is the worst thing that can happen in your installation. If you cannot prevent the exception from triggering, you could implement a Try catch statement, with this solution your controller keeps on running and you are able to handle the exception. __TRY //This statement will trigger an exception Result := 4/0; __CATCH(exc) //Handle the exception HandleException(exc, strExceptionText => strExceptionText); // From the Codesys help file //Create a log file //-------------------------------------------------------- __ENDTRY What you also could do is implement implicit checks, these functions cover most of the exceptions (like dividing by zero) See picture But in general avoid a complete controller shutdown!
Last updated: 2024-02-09
EtherCAT_Master error if integrated into project
CODESYS Forge
talk
(Thread)
EtherCAT_Master error if integrated into project
Last updated: 2017-08-28
Execution of IF THEN
CODESYS Forge
talk
(Thread)
Execution of IF THEN
Last updated: 2009-12-19
To search for an exact phrase, put it in quotes. Example: "getting started docs"
To exclude a word or phrase, put a dash in front of it. Example: docs -help
To search on specific fields, use these field names instead of a general text search. You can group with AND
or OR
.