/// <summary> /// 解析多个寄存器解析出来拼接成字符串 例如条码解析 /// </summary> /// <param name="rev"></param> /// <returns></returns> public static string ReadDTValueToStr(string rev) { //地址 %01#RDD0030100309** string ss = PLCAddressHelper.DTValues(rev); string barcode = ""; for (int i = 0; i < ss.Length / 2; i++) { string str = ss.Substring(i * 2, 2); barcode += DecimalConversion.HexStringToASCII(str); } return(barcode); }
/// <summary> /// 解析寄存器读取的值 /// </summary> /// <param name="rev"></param> /// <returns></returns> public static List <string> ReadDTValue(string rev) { List <string> list = new List <string>(); //地址 %01#RDD0030100309** rev = PLCAddressHelper.DTValues(rev); for (int i = 0; i < rev.Length / 2; i++) { string str = rev.Substring(i * 2, 2); list.Add(DecimalConversion.HexStringToASCII(str)); } return(list); }