//wirte to device public void GPIBwr(string Commands) { try { int BuffSize; BuffSize = Commands.Length; li.ibwrt(Dev, Commands, BuffSize); if ((li.ibsta & c.ERR) != 0) { throw new System.Exception("Unable to write to device!\nibsta:" + li.ibsta + "\nERR:" + c.ERR); } } catch (System.Exception Ex) { // MessageBox.Show("Error: " + Ex.Message + //error Name // "ibsta = " + li.ibsta + //ibsta // "iberr = " + li.iberr + //iberr // ErrorMnemonic[li.iberr]); //error code string str = Ex.Message + //error Name "ibsta = " + li.ibsta + //ibsta "iberr = " + li.iberr + //iberr ErrorMnemonic[li.iberr]; //error code throw new Exception(str); } }
internal override void Send(string line, bool FlushAndEnd) { if (IsConnected()) { Logger.Log(line); li.ibclr(Dev); li.ibwrt(Dev, line); Thread.Sleep(50); if ((li.ibsta & c.ERR) != 0) // throw an error { throw new Exception("命令发送失败"); return; } } }
internal override void Send(string line, bool FlushAndEnd) { if (IsConnected()) { foreach (char i in line.ToCharArray()) { li.ibwrt(Dev, i.ToString()); Thread.Sleep(5); if ((li.ibsta & c.ERR) != 0) // throw an error { MessageBox.Show("命令发送失败"); return; } } } }