Example #1
0
 /// <summary>
 /// Primary Construtor for IO object
 /// </summary>
 /// <param name="controller"></param>
 /// <param name="id">Bit Number</param>
 /// <param name="name">Call Name</param>
 /// <param name="iotype">Sets the IO direction</param>
 public KM_IO(KM_Controller controller, int id, string name, IO_TYPE iotype)
 {
     _Controller = controller;
     _ID         = id;
     _Name       = name;
     _IOType     = iotype;
     UpdateIOType();
 }
Example #2
0
        public GPIO(ushort io_num, AXIS ax, IO_DIR dir, IO_TYPE type, string disc, IO_STA default_sta = IO_STA.NULL, bool binvert = false)
        {
            this.bInvert = binvert;
            axis         = ax;
            card         = ax.card;
            if (card != null)
            {
                m_id = (int)(card.id << 8) + (int)(io_num & 0xFF);
            }
            else
            {
                m_id = -1;
            }

            num              = io_num;
            this.dir         = dir;
            this.type        = type;
            str_disc         = disc;
            this.default_sta = default_sta;

            //check num
            if (num < 0 || ((int)type == (int)IO_TYPE.VIRTUAL_ELN && (int)type == (int)IO_TYPE.VIRTUAL_ORG) && num >= card.ax_num)
            {
                VAR.msg.AddMsg(Msg.EM_MSGTYPE.ERR, String.Format("{0} io_num {1} 超范围[{2},{3})", disc, num, 0, card.ax_num));
            }
            else
            {
                if (dir == IO_DIR.IN && (type == IO_TYPE.MT_CARD && num >= card.input_num) || (type == IO_TYPE.IO_CARD && num > card.input_num))
                {
                    VAR.msg.AddMsg(Msg.EM_MSGTYPE.ERR, String.Format("{0} io_num {1} 超范围[{2},{3}]", disc, num, 0, card.input_num));
                }
                if (dir == IO_DIR.OUT && (type == IO_TYPE.MT_CARD && num >= card.output_num) || (type == IO_TYPE.IO_CARD && num > card.output_num))
                {
                    VAR.msg.AddMsg(Msg.EM_MSGTYPE.ERR, String.Format("{0} io_num {1} 超范围[{2},{3}]", disc, num, 0, card.output_num));
                }
            }

            ChkSafe = null;

            if (card != null)
            {
                card.GPIOList.Add(this);
            }
        }
Example #3
0
 public IOEventArgs(IO_TYPE lineType, int lineNumber, bool lineON)
 {
     _lineType   = lineType;
     _lineNumber = lineNumber;
     _lineON     = lineON;
 }
Example #4
0
 /// <summary>
 /// Primary Construtor for IO object
 /// </summary>
 /// <param name="controller"></param>
 /// <param name="id">Bit Number</param>
 /// <param name="name">Call Name</param>
 /// <param name="iotype">Sets the IO direction</param>
 public KM_IO(KM_Controller controller, int id, string name, IO_TYPE iotype)
 {
     _Controller = controller;
     _ID = id;
     _Name = name;
     _IOType = iotype;
     UpdateIOType();
 }