Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

Error: Type mismatch at output...

jethridge
2015-06-11
2015-11-17
  • shooter - 2015-06-12

    the type of the string is wrong, you try a string (80) and should be a pointer to string,
    there are types available in the library, and you have to be sure the types on input and inside FB are the same.

    on some it is the version that gives a problem, so check if the version of the codesys can cope and with the PLC and with the libraries.

     
  • jethridge - 2015-06-12

    How do I declare a variable as 'POINTER TO STRING(255)'? I tried that too and still got an error. For example, I declared the variable.

    ToEmailAddress : POINTER TO STRING(255) := e 'myemail@mycompany.com e ';

    I know my PLC doesn't support the function block, but that is a socket issue. The errors I'm getting are about mismatched variables and data types. I understand the subject email address has to be 'POINTER TO STRING(255)' but don't know how to declare a variable as that.

     
  • shooter - 2015-06-12

    a Pointer must be pointing to a Variable, so not the content but a Var, and obvious this must be same type so both 80 or 255.
    not to a piece of text.
    btw, i never use pointers, as this is not conform the standard. IEC61131

     
  • Windows - 2015-11-17

    jethridge hat geschrieben:
    How do I declare a variable as 'POINTER TO STRING(255)'? I tried that too and still got an error. For example, I declared the variable.
    ToEmailAddress : POINTER TO STRING(255) := e 'myemail@mycompany.com e ';
    I know my PLC doesn't support the function block, but that is a socket issue. The errors I'm getting are about mismatched variables and data types. I understand the subject email address has to be 'POINTER TO STRING(255)' but don't know how to declare a variable as that.

    Did you notice the example within the online help?

    Example:

    pt:POINTER TO INT;
    var_int1:INT := 5;
    var_int2:INT;
    pt := ADR(var_int1);
    var_int2:= pt^; ( var_int2 is now 5 )

     

Log in to post a comment.