首页上一页 1 下一页尾页 1 条记录 1/1页
串口发送数据文本框里面想显示16进制数,现在是字符格式的,可以帮我下吗?
/// <summary> /// 16进制编码 /// </summary> /// <param name="hexString"></param> /// <returns></returns> private byte[] strToHexByte(string hexString) { hexString = hexString.Replace(" ", ""); if ((hexString.Length % 2) != 0) hexString += " "; byte[] returnBytes = new byte[hexString.Length / 2]; for (int i = 0; i < returnBytes.Length; i++) returnBytes[i] = Convert.ToByte(hexString.Substring(i * 2, 2).Replace(" ", ""), 16); return returnBytes; } 串口通信具体实现,可以参考如下文章,我就是根据这个学习的 https://www.cnblogs.com/Traveller-Lee/p/6940221.html