public static int ReadAPEIOCardInputBit(int cardNo, int cardInputBit)//读扩展IO卡输入点 { uint diValue = 0; bool inputBitStatus; int result; DAQ_I32.DAQ_Mul_GDI_Get(DAQ_I32.DAQ_TYPE.DAQ_D3232, cardNo, ref diValue); inputBitStatus = (diValue & (1 << cardInputBit)) != 0; result = inputBitStatus ? 1 : 0;//返回当前点位电平状态,0或1 return(result); }
public static int ReadIOCard7432InputBit(ushort cardID, int cardInputBit)//读扩展IO卡输入点 { if (CAMiClsVariable.strIOCard == "7432") { uint diValue = 0; bool inputBitStatus; int result; DASK.DI_ReadPort((ushort)CAMiClsVariable.cardRegId, 0, out diValue); inputBitStatus = (diValue & (1 << cardInputBit)) != 0; result = inputBitStatus ? 1 : 0; return(result); } else //APE IO卡 { uint diValue = 0; bool inputBitStatus; int result; DAQ_I32.DAQ_Mul_GDI_Get(DAQ_I32.DAQ_TYPE.DAQ_D3232, (int)cardID, ref diValue); inputBitStatus = (diValue & (1 << cardInputBit)) != 0; result = inputBitStatus ? 1 : 0;//返回当前点位电平状态,0或1 return(result); } }