Closed mjasnikovs closed 8 years ago
const modbus = require('jsmodbus') const client = modbus.client.tcp.complete({ host: 'JWLE-C45', port: 502, autoReconnect: true, reconnectTimeout: 1000, timeout: 5000, unitId: 0 }) client.on('connect', () => { client.writeSingleCoil(1, true).then(console.log).fail(console.log) client.readCoils(1, 1).then(console.log).fail(console.log) setTimeout(() => client.close(), 100) }) client.on('error', console.log) client.connect()
{ fc: 5, outputAddress: 1, outputValue: true } { fc: 1, byteCount: 1, coils: [ true, false, false, false, false, false, false, false ] }
I write into first coil value "true", and then return value with readCoils(1, 1). Returned value contains 8 values. Is this correct? Or only one value shod be returned.
Sorry, if this is stupid question.
Not a stupid question!
Since I evaluate 8 bit unsigned values I do not wanted to cut the result down down. Lazy I know but the behavior is accurate.
Code
Result
I write into first coil value "true", and then return value with readCoils(1, 1). Returned value contains 8 values. Is this correct? Or only one value shod be returned.
Sorry, if this is stupid question.