Serial communication flow control

2015-06-08
2015-06-09
  • yannickasselin1 - 2015-06-08

    Hi all,

    I would need more information on how to use the flow control features of the serial port communication.

    I have an application where I need to send a lot of stuff on a serial port as fast as possible. So I need to have a way to know that the serial port buffer is almost full and stop sending bytes and then resume sending bytes when the buffer is almost empty.

    I guess I need to use CTS handshaking or something like that. Can somebody help me on that.

    I am using a B&B Electronics USB to Serial converter to do this.

    Thank you.

     
  • yannickasselin1 - 2015-06-08

    Here's a little more information.

    What I am trying to do is to stop sending bytes before getting the WRITE_INCOMPLETE error.
    Is there a way to know how full is the serial port buffer so I could stop sending bytes before getting the error?
    I am not talking about the device I am communicating with, I am talking about the serial port I am using to send bytes.

    Another problem I have is that when I get the WRITE_INCOMPLETE error, I can't use the serial port anymore.
    Even if I close the port and open it again, the port seems to be frozen. The only way I can use it again is by downloading the program.
    Is there a way to reset the port? What should I do in order to start communication again?

     
  • yannickasselin1 - 2015-06-09

    What I would like to be able to do is just like with Beckhoff's COMlibV2 where I can monitor the count in the ComBuffer. "TxComBuffer.Count" holds the number of bytes left to send out. So I can wait untill this is 0 and then send more bytes.

    Is there a way to do something like this in Codesys?
    I would love to do my project in Codesys but if I cannot find a way to do this, I will probably have to do it in Beckhoff's TwinCAT PLC.

    Please tell me there is a way to do it in Codesys.

    Thanks.

     

Log in to post a comment.