/// <summary> /// 清除所有DO點狀態 /// </summary> public void ClearAllOutput() { CMNET_L132.CS_mnet_io_output((U16)dIOPara.CardSwitchNo, (U16)dIOPara.RingNoOfCard, dIOPara.SlaveIP, 0, 0); CMNET_L132.CS_mnet_io_output((U16)dIOPara.CardSwitchNo, (U16)dIOPara.RingNoOfCard, dIOPara.SlaveIP, 1, 0); CMNET_L132.CS_mnet_io_output((U16)dIOPara.CardSwitchNo, (U16)dIOPara.RingNoOfCard, dIOPara.SlaveIP, 2, 0); CMNET_L132.CS_mnet_io_output((U16)dIOPara.CardSwitchNo, (U16)dIOPara.RingNoOfCard, dIOPara.SlaveIP, 3, 0); }
/// <summary> /// 設定Output數值 /// </summary> /// <param name="portNo">Port Number</param> /// <param name="bitNo">Bit Number</param> /// <param name="status">寫入成功回傳true,反之false(DI點一定false)</param> /// <returns></returns> public bool SetOutput2(PortNo portNo, BitNo bitNo, bool status) { if (dIOPara.IsActive) { U8 val = 0; CMNET_L132.CS_mnet_io_input((U16)dIOPara.CardSwitchNo, (U16)dIOPara.RingNoOfCard, dIOPara.SlaveIP, (U8)portNo, ref val); BitConverterEx.SetBit(ref val, (byte)bitNo, status); I16 retOfSetOutput = CMNET_L132.CS_mnet_io_output((U16)dIOPara.CardSwitchNo, (U16)dIOPara.RingNoOfCard, dIOPara.SlaveIP, (U8)portNo, val); if (retOfSetOutput >= 0) { return(true); } else { return(false); } } else { return(false); } }