Company logo
  • Empleos
  • Bootcamp
  • Acerca de nosotros
  • Para profesionales
    • Inicio
    • Empleos
    • Cursos y retos
    • Preguntas
    • Profesores
    • Bootcamp
  • Para empresas
    • Inicio
    • Nuestro proceso
    • Planes
    • Pruebas
    • Nómina
    • Blog
    • Comercial
    • Calculadora

0

152
Vistas
Modbus TCP connection fail

the master plc I use is "Panasonic FP7", and I have their official software "FPWIN GR7" so that I can use the PC to see the data flow, but the software lake of the function so I want to create one using nodeJS, there is my code :

master plc address: 192.168.50.30
port:502

PC:192.168.50.138

const Modbus = require('jsmodbus')
const net = require('net')
const socket = new net.Socket()
const netServer = new net.Server()
const server = new Modbus.server.TCP(netServer)



const options = {
'host' : "192.168.50.30",
'port' : "502"
}

const client = new Modbus.client.TCP(socket)

var myData;

socket.on("connect",function(){
    function getData(){
        client.readHoldingRegisters(0,1)
        .then((resp)=>{
            console.log(resp.response)
            socket.end()
        }).catch((err)=>{
            console.log(err)
      
        })
        socket.end()
    }
    setInterval(getData,500)
 })


socket.on("error",console.error)

socket.connect(options)

the error code I couldn't figure out:

UserRequestError {
  err: 'Offline',
  message: 'no connection to modbus server',
  response: undefined
}

my struct

7 months ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

After seeing "from56" advice, I go Panasonic download every PLC documentation looking for TCP/IP setting, and I realize that my DHCP setting was wrong after fixing it, and then add a new "user connection information setting13" -> open type -> server connection.

7 months ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos