Been trying to get a response from a device using modbus. Using other applications I checked that device it working just fine. But on my application I never seem to be able to get any response.
private void timerModbus_Tick(object sender, EventArgs e)
{
if (!checkBoxModbus.Checked) return;
string str = "01 03 00 00 00 08 44 0C";
byte[] bytes = str.Split(' ').Select(s => Convert.ToByte(s, 16)).ToArray();
serialPortModbus.Write(bytes, 0, bytes.Length);
serialPortModbus.DataReceived += new SerialDataReceivedEventHandler(port_ModbusDataReceived);
}
private void port_ModbusDataReceived(object sender, SerialDataReceivedEventArgs e)
{
textBoxModbus.AppendText(serialPortModbus.ReadExisting());
}
Is my serial read/write not up for this task?