Dispatch ( 'Mbslave.Application' ) SlaveApp. Floats ( 6 ) = 123.45 ' A float takes 2 registers ' Now a master can read 8 Holding registers with a mix of 3 data types End Sub Longs ( 4 ) = 10000 ' A long takes 2 registers doc.
URegisters ( 2 ) = 50000 ' no matter the Modbus address used. SRegisters ( 1 ) = - 10 ' Note that the Index used counts from 0 doc. SRegisters ( 0 ) = 1 ' Modbus address 100 doc. SetupHoldingRegisters ( 1, 100, 8 ) doc. Connection = 1 ' Modbus TCP/IP ' TCP/IP settings. ' Set doc2 = CreateObject("Mbslave.Document") ' Set one of 5 connection types. You can only create 1 application object Set app = CreateObject ( "Mbslave.Application" ) ' Create a new Modbus Slave document (Data Window) ' This is the same as open a new data window in Modbus Slave ' You can create up to 50 Modbus Slave documents (Data Window) Set doc = CreateObject ( "Mbslave.Document" ) ' Show Modbus Slave ' res = doc.ShowWindow() ' Create doc2 if needed. Public doc As Object Public app As Object Dim status As Integer Dim n As Integer Private Sub StartSlave_Click () ' Create an application object. ? 1SERIAL: InputAction: " %b" ? 1SERIAL: RxBuf- 4 ? 1SERIAL: InputAction: " %b" ? 1SERIAL: InputAction: " %b" ? 1SERIAL: RxBuf- 6 ? 1SERIAL: InputAction: " %b" ? 1SERIAL: RxBuf- 5 With the multiple document interface you can monitor several Modbus slaves and/or data areas at the same time.
126831, 0 A, 0, 0, 65535, 53, 4, 2, 0, 0, 8, 244, 65535 Modbus Poll is a Modbus master simulator designed primarily to help developers of Modbus slave devices or others that want to test and simulate the Modbus protocol.
'Init 8CV to default 0xFFFF 8CV= 0xFFFF 'If Message is a request, then store 8th byte in 8CV, otherwise 8CV=0xFFFF RA1SERIAL "" 'Grab 7 Bytes from Rx BufferġSERIAL("%b%b%b%b%b%b%b") The most successful way I have found of doing this is posted below: BEGIN "Job1"
I have tried various different ways of programming this with DeLogger in the Text Window. The MODBUS Master only will request one register at a time from each slave device. The application that DT80 will be used will have one MODBUS Master, and 4 MODBUS Slave Devices.ĭT80 will ONLY monitor the link and log the data. I have an application where I need to "sniff", and log all MODBUS traffic on RS485 2-wire.