Looking at the help (https://content.helpme-codesys.com/en/CODESYS%20Development%20System/_cds_st_instruction_case.html).
I don't think it is possible but I figured I'd ask.
I'm looking at have a case that evaluates two variables, instead of having multiple If Else statements I was hoping I could just use a case.
Example
*
Case Var1 & Var 2 of
10 & 10:
Instruction Code
10 & 20:
Instruction Code
20 & 20:
Instruction Code
End_Case
Obviously I tried typing as noted above and Codesys threw an error. But I was wondering if there was a different way of programming to make something like this work?
If not I'll just use a bunch of If Else Statements, Thanks.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Looking at the help (https://content.helpme-codesys.com/en/CODESYS%20Development%20System/_cds_st_instruction_case.html).
I don't think it is possible but I figured I'd ask.
I'm looking at have a case that evaluates two variables, instead of having multiple If Else statements I was hoping I could just use a case.
Example
Obviously I tried typing as noted above and Codesys threw an error. But I was wondering if there was a different way of programming to make something like this work?
If not I'll just use a bunch of If Else Statements, Thanks.
This is not possible.
Possible solution could be:
CASE var1 OF
10:
CASE var2 OF
10:;
20:;
END_CASE
20:
CASE var2 OF
10:;
20:;
END_CASE
ELSE
;
END_CASE
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.