private bool ReadSettings() { byte[] cmd = new byte[10]; cmd[0] = 0xA8; cmd[1] = 0x8A; cmd[2] = 0x06; cmd[3] = devType; cmd[4] = devId; cmd[5] = cmdRead; cmd[6] = cmdStartPos; cmd[7] = cmdDataLen; cmd[8] = UTIL.CalCBCheckSum(cmd); cmd[9] = 0xED; if (!robot.SendCommand(cmd, 10, 170, 1000)) { return(false); } byte[] result = robot.ReadAll(); if (result.Length != 170) { return(false); } for (int i = 0; i < 16; i++) { string s = UTIL.B7Array2Str(result, 8 + i * 10, 10); if (s == null) { s = ""; } txtPsx[i].Text = s; } return(true); }
private void ExitUSBTTL() { byte[] command = { 0xA9, 0x9A, 0x01, 0x06, 0x09 }; bool success = robot.SendCommand(command, command.Length, 0, 0); robot.ClearRxBuffer(); receiveBuffer.Clear(); }