
TxtSource = Val(Str((MbusByteArray(10) * 256) + MbusByteArray(11))) ReturnInfo = returnInfo & Asc(Mid(sBuffer, i, 2))

MbusByteArray(i) = Asc(Mid(sBuffer, i, 2)) Private Sub wsTCP_OnDataArrival(ByVal bytesTotal As Long) Private Sub CommandButton2_Click() ‘ Stop the communicationĬommandButton1.BackColor = “&H8000000F” ‘ Set the default colour MsgBox “Error ” & Err.Number & “: ” & Err.Description ‘0030 The number to put into the register

’16: The Function Code (read Analog Output Holding Registers) ‘0009: Message Length (6 bytes to follow) ‘0000: The Data Address of the first register ’03: The Function Code (read MHR Read Holding Registers) ‘0006: Message Length (6 bytes to follow) WsTCP.SendData MbusQuery ‘Send out the Modbus Information ‘ If we are connected then request the information. StartTime = Timer ‘ Use the timer to determine if a connection cannot be made ‘ If TCP is not connected, try to connect again.
