//设置调节阀设定值 public static byte[] Set_valvevalue(byte address, xd100x.valvecontrol control, xd100x.valvevalue value) { byte[] t1 = BitConverter.GetBytes(value._value); byte[] t2 = BitConverter.GetBytes(0f); byte[] buffer = { 0x47, Convert.ToByte(control._control), t1[0], t1[1], t1[2], t1[3], t2[0], t2[1], t2[2], t2[3] }; return(DataInfo.SetData(address, 21, buffer)); }
//解析设置类型 public static xd100x.valvecontrol Read_valvecontrol(byte[] inByte) { xd100x.valvecontrol vc = new xd100x.valvecontrol(); vc._control = DataInfo.GetLongValue2(inByte, 3); return(vc); }
//设置命令生成区域 #region Set //设置类型 public static byte[] Set_valvecontrol(byte address, xd100x.valvecontrol vc) { int[] buffer = { vc._control }; return(DataInfo.ModbusSetData(address, 0x10, 114, buffer)); }