Hi Kyle:
modbusDevice = new Tag<DintPlcMapper, int[]>();
modbusDevice.Gateway = "
192.168.127.254:502";
modbusDevice.Path = "0"; //"18 for port 1 19 for port 2
modbusDevice.Name = "ir50"; //Specify 30049
//modbusDevice.PlcType = PlcType.Slc500;
modbusDevice.Protocol = Protocol.modbus_tcp;
modbusDevice.Timeout = TimeSpan.FromSeconds(10);
modbusDevice.ArrayDimensions = new int[] {120};
modbusDevice.Aborted += ModbusDevice_Aborted;
modbusDevice.ReadCompleted += ModbusDevice_ReadCompleted;
private async void C_Click(object sender, RoutedEventArgs e)
{
await modbusDevice.ReadAsync(); ///Start Read
}
private void ModbusDevice_ReadCompleted(object? sender, TagEventArgs e)
{
if (modbusDevice.Value!=null )
{
Debug.WriteLine("Success");
}
}
I check all array return 0. whereas with modbus poll, Input Register 30049, value is 4 which is input bit 2 (start from 0);
I try modbusDevice.Name = "ir48" or ir49, nothing work
Is my setting correct?
Regards
simon