Use STATUS parameter of I/O cards in Calc Block

Hello Everyone,

Im having some trouble trying to use the STATUS parameter of the I/O cards. What I want to be able to do is check the status of my I/O cards and return as output a integer value depending on the diferent STATUS values.

I try using the SELSTR command but it didnt work, it is returning always a zero. Here is the code I put in my CALC block:

'OUT1.CV' := SELSTR('//330-PC-101/IO1/C01/STATUS.CV',"Good","No Card","","","");

Thank you for your time and help

4 Replies

  • I/O Card/STATUS parameter returns "Text description of the current condition of the card" as per BOL.

    Function SELSTR (x,a,b,c,d,e) expects x as numeric.

    A logic should be written to convert text value to integer value.
  • If seems like you have inverted the functionality of SELSTR. SELSTR returns the string corresponding to the parameter. For example:

    //MOD1/PARAM1.CV Return
    1 Good
    2 Bad
    3 Not defined

    is this something that you might wanted to do?

    IF '//CTLR-1/IO1/C01/STATUS.CV' = "Good" THEN
    OUT1 := 1;
    ELSE
    IF '//CTLR-1/IO1/C01/STATUS.CV' = "No Card" THEN
    OUT1 := 2;
    ENDIF;
    ENDIF;

  • In reply to Lun.Raznik:

    Yes that is exactly what I want to do Thank you for your help
  • In reply to vmvmhatre:

    Ohh thanks, you are right I was not using in the right way the command.