private void change_bpq() { doData[0] = set_bit(doData[0], 2, true); daq.InstantDo_Write(doData); aoData[0] = (double)mr.read_short("8451", 2) / 500; //读取变频器返回值 mr.write_short("17", mr.read_short("8451", 2), 2); //直接将从变频器读取到数据写入变频器中 Invoke(new Action(() => { dingpin_out.Value = (decimal)Math.Round(mr.read_short("8451", 2) / 100.0, 2); })); }
private void hslSwitch1_OnSwitchChanged(object arg1, bool arg2) { if (arg2)//定频 { doData[0] = set_bit(doData[0], 2, true); daq.InstantDo_Write(doData); //daq.InstantAo_Write(aoData); aoData[0] = (double)bpqMR.read_short("8451", 2) / 500; //读取变频器返回值 bpqMR.write_short("17", bpqMR.read_short("8451", 2), 2); //直接将从变频器读取到数据写入变频器中 dingpin_out.Value = (decimal)Math.Round(bpqMR.read_short("8451", 2) / 100.0, 2); } else//变频 { aoData[0] = (double)sbyali.Value; //daq.InstantAo_Write(aoData); bpqMR.write_short("125", (short)(100 * sbyali.Value * 5), 2); doData[0] = set_bit(doData[0], 2, false); daq.InstantDo_Write(doData); } }