Help regarding CASE Structure in Allen Bradley Studio 5000

huzzygr8

Member
Join Date
Oct 2020
Location
Germany
Posts
13
Hello everyone,
I have recently started a new project using ST in Studio 5000.
Previously, I have programmed in ST in Siemens. As i was writting my code in Studio 5000 i came across the following problem with CASE_OF

// In Siemens i had the following code:

CASE #req OF
#MANUAL: //constant as a selector variable
expressions.....
END_CASE

It works perfectly fine

// In AB Studio 5000 i have written the following code:

CASE G.Req OF
C.MANUAL: //constant as a selector variable (shows error here)
expressions.....
End_Case;

The above code returns an error. How can i use C.MANUAL as a selector for my case structure.

Is there a way I can use the constant as a selector variable or does it support only numbers?

Note: Both G.Req and C.MANUAL are of INT data type
 
I don’t know AB ST but if you use a constant as a selector variable then the case statement would only ever run one of the possible sections of code. This would make the CASE statement pretty useless and could just be replaced by an IF.

CASE is designed to let you run many different “cases” of code as the selector variable changes.
 
Hi,

It is not possible to use constants as selectors in Rockwell...
If you look in the documentation for the CASE_OF syntax you will see that the format of the selector is only Immediate.

Unfortunately.
 
I think I misunderstood which of your variables was the constant so I'm sorry for any confusion I caused. but as Jobbe9000 found, looks like only immediate values are allowed.

I know in CoDeSys, I have used ENUMs in CASE structures where you wanted to use the constant but that's a different flavor of IEC61131
 

Similar Topics

Hello everyone, I have recently started a new project using ST in Studio 5000. Previously, I have programmed in ST in Siemens. As i was writting...
Replies
1
Views
1,393
Dear Memners, i have an issue regarding factory talk view alarm sound, i have set internal bell for sevarity =1, internal speeker are working fine...
Replies
2
Views
2,132
I have a micrologix 1200 with me, it communicates with pc with the help of Rs-232 Cable. My computer have Usb so i connect the usb to serial cable...
Replies
2
Views
1,479
I have panelview 550 and micrologix 1200 with me i have loaded a program in ML 1200 and downloaded a hmi screen through rs 232 port on hmi through...
Replies
3
Views
1,558
Hi all, I have a request from client as follows, There's one PID for Control valve which would be controlling on basis of temperature. One...
Replies
1
Views
1,517
Back
Top Bottom