private void timerProcess() { double duration = Convert.ToDouble(textBox9.Text); //double time=0; pt = new HighPerformanceTimer(); while (true) { if (flag485) { byte[] Sendcmd = StringToByte2(textBox4.Text); if (!PortSend(Sendcmd)) { MessageBox.Show("发送错误", "提示"); return; } ShowMessage(Sendcmd); } //ShowMessage3(); //textBox6.AppendText(System.DateTime.Now.ToString() + "\n"); //pt.Start(); pt.Delay(duration); //pt.Stop(); //time = pt.Duration; } }
public void testfunction2() { double time = SendTime / 1000.0; int i = 0, j = 0; pt = new HighPerformanceTimer(); while (true) { if (flag485) { i = i % index; byte[] Sendcmd = StringToByte2(cmd[i]); if (!PortSend(Sendcmd)) { MessageBox.Show("发送错误", "提示"); return; } ShowMessage(Sendcmd); i++; } pt.Delay(time); } }