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

string null

Anonymous
2009-05-25
2009-06-01
  • Anonymous - 2009-05-25

    Originally created by: Stefano.Casarini

    Hello,

    In laser marker protocol i have to send to it with serial comunication three string null ($00) but when i concact three $00 the result is only one string null.

    Ex:

    StringExample:STRING:='$00$00$00';

    the result string before send is StringExample:='';

    Regards

    Stefano

     
  • ndzied1 - 2009-05-25

    In string operations, the null character signifies the end of the string when displaying the string the first null tells the program the string is done.

    I'm not sure if the concat will work or not.

    I would try to send three BYTEs with a value of 0 (which is the same as the null character.

     
  • Anonymous - 2009-05-30

    Originally created by: Stefano.Casarini

    Thanks,

    i'll try it

     
  • Avgur - 2009-06-01

    StringExample:STRING:='$00$00$00' is equal to StringExample:='' (null string) and ```

    SysComWrite(dwHandleCom,ADR(StringExample),LEN(StringExample),0)

    ``` send NOTHING to COM port.

    You have to use array of bytes instead of string.
    For example:

    VAR
    Β arr1:ARRAY[1..3] OF BYTE:=3(0);
    Β writed:DWORD;
    END_VAR
    writed:=SysComWrite(dwHandleCom,ADR(arr1),3,50);
    
     

Log in to post a comment.