Hello all,
I was curious to see if anyone has had experience using node-red with a BannerDXM 100. This is my first time using node-red and would like to potentially shift some projects over to it in the future. I have been using the node-red-contrib-modbus package. After playing with the nodes I for some reason can not read my holding registers correctly.
This is a link to the banner api documentation.
http://info.bannerengineering.com/cs/groups/public/documents/literature/186221.pdf
As of right now we use a simple visual basic program HMI to read registers over a tcp client.
Public Function Read_Remote_Registers(server As String, port As Int32, StartReg As Int16, RegCount As Int16, Slave_ID As Int16) As ArrayList
SyncLock SocketConnections
Connect(server, port)
Dim Read_Remote_Register_Array As New ArrayList
Read_Remote_Register_Array.Clear()
//Example use
//Dim Register_Array As ArrayList
//Register_Array = Read_Registers(201, 2, 0)
//TextBox1.Text = Register_Array(2)
//This will read 2 registers starting at register 201 from the processing board slave ID = 0 and build an array
//Next we return register 202 the second register from the array to a textbox
//Begin connection and registry read
//Server = Form_Connection_Settings.TextBox_IP_Address.Text
//Port = Form_Connection_Settings.TextBox_Port.Text
Try
// Translate the passed message into ASCII and store it as a Byte array.
//CMD0001 StartReg, RegCount, Slave ID (=0 for Processing Board, =200 for I/O Board), Modbus CMD, Timeout
//RSP0001 StartReg, CSV Data
Dim data As [Byte]() = System.Text.Encoding.ASCII.GetBytes("CMD0003 " & StartReg & "," & RegCount & "," & Slave_ID & ",0,0")
//Dim client As New TcpClient(Server, Port)
client.SendTimeout = 1000
client.ReceiveTimeout = 1000
//Get a client stream for reading and writing.
Dim stream As NetworkStream = client.GetStream()
//Send the message to the connected TcpServer.
stream.Write(data, 0, data.Length)
Dim bytes(client.ReceiveBufferSize) As Byte
//Read can return anything from 0 to numBytesToRead.
//This method blocks until at least one byte is read.
stream.Read(bytes, 0, CInt(client.ReceiveBufferSize))
//Returns the data received from the host to the console.
Dim returndata As String = Encoding.ASCII.GetString(bytes)
//Convert to array
Dim values As String = returndata
Read_Remote_Register_Array.AddRange(values.Split(","))
Read_Remote_Register_Array.RemoveAt(Read_Remote_Register_Array.Count - 1)
Read_Remote_Register_Array(0) = Mid(returndata, 1, 7)
Read_Remote_Registers = Read_Remote_Register_Array
//Close everything.
stream.Close()
//client.Close()
Catch
Read_Remote_Registers = Read_Remote_Register_Array
//Error Catch
End Try
End SyncLock
End Function
Im not experienced with nodejs so I have no idea how to convert that into javascript