private void btnCLEARCNT_Click(object sender, EventArgs e) { try { byte[] l_byteBufClearCounter = new byte[34] { 0xFF, 0xAA, 0x00, 0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0xEE, 0xEE }; if (main.serialPort1.IsOpen) { l_byteBufClearCounter[31] = ToolFunc.XorCheck_byte(2, l_byteBufClearCounter, 4); main.serialPort1.Write(l_byteBufClearCounter, 0, l_byteBufClearCounter.Length); } main.g_n32ScanDatCorrectPkgs = 0; main.g_n32DrawPkgssOfJi = 0; main.g_n32SaveScanDatPkgs = 0; main.g_n32ScanDatRcvdFrames = 0; //main.g_ln32armpkgs.Clear(); g_bTestRcvdPkgsFlg = true; label_start.Text = DateTime.Now.ToString("MM-dd-HH-mm-ss-fff"); } catch { } }
private void btn_single_Click(object sender, EventArgs e) { try { //if (main.g_SocketClient.Connected == true) if (main.serialPort1.IsOpen) { //byte[] l_abGetOneFrame = new byte[34] {0xFF,0xAA,0x00,0x1E,0x00,0x00,0x00,0x00,0x00, // 0x00,0x01,0x01,0x00,0x05,0x00,0x00,0x00,0x00, // 0x00,0x00,0x00,0x00,0x06,0x09,0x00,0x00,0x00, // 0x00,0x00,0x00,0x00,0x1C,0xEE,0xEE}; //l_abGetOneFrame[31] = ToolFunc.XorCheck_byte(2, l_abGetOneFrame, 4); byte[] l_abGetOneFrame = new byte[24] { 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x00, 0x0F, 0x73, 0x52, 0x4e, 0x20, 0x4c, 0x4d, 0x44, 0x73, 0x63, 0x61, 0x6e, 0x64, 0x61, 0x74, 0x61, 0x05 }; l_abGetOneFrame[23] = ToolFunc.XorCheck_byte(8, l_abGetOneFrame, 1); //main.g_SocketClient.Send(l_abGetOneFrame); main.serialPort1.Write(l_abGetOneFrame, 0, l_abGetOneFrame.Length); g_n32SingleFrameCmdCnt++; } richTextBox1.AppendText(DateTime.Now.ToString() + " " + "发送单帧取数命令" + "\r"); } catch { return; } }
private void btn_continue_Click(object sender, EventArgs e) { try { if (btn_continue.Text == "停止获取") { btn_continue.Text = "连续获取"; if (main.serialPort1.IsOpen) { byte[] acStopGetSickContinueFrameBuf = new byte[26] { 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x00, 0x11, 0x73, 0x45, 0x4e, 0x20, 0x4c, 0x4d, 0x44, 0x73, 0x63, 0x61, 0x6e, 0x64, 0x61, 0x74, 0x61, 0x20, 0x00, 0x00 }; acStopGetSickContinueFrameBuf[25] = ToolFunc.XorCheck_byte(8, acStopGetSickContinueFrameBuf, 1); main.serialPort1.Write(acStopGetSickContinueFrameBuf, 0, acStopGetSickContinueFrameBuf.Length); } richTextBox1.AppendText(DateTime.Now.ToString() + " " + "发送停止获取命令" + "\r"); } else { btn_continue.Text = "停止获取"; if (main.serialPort1.IsOpen) { byte[] acStopGetSickContinueFrameBuf = new byte[26] { 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x00, 0x11, 0x73, 0x45, 0x4e, 0x20, 0x4c, 0x4d, 0x44, 0x73, 0x63, 0x61, 0x6e, 0x64, 0x61, 0x74, 0x61, 0x20, 0x01, 0x00 }; acStopGetSickContinueFrameBuf[25] = ToolFunc.XorCheck_byte(8, acStopGetSickContinueFrameBuf, 1); main.serialPort1.Write(acStopGetSickContinueFrameBuf, 0, acStopGetSickContinueFrameBuf.Length); } richTextBox1.AppendText(DateTime.Now.ToString() + " " + "发送连续获取命令" + "\r"); } } catch { return; } }