Пример #1
0
        /// <summary>
        /// 写通讯地址
        /// </summary>
        public bool Write_Device_Address(byte[] address, SerialPort sp)
        {
            byte[] _writeAddr = CommandMsg.writeAddress(Utilities.dec_to_bcd(address), (byte)CommandMsg.ControlCode.WriteAddr, (byte)CommandMsg.DataFieldLength.WriteAddr);
            sp.Write(_writeAddr, 0, _writeAddr.Length);

            if (CommandMsg.receive_frame(ref _rcvBuf, sp) == true)
            {
                if (_rcvBuf[8] == 0x95)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }