InputRegister.cs 1.0 KB
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DL.Com.Protocol.Modbus
{
    /// <summary>
    /// 输入寄存器
    /// 支持的功能码0x04
    /// </summary>
    public class InputRegister : Register
    {
        public InputRegister() : base()
        {
            FunctionCodes.Add(RegisterFunction.Read, 0x04);
        }
        /// <summary>
        /// PLC地址
        /// </summary>
        public new string PLCAddress
        {
            get { return $"3{FrameStruct.PDU.Data.Addr.GetIntValue()}"; }
        }

        protected override bool ParseWriteMultiple(byte[] response)
        {
            throw new NotImplementedException();
        }

        protected override bool ParseWriteSingle(byte[] response)
        {
            throw new NotImplementedException();
        }

        protected override void SetParamPDU(CmdByte cmdByte)
        {
            SetPDU(RegisterFunction.Read, cmdByte.StartAddr, cmdByte.Count);
        }
    }
}