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

Wrong order of bytes received from serial port

damian177
2021-09-12
2021-09-13
  • damian177

    damian177 - 2021-09-12

    Hi
    I tried communication with serial port device with SysCom library.
    I was read four bytes like this :

    IF hCom <> RTS_INVALID_HANDLE AND bReadCom THEN
        //Read data
        dwRead := SysComRead(hCom:=hCom,pbyBuffer:=ADR(byteRead), ulSize:=SIZEOF(byteRead), ulTimeout:=100, pResult:=ADR(Result));
    
    END_IF
    

    I get the bytes but still in bad order. What should I do to get byte in appropriate order?

     
  • damian177

    damian177 - 2021-09-12

    It is other problem - not a wrong order of bytes. I should wait for all bytes, how do this in above example ?

     
  • damian177

    damian177 - 2021-09-13

    Any idea?
    when I extend cycle time to 200ms that everything is ok. Do you have any ide how come back to 10ms cycle time and recive all bytes form UART?

     

    Last edit: damian177 3 days ago

Log in to post a comment.