static EngineDiagnostic() { _31FE = StringToSendBytes.bytesToSend("311B00000000000000FE00" + "\n"); _31FD = StringToSendBytes.bytesToSend("311B00000000000000FD00" + "\n"); _31CE = StringToSendBytes.bytesToSend("311B00000000000000CE00" + "\n"); _31CF = StringToSendBytes.bytesToSend("311B00000000000000CF00" + "\n"); _331B = StringToSendBytes.bytesToSend("331B" + "\n"); }
private void Max_MinValue() { byte[] _21016CStr = StringToSendBytes.bytesToSend("234C09C828\n"); GobalSerialPort.WriteByMessage(_21016CStr, 0, _21016CStr.Length); MaxValue_minValue = GobalSerialPort.ResultBackString; //计算最大值最小值 WorkOut_Max_Min(); }
/** * address write */ public static byte[] AddressWriteConvert(String cmd, int lenght) { String hexlenght = lenght.ToString("X").PadLeft(6, '0'); String AddressCmd = CommonConstant.EolWritePrefix + cmd + CommonConstant.EolSuffix + hexlenght; byte[] AddressCmdbyte = StringToSendBytes.bytesToSend(AddressCmd + "\n"); return(AddressCmdbyte); }
public void IniConnectTl718() { _ATE0 = StringToSendBytes.bytesToSend("ATE0\n"); ATSP5 = StringToSendBytes.bytesToSend("ATSP5\n"); ATST03 = StringToSendBytes.bytesToSend("ATST05\n"); ATSW19 = StringToSendBytes.bytesToSend("ATSW19\n"); ATSH81_10_F1 = StringToSendBytes.bytesToSend("ATSH8110F1\n"); _1081 = StringToSendBytes.bytesToSend("1081\n"); _AT2S = StringToSendBytes.bytesToSend("AT@S\n"); TL718NUM = new ArrayList(); }
/// <summary> /// 165代码读取量 /// </summary> private void _0165_016B() { for (int i = 0; i < 5; i++) { string Sendstring1 = "210165"; long intA1 = Convert.ToInt64(Sendstring1, 16); intA1 = intA1 + i; string Sendstring2 = Convert.ToString(intA1, 16) + "\n"; byte[] ByteSend = StringToSendBytes.bytesToSend(Sendstring2); GobalSerialPort.WriteByMessage(ByteSend, 0, ByteSend.Length); _0165_016BS[i] = GobalSerialPort.ResultBackString; } }
private void SendExtendMes() { byte[] counter = StringToSendBytes.bytesToSend("234C09743c\n"); GobalSerialPort.WriteByMessage(counter, 0, counter.Length); _0165_016BS[0] = GobalSerialPort.ResultBackString; byte[] _1_mapSendCmd = StringToSendBytes.bytesToSend("234C07F490\n"); GobalSerialPort.WriteByMessage(_1_mapSendCmd, 0, _1_mapSendCmd.Length); _0165_016BS[2] = GobalSerialPort.ResultBackString; byte[] _2_mapSendCmd_1 = StringToSendBytes.bytesToSend("234C085490\n"); GobalSerialPort.WriteByMessage(_2_mapSendCmd_1, 0, _2_mapSendCmd_1.Length); _0165_016BS[3] = GobalSerialPort.ResultBackString; byte[] _2_mapSendCmd_2 = StringToSendBytes.bytesToSend("234C08E490\n"); GobalSerialPort.WriteByMessage(_2_mapSendCmd_2, 0, _2_mapSendCmd_2.Length); _0165_016BS[4] = GobalSerialPort.ResultBackString; }
private void Con() { try { #region //winuds.串口.serialPort1(); string BackString; string ClearBuff = GobalSerialPort.ResultBackString; byte[] _2709Str = StringToSendBytes.bytesToSend("2709\n"); GobalSerialPort.WriteByMessage(_2709Str, 0, _2709Str.Length); BackString = GobalSerialPort.ResultBackString; // "2709\r67 09 76 BB DD EE \r\n\r\n>" if (BackString.Contains("NO")) { byte[] _2709Str1 = StringToSendBytes.bytesToSend("2709\n"); GobalSerialPort.WriteByMessage(_2709Str1, 0, _2709Str1.Length); BackString = GobalSerialPort.ResultBackString; } string[] Backs = BackString.Split('\r'); string Back1 = Backs[1].Replace(" ", ""); Back1 = Back1.Substring(4, 8); UInt32 b = UInt32.Parse(Back1, System.Globalization.NumberStyles.HexNumber); //最后得到的 b 的值是 171。 string _270AStr = Convert.ToString(KEYMethod(b), 16).PadLeft(8, '0'); _270AStr = "270A" + _270AStr + "\n"; byte[] _270AByte = StringToSendBytes.bytesToSend(_270AStr); GobalSerialPort.WriteByMessage(_270AByte, 0, _270AByte.Length); string Backstring1 = GobalSerialPort.ResultBackString; byte[] _1086byte = StringToSendBytes.bytesToSend("1086\n"); GobalSerialPort.WriteByMessage(_1086byte, 0, _1086byte.Length); string Backstring2 = GobalSerialPort.ResultBackString; if (Backstring2.Contains("86")) { } else { } #endregion } catch { } }
private void SendGeneral() { byte[] _21016DStr = StringToSendBytes.bytesToSend(General1cmd + "\n"); GobalSerialPort.WriteByMessage(_21016DStr, 0, _21016DStr.Length); Genera1[0] = GobalSerialPort.ResultBackString; byte[] _21016EStr = StringToSendBytes.bytesToSend(General2cmd + "\n"); GobalSerialPort.WriteByMessage(_21016EStr, 0, _21016EStr.Length); Genera1[1] = GobalSerialPort.ResultBackString; byte[] _21016FStr = StringToSendBytes.bytesToSend(General3cmd + "\n"); GobalSerialPort.WriteByMessage(_21016FStr, 0, _21016FStr.Length); Genera1[2] = GobalSerialPort.ResultBackString; byte[] _210170Str = StringToSendBytes.bytesToSend(General4cmd + "\n"); GobalSerialPort.WriteByMessage(_210170Str, 0, _210170Str.Length); Genera1[3] = GobalSerialPort.ResultBackString; byte[] _210171Str = StringToSendBytes.bytesToSend(General5cmd + "\n"); GobalSerialPort.WriteByMessage(_210171Str, 0, _210171Str.Length); Genera1[4] = GobalSerialPort.ResultBackString; }
/// <summary> /// write /// </summary> public static void writeFunction(String address, int lenght, String value) { try { CommonConstant.mode = "1092"; Tp_KeyMethodFuntion.Con(); byte[] ATSTFE = StringToSendBytes.bytesToSend("ATSTFE\n"); GobalSerialPort.WriteByMessage(ATSTFE, 0, ATSTFE.Length); GobalSerialPort.WriteByMessage(CommonCmd.ATSW30, 0, CommonCmd.ATSW30.Length); //GobalSerialPort.WriteByMessage(DebugMode.startMode84, 0, DebugMode.startMode84.Length); GobalSerialPort.WriteByMessage(CommonCmd._830300D600140A, 0, CommonCmd._830300D600140A.Length); //1092模式 GobalSerialPort.WriteByMessage(CommonCmd._109214, 0, CommonCmd._109214.Length); backString = GobalSerialPort.ResultBackString; //日期模式 byte[] databyte = StringToSendBytes.bytesToSend("80 81 02 31 32 33 34 35 36 17 03 E2\n"); GobalSerialPort.WriteByMessage(databyte, 0, databyte.Length); backString = GobalSerialPort.ResultBackString; //34 模式 address = "024E9E"; byte[] addressbyte = AddressWriteConvert(address, 2); GobalSerialPort.WriteByMessage(addressbyte, 0, addressbyte.Length); backString = GobalSerialPort.ResultBackString; //36 写入数据 String valueWrite = "36" + value; valueWrite = "362222" + "\n"; byte[] byteValueWrite = StringToSendBytes.bytesToSend(valueWrite); GobalSerialPort.WriteByMessage(byteValueWrite, 0, byteValueWrite.Length); backString = GobalSerialPort.ResultBackString; GobalSerialPort.WriteByMessage(CommonCmd.ATBD, 0, CommonCmd.ATBD.Length); backString = GobalSerialPort.ResultBackString; //commoncmd if (!backString.Contains("76")) { GobalSerialPort.WriteByMessage(byteValueWrite, 0, byteValueWrite.Length); GobalSerialPort.WriteByMessage(CommonCmd.ATBD, 0, CommonCmd.ATBD.Length); backString = GobalSerialPort.ResultBackString; } if (!backString.Contains("76")) { GobalSerialPort.WriteByMessage(byteValueWrite, 0, byteValueWrite.Length); GobalSerialPort.WriteByMessage(CommonCmd.ATBD, 0, CommonCmd.ATBD.Length); backString = GobalSerialPort.ResultBackString; } if (!backString.Contains("76")) { GobalSerialPort.WriteByMessage(byteValueWrite, 0, byteValueWrite.Length); GobalSerialPort.WriteByMessage(CommonCmd.ATBD, 0, CommonCmd.ATBD.Length); backString = GobalSerialPort.ResultBackString; } //76 if (backString.Contains("76")) { GobalSerialPort.WriteByMessage(CommonCmd._37, 0, CommonCmd._37.Length); GobalSerialPort.WriteByMessage(CommonCmd._3180, 0, CommonCmd._3180.Length); GobalSerialPort.WriteByMessage(CommonCmd._3380, 0, CommonCmd._3380.Length); } EcuEnd(); } catch { } }
/// <summary> /// debug mode /// </summary> static DebugMode() { startMode84 = StringToSendBytes.bytesToSend("1084\n"); }