private void btnSoftTrig_Click(object sender, EventArgs e) { if (RC_client.ClientOpen) { RC_client.SendStr("wr 2e 1"); Thread.Sleep(5); RC_client.SendStr("rd 2f"); string t = ""; int rt; RC_client.ReadStr(out t, out rt); char[] sep = new char[2]; sep[0] = ' '; sep[1] = '\r'; string[] tok = t.Split(sep); if (tok.Length > 3) { label5.Text = tok[3]; } else { label5.Text = "blank line"; } label5.Visible = true; Application.DoEvents(); } }
private void btnRead_Click(object sender, EventArgs e) { //btnSoftTrig_Click(null, null); //Thread.Sleep(10); RC_client.SendStr("rdm 13 101"); string t = ""; int rt; RC_client.ReadStr(out t, out rt); RC_client.Disarm(); char[] sep = new char[2]; sep[0] = ' '; //sep[1] = '\r'; string[] tok = t.Split(sep, StringSplitOptions.RemoveEmptyEntries); Event e13 = new Event(); int j = 0; int k = 0; for (int i = 0; i < tok.Length; i++) { if (j == 8) { j = 0; k++; } else { try { e13.RawBytes[0, j + 8 * k] = Convert.ToInt16(tok[i], 16); if (e13.RawBytes[0, j + 8 * k] > 0x7ff) { e13.RawBytes[0, j + 8 * k] = (Int16)(e13.RawBytes[0, j + 8 * k] - 0xfff); } } catch { e13.RawBytes[0, j + 8 * k] = -99; } e13.Channels[0, j + 8 * k] = e13.RawBytes[0, j + 8 * k] + 100; j++; } } e13.EvNum = PP.myRun.Events.Count; PP.myRun.Events.AddLast(e13); plot_e = PP.myRun.Events.Last.Value; txtEvt.Text = PP.myRun.Events.Count.ToString(); Plot0_display(); Application.DoEvents(); }