private void slaveModuleInitialize() { uint mask = 0x00000001; uint[] deviceTable = new uint[2]; CCMNet.CS_mnet_reset_ring(RingNoOfMNet); I16 retOfGetTable = CCMNet.CS_mnet_get_ring_active_table(RingNoOfMNet, deviceTable); if (retOfGetTable != 0) { throw new Exception("Error occur when get device table !!! \n func = [_mnet_get_ring_active_table]"); } if ((deviceTable[0] == 0) && (deviceTable[1] == 0)) { throw new Exception("Can't find slave M1X1, there is not any device !!! \n func = [_mnet_get_ring_active_table, deviceTable=0]"); } for (int i = 0; i < 64; i++) { if (axisPara.SlaveIP > 63) { throw new Exception("Wrong SlaveIP, SlaveIP must less than 63!!!"); } if (axisPara.SlaveIP == i) { if (i < 32) { if ((deviceTable[0] & mask) == 0) { throw new Exception("Have not found M1X1 !!!\n" + "SlaveIP = " + axisPara.SlaveIP); } } else { if (i == 32) { mask = 0x00000001; } if ((deviceTable[1] & mask) == 0) { throw new Exception("Have not found M1X1 !!!\n" + "SlaveIP = " + axisPara.SlaveIP); } } } mask = mask << 1; } I16 retOfStartRing = CCMNet.CS_mnet_start_ring(RingNoOfMNet); if (retOfStartRing != 0) { throw new Exception("Error occur when start ring !!! \n func = [_mnet_start_ring]"); } U8 slaveType = 0; I16 retOfGetSlaveType = CCMNet.CS_mnet_get_slave_type(RingNoOfMNet, axisPara.SlaveIP, ref slaveType); if (retOfGetSlaveType == 0) { if (slaveType != 0xA3) { throw new Exception("deviec type is not M1X1!!!\n" + "SlaveIP = " + axisPara.SlaveIP); } } else { throw new Exception("Error occur when get device type !!! \n func = [_mnet_get_slave_type]"); } I16 retOfInitial = CCMNet.CS_mnet_m1_initial(RingNoOfMNet, axisPara.SlaveIP); if (retOfInitial != 0) { throw new Exception("Error occur when M1X1 module initial !!! \n func = [_mnet_m1_initial]"); } }
private void slaveModuleInitialize() { uint mask = 0x00000001; uint[] deviceTable = DeviceTable; if ((deviceTable[0] == 0) && (deviceTable[1] == 0)) { throw new Exception("Can't find slave A180, there is not any device !!! \n func = [_mnet_get_ring_active_table, deviceTable=0]"); } for (int i = 0; i < 64; i++) { if (adcPara.SlaveIP > 63) { throw new Exception("Wrong SlaveIP, SlaveIP must less than 63!!!"); } if (adcPara.SlaveIP == i) { if (i < 32) { if ((deviceTable[0] & mask) == 0) { throw new Exception("Have not found A180 !!!\n" + "SlaveIP = " + adcPara.SlaveIP); } } else { if (i == 32) { mask = 0x00000001; } if ((deviceTable[1] & mask) == 0) { throw new Exception("Have not found A180 !!!\n" + "SlaveIP = " + adcPara.SlaveIP); } } } mask = mask << 1; } I16 retOfStartRing = CCMNet.CS_mnet_start_ring(RingNoOfMNet); if (retOfStartRing != 0) { throw new Exception("Error occur when start ring !!! \n func = [_mnet_start_ring]"); } U8 slaveType = 0; I16 retOfGetSlaveType = CCMNet.CS_mnet_get_slave_type(RingNoOfMNet, adcPara.SlaveIP, ref slaveType); if (retOfGetSlaveType == 0) { if (slaveType != 0xD1) { throw new Exception("deviec type is not A180!!!\n" + "SlaveIP = " + adcPara.SlaveIP); } } else { throw new Exception("Error occur when get device type !!! \n func = [_mnet_get_slave_type]"); } I16 rc = CADC_A180.CS_mnet_ai8_initial((U16)adcPara.CardSwitchNo, (U16)adcPara.SlaveIP); if (rc != 0) { throw new Exception(ExceptionHelper.GetFullCurrentMethod(LanguageResourceManager.GetString("InitializeErrorA180ADC") + "(" + DeviceName + ")")); } rc = CADC_A180.CS_mnet_ai8_set_cycle_time((U16)adcPara.CardSwitchNo, (U16)adcPara.SlaveIP, 0); if (rc != 0) { throw new Exception(ExceptionHelper.GetFullCurrentMethod(LanguageResourceManager.GetString("SetCycleErrorA180ADC") + "(" + DeviceName + ")")); } }
private void slaveModuleInitialize() { uint mask = 0x00000001; uint[] deviceTable = DeviceTable; if ((deviceTable[0] == 0) && (deviceTable[1] == 0)) { throw new Exception("Can't find slave A104, there is not any device !!! \n func = [_mnet_get_ring_active_table, deviceTable=0]"); } for (int i = 0; i < 64; i++) { if (dacPara.SlaveIP > 63) { throw new Exception("Wrong SlaveIP, SlaveIP must less than 63!!!"); } if (dacPara.SlaveIP == i) { if (i < 32) { if ((deviceTable[0] & mask) == 0) { throw new Exception("Have not found A104 !!!\n" + "SlaveIP = " + dacPara.SlaveIP); } } else { if (i == 32) { mask = 0x00000001; } if ((deviceTable[1] & mask) == 0) { throw new Exception("Have not found A104 !!!\n" + "SlaveIP = " + dacPara.SlaveIP); } } } mask = mask << 1; } I16 retOfStartRing = CCMNet.CS_mnet_start_ring(RingNoOfMNet); if (retOfStartRing != 0) { throw new Exception("Error occur when start ring !!! \n func = [_mnet_start_ring]"); } U8 slaveType = 0; I16 retOfGetSlaveType = CCMNet.CS_mnet_get_slave_type(RingNoOfMNet, dacPara.SlaveIP, ref slaveType); if (retOfGetSlaveType == 0) { if (slaveType != 0xD0) { throw new Exception("deviec type is not A104!!!\n" + "SlaveIP = " + dacPara.SlaveIP); } } else { throw new Exception("Error occur when get device type !!! \n func = [_mnet_get_slave_type]"); } I16 retOfInitial = CDAC_A104.CS_mnet_ao4_initial((U16)dacPara.RingNoOfCard, (U16)dacPara.SlaveIP); if (retOfInitial != 0) { throw new Exception(ExceptionHelper.GetFullCurrentMethod(ResourceHelper.Language.GetString("InitializeErrorA104DAC") + "(" + DeviceName + ")")); } }
private void slaveModuleInitialize() { uint mask = 0x00000001; uint[] deviceTable = DeviceTable; //CCMNet.CS_mnet_reset_ring(RingNoOfMNet); //Stopwatch sw = Stopwatch.StartNew(); //I16 retOfGetTable = CCMNet.CS_mnet_get_ring_active_table(RingNoOfMNet, deviceTable); //Console.WriteLine("{0}, {1}", deviceTable[0], deviceTable[1]); //sw.Stop(); //Console.WriteLine("{0} CS_mnet_get_ring_active_table {1}", this.DeviceName, sw.ElapsedMilliseconds); //if (retOfGetTable != 0) //{ // throw new Exception("Error occur when get device table !!! \n func = [_mnet_get_ring_active_table]"); //} if ((deviceTable[0] == 0) && (deviceTable[1] == 0)) { throw new Exception("Can't find slave M2X4, there is not any device !!! \n func = [_mnet_get_ring_active_table, deviceTable=0]"); } for (int i = 0; i < 64; i++) { if (axisPara.SlaveIP > 63) { throw new Exception("Wrong SlaveIP, SlaveIP must less than 63!!!"); } if (axisPara.SlaveIP == i) { if (i < 32) { if ((deviceTable[0] & mask) == 0) { throw new Exception("Have not found M2X4 !!!\n" + "SlaveIP = " + axisPara.SlaveIP); } } else { if (i == 32) { mask = 0x00000001; } if ((deviceTable[1] & mask) == 0) { throw new Exception("Have not found M2X4 !!!\n" + "SlaveIP = " + axisPara.SlaveIP); } } } mask = mask << 1; } I16 retOfStartRing = CCMNet.CS_mnet_start_ring(RingNoOfMNet); if (retOfStartRing != 0) { throw new Exception("Error occur when start ring !!! \n func = [_mnet_start_ring]"); } U8 slaveType = 0; I16 retOfGetSlaveType = CCMNet.CS_mnet_get_slave_type(RingNoOfMNet, axisPara.SlaveIP, ref slaveType); if (retOfGetSlaveType == 0) { if (slaveType != 0xA7) { throw new Exception("deviec type is not M2X4!!!\n" + "SlaveIP = " + axisPara.SlaveIP); } } else { throw new Exception("Error occur when get device type !!! \n func = [_mnet_get_slave_type]"); } I16 retOfInitial = CCMNet.CS_mnet_m204_initial(RingNoOfMNet, axisPara.SlaveIP); if (retOfInitial != 0) { throw new Exception("Error occur when M2X4 module initial !!! \n func = [_mnet_m1_initial]"); } }