![modbus poll insufficient bytes received troubleshooting modbus poll insufficient bytes received troubleshooting](https://s3.manualzz.com/store/data/057212755_1-7bea1806ea847207bd65088c8235121c.png)
#MODBUS POLL INSUFFICIENT BYTES RECEIVED TROUBLESHOOTING HOW TO#
Baudrate is 38400 an data lenght can vary between 7 - 60 bytes?Ĭan someone point me in the right direction as how to use the SerialPort.ReceivedDataEvent to properply read in the data of variable unknown length ?ĭim c (128) As Byte 'general array buffer used to store received bytesĭim n As Integer = SerialPort.BytesToRead 'actual data length varies 7 - 60
![modbus poll insufficient bytes received troubleshooting modbus poll insufficient bytes received troubleshooting](https://www.modbustools.com/images/mbpoll-excel-developer-tab.png)
One problem is that I never know how many bytes will be received as there is no specific termination byte that can be used with MODBUS RTU. Number of bytes received is greater than 7)
![modbus poll insufficient bytes received troubleshooting modbus poll insufficient bytes received troubleshooting](https://www.simplymodbus.ca/manual_images/manual2.gif)
This works most of the time, but on a number of events SerialPort.BytesToRead returns zero after the event has been fired? ( Have set the Event to fire when the To tell me how many data bytes to read and then read them in using the SerialPort.Read() method. When this event is fired I use the SerialPort.BytesToRead property The problem I have is when receiving the variable length data using the SerialPort.ReceivedDataEvent. I am using VB code to poll serial data from an external device using MODBUS RTU protocol.