示例#1
0
        public static int ReadAPEIOCardOutputBit(int cardNo, int cardOutputBit)//读扩展IO卡输出点
        {
            uint doValue = 0;
            bool outputStatus;
            int  result;

            DAQ_I32.DAQ_Mul_GDO_Get(DAQ_I32.DAQ_TYPE.DAQ_D3232, cardNo, ref doValue);
            outputStatus = (doValue & (1 << cardOutputBit)) != 0;
            result       = outputStatus ? 1 : 0;//返回当前点位电平状态,0或1
            return(result);
        }
示例#2
0
        public static void WriteAPEIOCardOutputBit(int cardNo, int cardDoBit, int status)//扩展IO卡输出点Set or Reset
        {
            uint doCurrentValue = 0;
            uint doValue        = 0;

            DAQ_I32.DAQ_Mul_GDO_Get(DAQ_I32.DAQ_TYPE.DAQ_D3232, cardNo, ref doCurrentValue);
            if (status == 1)//Set
            {
                doValue = (uint)(doCurrentValue | (uint)(1 << cardDoBit));
            }
            else if (status == 0)//Reset
            {
                doValue = (uint)(doCurrentValue & (4294967295 - (1 << cardDoBit)));
            }
            DAQ_I32.DAQ_Mul_GDO_Set(DAQ_I32.DAQ_TYPE.DAQ_D3232, cardNo, doValue);
        }
示例#3
0
 public static void WriteIOCard7432OutputBit(ushort cardID, ushort cardDoBit, ushort status)
 {
     if (CAMiClsVariable.strIOCard == "7432")
     {
         DASK.DO_WriteLine((ushort)CAMiClsVariable.cardRegId, 0, cardDoBit, status);
     }
     else
     {
         uint doCurrentValue = 0;
         uint doValue        = 0;
         DAQ_I32.DAQ_Mul_GDO_Get(DAQ_I32.DAQ_TYPE.DAQ_D3232, (int)cardID, ref doCurrentValue);
         if (status == 1)//Set
         {
             doValue = (uint)(doCurrentValue | (uint)(1 << cardDoBit));
         }
         else if (status == 0)//Reset
         {
             doValue = (uint)(doCurrentValue & (4294967295 - (1 << cardDoBit)));
         }
         DAQ_I32.DAQ_Mul_GDO_Set(DAQ_I32.DAQ_TYPE.DAQ_D3232, (int)cardID, doValue);
     }
 }
示例#4
0
 public static int ReadIOCard7432OutputBit(ushort cardID, int cardOutputBit)//读扩展IO卡输出点
 {
     if (CAMiClsVariable.strIOCard == "7432")
     {
         uint doValue = 0;
         bool outputBitStatus;;
         int  result;
         DASK.DO_ReadPort((ushort)CAMiClsVariable.cardRegId, 0, out doValue);
         outputBitStatus = (doValue & (1 << cardOutputBit)) != 0;
         result          = outputBitStatus ? 1 : 0;
         return(result);
     }
     else//APE IO卡
     {
         uint doValue = 0;
         bool outputStatus;
         int  result;
         DAQ_I32.DAQ_Mul_GDO_Get(DAQ_I32.DAQ_TYPE.DAQ_D3232, (int)cardID, ref doValue);
         outputStatus = (doValue & (1 << cardOutputBit)) != 0;
         result       = outputStatus ? 1 : 0;//返回当前点位电平状态,0或1
         return(result);
     }
 }