Red Lion Switch Statement

Nebul0us

Lifetime Supporting Member
Join Date
Dec 2015
Location
Spokane, WA
Posts
125
Hey everyone,


I am sending an email from a red lion. If I just use 1 of the case statements without the full switch statement, the email works fine. But when I use the full switch statement I am not getting an email. Can anyone provide some insight on what might be wrong with my switch statement?


JMJJyj4.png
 
I think you need a break statement after each case in order to keep it from falling through to the next case. See the example in the Crimson Help Software Guide.

But if your CavityNumber tag is an integer and is equal to one of the cases, it should have triggered the email.
 
You should have a 'break' instruction at the end of each case, it stops the Switch after the first right one is found, otherwise all cases after the found one will be executed.

You should add a 'default' case to catch any value of CavityNumber that doesn't match your list. It can help in fault finding if the Switch Case isn't working as expected. Also you can debug what is going on by adding bool flags to see where the program gets to.

A web search of 'programming in C' followed by your question tends to get good results, like this 'programming in C switch case':
https://beginnersbook.com/2014/01/switch-case-statements-in-c/
 

Similar Topics

Hi All, As a precaution my company has been collecting copies all the HMI and PLC programs. I have recorded copies of most of our sites...
Replies
0
Views
72
While they came up quickly with a fix for the alarm date issue quickly I will have to drive around for a week or so, burning up a lot of fuel...
Replies
4
Views
278
From the Red Lion website, after some customer enquiries in the last week or so... Rev. March 25, 2024 [18:30] Just thought it might help a...
Replies
9
Views
290
How do you install update on Red Lion Crimson ver 3.1. Do I just need to run the exe file on the host server?
Replies
1
Views
126
Hello All, I need the ability to remotely reboot a Red Lion CR3000 HMI. Due to some graphics issues when the database is updated the HMI must be...
Replies
4
Views
246
Back
Top Bottom