Problem READ function Serial COM

AGG
2014-01-27
2020-03-19
  • AGG - 2014-01-27

    Hi everyone,

    i am quite new with Codesys V3, since I have always worked with Codesys V2.3. Since some days i am blocked with a problem of our RS232 interface.

    I have problems with the reception of the serial communication example from 3S. The transmission works perfect, but there is no way to get data into the buffers. The strange thing is that the READ function does not return any error, and xDone is set. The only problem is that the buffer is always 0.

    In order to be able to read/write to the Laptop we use a USB-RS232 adaptor, which works fine in other applications. I have modified the example just to receive the data into the port1. Here is the piece of the code:

    (*
    15: // the reading process is started
    read_done := false;
    comr1(xExecute := TRUE,hCom:= como1.hCom, pBuffer:= ADR(sRead), szBuffer:= SIZEOF(sRead), udiTimeOut := 200000 ,xDone => read_done ,xError => read_error, xAborted => read_aborted);

            IF read_aborted OR read_aborted THEN
                counter2 := counter2 + 1;           
            ELSIF read_done THEN                
                szRead := comr1.szSize;
                iState := 10;
                comr1(xExecute := FALSE,hCom:= como1.hCom, pBuffer:= ADR(sRead), szBuffer:= SIZEOF(sRead),xDone => read_done);
                counter := counter + 1;
                read_done := FALSE;                 
            END_IF
    

    *)
    Did someone had a similar problem? We are wondering if we have a Harware problem (we use a Berghof controller), or maybe we are not using the function right.

    I hope someone can orientate me a little bit. Thanks in advance and regards!

    Alejandro

     
  • Thillai - 2020-03-19

    I am also facing the same issue. Is there any solution available for this?.

     

    Last edit: Thillai 2020-03-19

Log in to post a comment.