zoukankan      html  css  js  c++  java
  • c# serialport读取不限数量的16进制数据

    //private char[] HexChar = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };

     
     private void serialPort1_DataReceived(object sender, SerialDataReceivedEventArgs e)
            {
                char hexH;
                char hexL;
                byte receivebyte;
                string dataToshow = "";
                while (serialPort1.BytesToRead > 0)
                {
                    receivebyte = (byte)serialPort1.ReadByte();
                    hexH = HexChar[receivebyte / 16];
                    hexL = HexChar[receivebyte % 16];
                    dataToshow += hexH.ToString() + hexL.ToString();
                }
                this.tBox.Invoke(new MethodInvoker(delegate
                {
                    this.tBox.AppendText(dataToshow + " ");
                }));
            }
  • 相关阅读:
    kill一个pthread_test.bin测试程序主线程、子线程退出kernel flow
    signal bit operation
    pthread
    信号发送处理流程
    sdcardfs
    node小贴士03
    node小贴士02
    node小贴士01
    siteserver cms 搜索功能
    语法的高亮显示
  • 原文地址:https://www.cnblogs.com/qqhfeng/p/6649337.html
Copyright © 2011-2022 走看看