Cloud-Automation / node-modbus

Modbus TCP Client/Server implementation for Node.JS
471 stars 175 forks source link

Using the Modbus/RTU Client with RS485 #136

Closed stefanpoeter closed 6 years ago

stefanpoeter commented 7 years ago

If I am right, the RS232 Standard is a point-to-point connection. So addressing the server in the Modbus/RTU specification is actually pointeless. But when using RS485 there can be multiple Modbus/RTU Server listening, right? So, I am curious if the new v3.0.0-alpha implementation works with this setup? Is anyone here who can test this?

A simple setup with two clients would look like this:

// create a tcp modbus client
let Modbus = require('jsmodbus')
let SerialPort = require('serialport')
let options = {}
let clientA = 1
let clientB = 2
let socket = new SerialPort("?", options)
let clientA = new Modbus.client.RTU(socket, clientA)
let clientB = new Modbus.client.RTU(socket, clientB)