//scan m1x1 slave IO status private void systemScan() { while (true) { if (keyOfIOStatus) { U32 status = 0; I16 rt = CMNET_L132.CS_mnet_m1_get_io_status((U16)axisPara.CardSwitchNo, (U16)axisPara.RingNoOfCard, axisPara.SlaveIP, ref status); this.status.RDY = BitConverterEx.TestB(status, 0); this.status.ALM = BitConverterEx.TestB(status, 1); this.status.LimitP = BitConverterEx.TestB(status, 2); this.status.LimitN = BitConverterEx.TestB(status, 3); this.status.ORG = BitConverterEx.TestB(status, 4); this.status.DIR = BitConverterEx.TestB(status, 5); this.status.EMG = BitConverterEx.TestB(status, 6); this.status.PCS = BitConverterEx.TestB(status, 7); this.status.ERC = BitConverterEx.TestB(status, 8); this.status.ZPhase = BitConverterEx.TestB(status, 9); this.status.CLR = BitConverterEx.TestB(status, 10); this.status.Latch = BitConverterEx.TestB(status, 11); this.status.SD = BitConverterEx.TestB(status, 12); this.status.INP = BitConverterEx.TestB(status, 13); this.status.SVON = BitConverterEx.TestB(status, 14); this.status.RALM = BitConverterEx.TestB(status, 15); if (this.status.ALM || this.status.EMG) { this.status.Home = false; } Thread.Sleep(50); } } }
private void masterCardInitialize() { Thread.Sleep(100); I16 rc; U16 ringStatus = 0; int getRingStatusRt = CMNET_L132.CS_mnet_get_ring_status((U16)Parameter.CardSwitchNo, (U16)Parameter.RingNoOfCard, ref ringStatus); if (getRingStatusRt != 0) { I16 exitsCard = 0; CPCI_L132.CS_l132_open(ref exitsCard); if (exitsCard == 0) { throw new Exception(ExceptionHelper.GetFullCurrentMethod(ResourceHelper.Language.GetString("DidntFindL132"))); } Thread.Sleep(30); rc = CPCI_L132.CS_l132_dsp_pci_boot((U16)Parameter.CardSwitchNo); Thread.Sleep(30); rc = CMNET_L132.CS_mnet_initial((U16)Parameter.CardSwitchNo, (U16)Parameter.RingNoOfCard); if (rc != 0) { throw new Exception(ExceptionHelper.GetFullCurrentMethod(ResourceHelper.Language.GetString("InitializeErrorL132"))); } } Thread.Sleep(30); rc = CMNET_L132.CS_mnet_reset_ring((U16)Parameter.CardSwitchNo, (U16)Parameter.RingNoOfCard); Thread.Sleep(30); rc = CMNET_L132.CS_mnet_start_ring((U16)Parameter.CardSwitchNo, (U16)Parameter.RingNoOfCard); if (rc != 0) { throw new Exception(ExceptionHelper.GetFullCurrentMethod(ResourceHelper.Language.GetString("StartupErrorL132"))); } }
public bool SetSoftLimit(I32 positiveLimit, I32 negativeLimit, CmdStatus sw, StopType stopType) { I16 rc = -1; if (axisPara.IsActive && axisPara.Enabled) { if (sw == CmdStatus.ON) { /* * 0 INT only * 1 Immediately stop * 2 Slow down then stop * 3 Reserved */ if (stopType == StopType.Emergency) { rc = CMNET_L132.CS_mnet_m1_enable_soft_limit((U16)axisPara.CardSwitchNo, (U16)axisPara.RingNoOfCard, axisPara.SlaveIP, 1); } else { rc = CMNET_L132.CS_mnet_m1_enable_soft_limit((U16)axisPara.CardSwitchNo, (U16)axisPara.RingNoOfCard, axisPara.SlaveIP, 2); } rc = CMNET_L132.CS_mnet_m1_set_soft_limit((U16)axisPara.CardSwitchNo, (U16)axisPara.RingNoOfCard, axisPara.SlaveIP, positiveLimit, negativeLimit); } else { rc = CMNET_L132.CS_mnet_m1_disable_soft_limit((U16)axisPara.CardSwitchNo, (U16)axisPara.RingNoOfCard, axisPara.SlaveIP); } } return(rc == 0 ? true : false); }
/// <summary> /// 吋動 (自定義速度,初速為恆速1/2,加速度減速度為軸參手動設定) /// </summary> /// <param name="speed">速度值 (millimeter).</param> /// <param name="dir">吋動方向</param> public void JogM(double speed, RotationDirection dir) { byte bDir; if (dir == RotationDirection.CW) { bDir = 1; } else { bDir = 0; } if (axisPara.IsActive && axisPara.Enabled) { int i = MmToPulse(speed); CMNET_L132.CS_mnet_m1_set_tmove_speed((U16)axisPara.CardSwitchNo, (U16)axisPara.RingNoOfCard, axisPara.SlaveIP, i / 2, i, axisPara.AccVelM, axisPara.DecVelM); CMNET_L132.CS_mnet_m1_v_move((U16)axisPara.CardSwitchNo, (U16)axisPara.RingNoOfCard, axisPara.SlaveIP, bDir); /* * //不確定速度設定與速度移動是否有先後順序,所以才這樣寫。 * if (!this.IsBusy) * { * CMNET_L132.CS_mnet_m1_set_tmove_speed((U16)axisPara.CardSwitchNo, (U16)axisPara.RingNoOfCard, axisPara.SlaveIP, i / 2, i, axisPara.AccVelM, axisPara.DecVelM); * } * else * { * CMNET_L132.CS_mnet_m1_v_change((U16)axisPara.CardSwitchNo, (U16)axisPara.RingNoOfCard, axisPara.SlaveIP, (double)i, 0.1); * } * if (!this.IsBusy) * { * CMNET_L132.CS_mnet_m1_v_move((U16)axisPara.CardSwitchNo, (U16)axisPara.RingNoOfCard, axisPara.SlaveIP, bDir); * }*/ } }
/// <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> /// 清除警報 /// </summary> /// <param name="status">OFF=Don't Output ON=Output</param> public void ResetAlarm(CmdStatus status) { if (axisPara.IsActive && axisPara.Enabled) { CMNET_L132.CS_mnet_m1_set_ralm((U16)axisPara.CardSwitchNo, (U16)axisPara.RingNoOfCard, axisPara.SlaveIP, (U16)status); } }
//將軸參寫入m1x1 slave private void setMotion() { U16 hMode; //初始化給1 且限制在 1~3,這邊又把home mode變成12 or 9 if (axisPara.HomeMode == HomeMode.TwoPoint) { hMode = 12; } else { hMode = 9; } initErr = CMNET_L132.CS_mnet_m1_set_alm((U16)axisPara.CardSwitchNo, (U16)axisPara.RingNoOfCard, axisPara.SlaveIP, Convert.ToUInt16(axisPara.LogicALM), 0); initErr = CMNET_L132.CS_mnet_m1_set_inp((U16)axisPara.CardSwitchNo, (U16)axisPara.RingNoOfCard, axisPara.SlaveIP, 0, Convert.ToUInt16(axisPara.LogicINP)); initErr = CMNET_L132.CS_mnet_m1_set_erc((U16)axisPara.CardSwitchNo, (U16)axisPara.RingNoOfCard, axisPara.SlaveIP, Convert.ToUInt16(axisPara.LogicERC), 0, 0); initErr = CMNET_L132.CS_mnet_m1_set_home_config((U16)axisPara.CardSwitchNo, (U16)axisPara.RingNoOfCard, axisPara.SlaveIP, hMode, Convert.ToUInt16(axisPara.LogicORG), Convert.ToUInt16(axisPara.LogicZ), 0, 0); initErr = CMNET_L132.CS_mnet_m1_set_sd((U16)axisPara.CardSwitchNo, (U16)axisPara.RingNoOfCard, axisPara.SlaveIP, 0, Convert.ToUInt16(axisPara.LogicSD), 0, 0); initErr = CMNET_L132.CS_mnet_m1_set_ltc_logic((U16)axisPara.CardSwitchNo, (U16)axisPara.RingNoOfCard, axisPara.SlaveIP, Convert.ToUInt16(axisPara.LogicLTC)); initErr = CMNET_L132.CS_mnet_m1_set_feedback_src((U16)axisPara.CardSwitchNo, (U16)axisPara.RingNoOfCard, axisPara.SlaveIP, 3); initErr = CMNET_L132.CS_mnet_m1_set_pls_outmode((U16)axisPara.CardSwitchNo, (U16)axisPara.RingNoOfCard, axisPara.SlaveIP, (U16)axisPara.PulseMode); initErr = CMNET_L132.CS_mnet_m1_set_pls_iptmode((U16)axisPara.CardSwitchNo, (U16)axisPara.RingNoOfCard, axisPara.SlaveIP, (U16)axisPara.EncMode, (U16)axisPara.EncDir); initErr = CMNET_L132.CS_mnet_m1_fix_speed_range((U16)axisPara.CardSwitchNo, (U16)axisPara.RingNoOfCard, axisPara.SlaveIP, MmToPulse(axisPara.MaxVel)); }
/// <summary> /// 絕對移動 (需要自定義速度,初速為恆速1/2,加速度減速度為軸參手動設定) /// </summary> /// <param name="dest">目標位置 (millimeter).</param> /// <param name="speed"> 速度值 </param> public void MoveM(double dest, double speed) { if (axisPara.IsActive && axisPara.Enabled) { CMNET_L132.CS_mnet_m1_set_tmove_speed((U16)axisPara.CardSwitchNo, (U16)axisPara.RingNoOfCard, axisPara.SlaveIP, MmToPulse(speed) / 2, MmToPulse(speed), axisPara.AccVelM, axisPara.DecVelM); nPos = MmToPulse(dest); CMNET_L132.CS_mnet_m1_start_a_move((U16)axisPara.CardSwitchNo, (U16)axisPara.RingNoOfCard, axisPara.SlaveIP, nPos); } }
public bool DisableSoftLimit() { I16 rc = -1; if (axisPara.IsActive && axisPara.Enabled) { rc = CMNET_L132.CS_mnet_m1_disable_soft_limit((U16)axisPara.CardSwitchNo, (U16)axisPara.RingNoOfCard, axisPara.SlaveIP); } return(rc == 0 ? true : false); }
private void doHomeLim() { //if (axisPara.IsActive && axisPara.Enabled ) //{ // CMNET_L132.CS_mnet_m1_set_home_config((U16)axisPara.CardSwitchNo, (U16)axisPara.RingNoOfCard, axisPara.SlaveIP, 6, Convert.ToUInt16(axisPara.LogicORG), Convert.ToUInt16(axisPara.LogicZ), 0, 0); // CMNET_L132.CS_mnet_m1_set_tmove_speed((U16)axisPara.CardSwitchNo, (U16)axisPara.RingNoOfCard, axisPara.SlaveIP, 0, MmToPulse(axisPara.CreepDevVelH), axisPara.CreepAccVelH, axisPara.CreepDecVelH); // CMNET_L132.CS_mnet_m1_start_home_move((U16)axisPara.CardSwitchNo, (U16)axisPara.RingNoOfCard, axisPara.SlaveIP, 0); //} CMNET_L132.CS_mnet_m1_set_home_config((U16)axisPara.CardSwitchNo, (U16)axisPara.RingNoOfCard, axisPara.SlaveIP, 6, Convert.ToUInt16(axisPara.LogicORG), Convert.ToUInt16(axisPara.LogicZ), 0, 0); CMNET_L132.CS_mnet_m1_set_tmove_speed((U16)axisPara.CardSwitchNo, (U16)axisPara.RingNoOfCard, axisPara.SlaveIP, 0, MmToPulse(axisPara.CreepDevVelH), axisPara.CreepAccVelH, axisPara.CreepDecVelH); CMNET_L132.CS_mnet_m1_start_home_move((U16)axisPara.CardSwitchNo, (U16)axisPara.RingNoOfCard, axisPara.SlaveIP, 0); }
//set command counter private void setPos(double s) { //if (axisPara.IsActive && axisPara.Enabled ) //{ // int cmdPos = new int(); // cmdPos = Convert.ToInt32(Math.Round(s / axisPara.DistPerRole * axisPara.PulsePerRole)); // CMNET_L132.CS_mnet_m1_set_command((U16)axisPara.CardSwitchNo, (U16)axisPara.RingNoOfCard, axisPara.SlaveIP, cmdPos); //} int cmdPos = new int(); cmdPos = Convert.ToInt32(Math.Round(s / axisPara.DistPerRole * axisPara.PulsePerRole)); CMNET_L132.CS_mnet_m1_set_command((U16)axisPara.CardSwitchNo, (U16)axisPara.RingNoOfCard, axisPara.SlaveIP, cmdPos); }
/// <summary> /// 絕對移動 (需選擇使用軸參的手動速度或是自動速度) /// </summary> /// <param name="dest">目標位置 (millimeter).</param> /// <param name="inAuto">手動或自動速度</param> public void Move(double dest, SpeedMode inAuto) { if (axisPara.IsActive && axisPara.Enabled) { if (inAuto == SpeedMode.Manual) { CMNET_L132.CS_mnet_m1_set_tmove_speed((U16)axisPara.CardSwitchNo, (U16)axisPara.RingNoOfCard, axisPara.SlaveIP, MmToPulse(axisPara.StrVelM), MmToPulse(axisPara.DevVelM), axisPara.AccVelM, axisPara.DecVelM); } if (inAuto == SpeedMode.Auto) { CMNET_L132.CS_mnet_m1_set_tmove_speed((U16)axisPara.CardSwitchNo, (U16)axisPara.RingNoOfCard, axisPara.SlaveIP, MmToPulse(axisPara.StrVelA), MmToPulse(axisPara.DevVelA), axisPara.AccVelA, axisPara.DecVelA); } nPos = MmToPulse(dest); CMNET_L132.CS_mnet_m1_start_a_move((U16)axisPara.CardSwitchNo, (U16)axisPara.RingNoOfCard, axisPara.SlaveIP, nPos); } }
public bool EnableSoftLimit(StopType stopType) { I16 rc = -1; if (axisPara.IsActive && axisPara.Enabled) { if (stopType == StopType.Emergency) { rc = CMNET_L132.CS_mnet_m1_enable_soft_limit((U16)axisPara.CardSwitchNo, (U16)axisPara.RingNoOfCard, axisPara.SlaveIP, 1); } else { rc = CMNET_L132.CS_mnet_m1_enable_soft_limit((U16)axisPara.CardSwitchNo, (U16)axisPara.RingNoOfCard, axisPara.SlaveIP, 2); } } return(rc == 0 ? true : false); }
///// <summary> ///// 停止M1X1裝置 (復歸流程中使用,不停止homeTask) ///// </summary> //public void Stop(StopType type) //{ // if (type == StopType.Emergency) // { // CMNET_L132.CS_mnet_m1_emg_stop((U16)axisPara.CardSwitchNo, (U16)axisPara.RingNoOfCard, axisPara.SlaveIP); // } // if (type == StopType.SlowDown) // { // CMNET_L132.CS_mnet_m1_sd_stop((U16)axisPara.CardSwitchNo, (U16)axisPara.RingNoOfCard, axisPara.SlaveIP); // } //} /// <summary> /// 停止M1X1裝置 (復歸流程中不停止homeTask) /// </summary> public void Stop(StopType type, bool isStopTask) { if (axisPara.IsActive && axisPara.Enabled) { if (type == StopType.Emergency) { CMNET_L132.CS_mnet_m1_emg_stop((U16)axisPara.CardSwitchNo, (U16)axisPara.RingNoOfCard, axisPara.SlaveIP); } if (type == StopType.SlowDown) { CMNET_L132.CS_mnet_m1_sd_stop((U16)axisPara.CardSwitchNo, (U16)axisPara.RingNoOfCard, axisPara.SlaveIP); } if (isStopTask) { itemHome.TProcVar.Step1 = 9000; homeTask.TurnOffAll(); } } }
/// <summary> /// 吋動 (軸參設定的五個速度值) /// </summary> /// <param name="speedIndex">軸參之吋動速度</param> /// <param name="dir">吋動方向</param> public void Jog(JogSpeed jogSpeed, RotationDirection dir) { byte bDir; if (dir == RotationDirection.CW) { bDir = 1; } else { bDir = 0; } if (axisPara.IsActive && axisPara.Enabled) { double speed = 0; int i = 0; switch (jogSpeed) { case JogSpeed.Micro: speed = axisPara.JogMicroSpeed; break; case JogSpeed.Low: speed = axisPara.JogLowSpeed; break; case JogSpeed.Mid: speed = axisPara.JogMidSpeed; break; case JogSpeed.High: speed = axisPara.JogHighSpeed; break; case JogSpeed.Max: speed = axisPara.JogMaxSpeed; break; } i = MmToPulse(speed); CMNET_L132.CS_mnet_m1_set_tmove_speed((U16)axisPara.CardSwitchNo, (U16)axisPara.RingNoOfCard, axisPara.SlaveIP, i / 2, i, axisPara.AccVelM, axisPara.DecVelM); CMNET_L132.CS_mnet_m1_v_move((U16)axisPara.CardSwitchNo, (U16)axisPara.RingNoOfCard, axisPara.SlaveIP, bDir); } }
//scan DIO slave status private void systemScan() { while (true) { if (keyOfIOScan) { I16 status; U8 val = 0; for (byte portNo = 0; portNo < 4; portNo++) { status = CMNET_L132.CS_mnet_io_input((U16)dIOPara.CardSwitchNo, (U16)dIOPara.RingNoOfCard, dIOPara.SlaveIP, portNo, ref val); for (int i = 0; i < 8; i++) { Status1[portNo * 8 + i] = BitConverterEx.TestB(val, (byte)i); Status2[portNo, i] = BitConverterEx.TestB(val, (byte)i); } } Thread.Sleep(15); } } }
/// <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); } }
/// <summary> /// M1X1 裝置啟停 /// </summary> /// <param name="option">The option.</param> public void ServoOn(CmdStatus option) { if (axisPara != null) { if (axisPara.IsActive) { if (option == CmdStatus.OFF) { status.Home = false; axisPara.Enabled = false; CMNET_L132.CS_mnet_m1_set_svon((U16)axisPara.CardSwitchNo, (U16)axisPara.RingNoOfCard, axisPara.SlaveIP, 0); } if (option == CmdStatus.ON) { if (axisPara.IsActive) { axisPara.Enabled = true; CMNET_L132.CS_mnet_m1_set_svon((U16)axisPara.CardSwitchNo, (U16)axisPara.RingNoOfCard, axisPara.SlaveIP, 1); CMNET_L132.CS_mnet_m1_disable_soft_limit((U16)axisPara.CardSwitchNo, (U16)axisPara.RingNoOfCard, axisPara.SlaveIP); } } } } }
//get command counter private double getPos() { int cmdPos = new int(); double CmdPosx; CMNET_L132.CS_mnet_m1_get_command((U16)axisPara.CardSwitchNo, (U16)axisPara.RingNoOfCard, axisPara.SlaveIP, ref cmdPos); CmdPosx = cmdPos; if (axisPara.PulsePerRole != 0) { //if (axisPara.IsActive && axisPara.Enabled ) //{ // return CmdPosx / axisPara.PulsePerRole * axisPara.DistPerRole; //} //else //{ // return 0; //} return(CmdPosx / axisPara.PulsePerRole * axisPara.DistPerRole); } else { return(0); } }
private void slaveModuleInitialize() { I16 rc; uint mask = 0x00000001; uint[] deviceTable = new uint[2]; rc = CMNET_L132.CS_mnet_get_ring_active_table((U16)dacPara.CardSwitchNo, (U16)dacPara.RingNoOfCard, ref deviceTable[0]); if (rc != 0) { throw new Exception(ExceptionHelper.GetFullCurrentMethod(ResourceHelper.Language.GetString("DeviceTableError") + "(" + DeviceName + ")")); } if ((deviceTable[0] == 0) && (deviceTable[1] == 0)) { throw new Exception(ExceptionHelper.GetFullCurrentMethod(ResourceHelper.Language.GetString("DidntFindA104DAC") + "(" + DeviceName + ")")); } for (int i = 0; i < 64; i++) { if (dacPara.SlaveIP > 63) { throw new Exception(ExceptionHelper.GetFullCurrentMethod(ResourceHelper.Language.GetString("WrongSlaveIP") + "(" + DeviceName + ")")); } if (dacPara.SlaveIP == i) { if (i < 32) { if ((deviceTable[0] & mask) == 0) { throw new Exception(ExceptionHelper.GetFullCurrentMethod(ResourceHelper.Language.GetString("WrongSlaveIP") + "(" + DeviceName + ")")); } } else { if (i == 32) { mask = 0x00000001; } if ((deviceTable[1] & mask) == 0) { throw new Exception(ExceptionHelper.GetFullCurrentMethod(ResourceHelper.Language.GetString("WrongSlaveIP") + "(" + DeviceName + ")")); } } } mask = mask << 1; } U8 slaveType = 0; rc = CMNET_L132.CS_mnet_get_slave_type((U16)dacPara.CardSwitchNo, (U16)dacPara.RingNoOfCard, (U16)dacPara.SlaveIP, ref slaveType); if (rc == 0) { if (slaveType != 0xD0) { throw new Exception(ExceptionHelper.GetFullCurrentMethod(ResourceHelper.Language.GetString("WrongDeviceTypeA104DAC") + "(" + DeviceName + ")")); } } else { throw new Exception(ExceptionHelper.GetFullCurrentMethod(ResourceHelper.Language.GetString("DeviceTableError") + "(" + DeviceName + ")")); } rc = CA104_L132.CS_mnet_ao4_initial((U16)dacPara.CardSwitchNo, (U16)dacPara.RingNoOfCard, (U16)dacPara.SlaveIP); if (rc != 0) { throw new Exception(ExceptionHelper.GetFullCurrentMethod(ResourceHelper.Language.GetString("InitializeErrorA104DAC") + "(" + DeviceName + ")")); } }
/// <summary> /// 清除postion和command的counter /// </summary> public void ResetPos() { CMNET_L132.CS_mnet_m1_reset_position((U16)axisPara.CardSwitchNo, (U16)axisPara.RingNoOfCard, axisPara.SlaveIP); CMNET_L132.CS_mnet_m1_reset_command((U16)axisPara.CardSwitchNo, (U16)axisPara.RingNoOfCard, axisPara.SlaveIP); }
private void slaveModuleInitialize() { uint mask = 0x00000001; uint[] deviceTable = new uint[2]; I16 retOfGetTable = CMNET_L132.CS_mnet_get_ring_active_table((U16)axisPara.CardSwitchNo, (U16)axisPara.RingNoOfCard, ref deviceTable[0]); if (retOfGetTable != 0) { throw new Exception(ExceptionHelper.GetFullCurrentMethod(ResourceHelper.Language.GetString("DeviceTableError") + "(" + DeviceName + ")")); } if ((deviceTable[0] == 0) && (deviceTable[1] == 0)) { throw new Exception(ExceptionHelper.GetFullCurrentMethod(ResourceHelper.Language.GetString("DidntFindM1X1") + "(" + DeviceName + ")")); } for (int i = 0; i < 64; i++) { if (axisPara.SlaveIP > 63) { throw new Exception(ExceptionHelper.GetFullCurrentMethod(ResourceHelper.Language.GetString("WrongSlaveIP") + "(" + DeviceName + ")")); } if (axisPara.SlaveIP == i) { if (i < 32) { if ((deviceTable[0] & mask) == 0) { throw new Exception(ExceptionHelper.GetFullCurrentMethod(ResourceHelper.Language.GetString("WrongSlaveIP") + "(" + DeviceName + ")")); } } else { if (i == 32) { mask = 0x00000001; } if ((deviceTable[1] & mask) == 0) { throw new Exception(ExceptionHelper.GetFullCurrentMethod(ResourceHelper.Language.GetString("WrongSlaveIP") + "(" + DeviceName + ")")); } } } mask = mask << 1; } I16 retOfStartRing = CMNET_L132.CS_mnet_start_ring((U16)axisPara.CardSwitchNo, (U16)axisPara.RingNoOfCard); if (retOfStartRing != 0) { throw new Exception(ExceptionHelper.GetFullCurrentMethod(ResourceHelper.Language.GetString("StartCommError") + "(" + DeviceName + ")")); } U8 slaveType = 0; I16 retOfGetSlaveType = CMNET_L132.CS_mnet_get_slave_type((U16)axisPara.CardSwitchNo, (U16)axisPara.RingNoOfCard, axisPara.SlaveIP, ref slaveType); if (retOfGetSlaveType == 0) { if (slaveType != 0xA3) { throw new Exception(ExceptionHelper.GetFullCurrentMethod(ResourceHelper.Language.GetString("WrongDeviceTypeM1X1") + "(" + DeviceName + ")")); } } else { throw new Exception(ExceptionHelper.GetFullCurrentMethod(ResourceHelper.Language.GetString("DeviceTableError") + "(" + DeviceName + ")")); } I16 retOfInitial = CMNET_L132.CS_mnet_m1_initial((U16)axisPara.CardSwitchNo, (U16)axisPara.RingNoOfCard, axisPara.SlaveIP); if (retOfInitial != 0) { throw new Exception(ExceptionHelper.GetFullCurrentMethod(ResourceHelper.Language.GetString("InitializeErrorM1X1") + "(" + DeviceName + ")")); } }