Jump to content

store string in switch case


pascal

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

Hi;

 

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)

 

DanT

 

Link to comment
Share on other sites

  • 4 weeks later...

Hi,

I approve what DanT advised: use the regular "store" option of the switch case in order to store a fault code into a tag, then link tat tag to a HMI "list of texts" element in order to link each value to the text you want to be displayed.

Rivka

Link to comment
Share on other sites

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.

Guest
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...