示例#1
0
 internal PlcMemoryInfoTrigger(Object triggerValue, TriggerTypes type, string name, string description, EventMemory memoryType = EventMemory.DM,
                               UInt32 readOffset = 0, AccessSize accessSize   = AccessSize.WORD, BitPlace bitPlace = BitPlace.NOBIT,
                               bool isEnable     = true, Object constantValue = null)
     : base(name, description, memoryType, readOffset, accessSize, bitPlace, isEnable, constantValue)
 {
     TriggerValue = triggerValue;
     TriggerType  = type;
 }
示例#2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="description"></param>
        /// <param name="memoryType">CIO はBitのみ</param>
        /// <param name="readOffset"></param>
        /// <param name="accessSize">CIO はBit限定</param>
        /// <param name="isEnable"></param>
        /// <param name="bitPlace"></param>
        public PlcMemoryInfo(string name, string description, EventMemory memoryType = EventMemory.DM, UInt32 readOffset = 0, AccessSize accessSize = AccessSize.WORD, BitPlace bitPlace = BitPlace.NOBIT, bool isEnable = true, Object constantValue = null) : this()
        {
            // 初期化
            Name        = name;
            Description = description;
            MemoryType  = memoryType;
            AccessSize  = accessSize;
            IsEnable    = isEnable;
            ReadOffset  = readOffset;
            BitPlace    = bitPlace;

            ConstantValue = constantValue;
        }
示例#3
0
        // obsoleted
        private UInt32 ReadAsUInt32(EventMemory memoryType, UInt32 readOffset, AccessSize accessSize, BitPlace bitPlace = BitPlace.NOBIT)
        {
            switch (accessSize)
            {
            case AccessSize.BIT:
                return((UInt16)(HasFlags_AND(memoryType, readOffset, bitPlace) ? 0 : 1));

            case AccessSize.BYTE:
                throw new NotImplementedException("Word Access Address しか無い場合、Byte指定はあり得ない。上位/下位のどちらかが取得不能なので");

            case AccessSize.WORD:
                return(ReadAsUInt16(memoryType, readOffset));

            case AccessSize.DWORD:
                return((UInt32)(ReadAsUInt16(memoryType, readOffset) << 16) + ReadAsUInt16(memoryType, (UInt32)readOffset + 1));

            default:
                return(UInt32.MinValue);
            }
        }
示例#4
0
        /// <summary>
        /// WORD2SmallInt 未対応。obsoleted
        /// </summary>
        /// <param name="memoryType"></param>
        /// <param name="readOffset"></param>
        /// <param name="accessSize"></param>
        /// <param name="bitPlace"></param>
        /// <returns></returns>
        private string ReadAsString(EventMemory memoryType, UInt32 readOffset, AccessSize accessSize, BitPlace bitPlace = BitPlace.NOBIT)
        {
            switch (accessSize)
            {
            case AccessSize.BIT:
                return(HasFlags_AND(memoryType, readOffset, bitPlace).ToString());

            case AccessSize.BYTE:
                throw new NotImplementedException("Word Access Address しか無い場合、Byte指定はあり得ない。上位/下位のどちらかが取得不能なので");

            case AccessSize.WORD:
                return(ReadAsUInt16(memoryType, readOffset).ToString());

            case AccessSize.DWORD:
                return(ReadAsUInt16(memoryType, readOffset).ToString() + ReadAsUInt16(memoryType, readOffset + 1).ToString());

            default:
                return("illegal parameter");
            }
        }