Jump to content

store string in switch case


Recommended Posts

I want to store a specific string (read fixed) to a "string tag" according a value.  If value = 1, then string should be "OK" - value = 2, string is "NOT OK", value = 3, string is "FAULT...",....

OK, I know I can do this with the compare instructions, but I want to do this with the switch case instruction....😎

suggestions anybody ?

Link to comment
Share on other sites



For the HMI 

    Under Text,   List of texts

           Create an Indexed List and call them by the      FaultCode  ( int 32)  ( your switch case index )  in the program

                ( FaultCode  being what ever name you choose )


In the Ladder  -  Use the    Compare =    to Set the  Fault Code   to the Fault number  

or  -- this one is neet --

Under Solution explorer   use the   Switch Case   and set up the   FaultCode    to the List of Texts 

                There is a lot of flexibility in this function   - Fixed  compares and ranges    with   Options for Actions

Example  :    Case ID 1 ,  Name Case 1, Comparison Type - Value , From   #1 ( a Constant),  To   (Blank) ,   Action  (Store Tag)    , Tag (FaultCode)   Store into Tag ( #1   a Constant)




Link to comment
Share on other sites

  • 4 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...