public void BoolArrayToByteTransferTest( )
        {
            byte[] data = new byte[2] {
                0xA3, 0x46
            };
            bool[] buffer = new bool[] { true, true, false, false, false, true, false, true, false, true, true, false, false, false, true, false };


            byte[] value = byteTransform.TransByte(buffer);
            Assert.IsTrue(Communication.BasicFramework.SoftBasic.IsTwoBytesEquel(data, value));
        }
Beispiel #2
0
 /// <summary>
 /// 向寄存器中写入字符串,编码格式为ASCII
 /// </summary>
 /// <param name="address">要写入的数据地址</param>
 /// <param name="value">要写入的实际数据</param>
 /// <returns>返回写入结果</returns>
 public OperateResult Write(string address, string value)
 {
     byte[] temp = ByteTransform.TransByte(value, Encoding.ASCII);
     temp = SoftBasic.ArrayExpandToLengthEven(temp);
     return(Write(address, temp));
 }