日期:2014-05-17 浏览次数:20804 次
byte[] data = new byte[14];
data[0] = 11;
data[1] = 0x00;
data[2] = 0x04;
data[3] = 2;
data[4] = 0;
data[5] = 0;
data[6] = 0;
data[7] = 0;
data[8] = 0;
data[9] = 0;
data[10] = 0;
data[11] = 0;
CalculateCRC(ref data, 0, 12);
byte[] me = Write(data, 0, 14);
public byte[] Write(byte[] date, int offset, int count)
{
port.WriteTimeout = 3000;
port.Write(date, offset, count);
System.Threading.Thread.Sleep(3000);
port.ReadTimeout = 2000;
int cou = port.BytesToRead;
byte[] da = new byte[cou];
port.Read(da, 0, cou);
port.DiscardInBuffer();
port.DiscardOutBuffer();<