/// <summary> /// 設定Channel輸出電壓 -10.0v ~ +10.0v /// </summary> /// <param name="channel">The Channel No</param> /// <param name="voltage">The Voltage</param> /// <returns>設定結果</returns> public bool SetVoltage(DACChannel channel, double voltage) { SetVoltageProperty(channel, voltage); double lastValue = GetVoltageProperty(channel); I16 rc = CDAC_A104.CS_mnet_ao4_set_voltage((U16)dacPara.RingNoOfCard, (U16)dacPara.SlaveIP, (byte)channel, lastValue); return(rc == 0); }
/// <summary> /// 設定所有Channel輸出電壓 -10.0v ~ +10.0v /// </summary> /// <param name="voltageCN0">The voltage of channel 0</param> /// <param name="voltageCN1">The voltage of channel 1</param> /// <param name="voltageCN2">The voltage of channel 2</param> /// <param name="voltageCN3">The voltage of channel 3</param> /// <returns>設定結果</returns> public bool SetVoltageAll(double voltageCN0, double voltageCN1, double voltageCN2, double voltageCN3) { this.VoltageCN0 = voltageCN0; this.VoltageCN1 = voltageCN1; this.VoltageCN2 = voltageCN2; this.VoltageCN3 = voltageCN3; I16 rc = CDAC_A104.CS_mnet_ao4_set_voltage_all((U16)dacPara.RingNoOfCard, (U16)dacPara.SlaveIP, this.VoltageCN0, this.VoltageCN1, this.VoltageCN2, this.VoltageCN3); return(rc == 0); }
/// <summary> /// Reset A104 DAC module /// </summary> /// <returns>the result of setting</returns> public bool ResetDAC() { I16 rc = CDAC_A104.CS_mnet_ao4_reset_DAC((U16)dacPara.RingNoOfCard, (U16)dacPara.SlaveIP); if (rc != 0) { return(false); } else { this.VoltageCN0 = 0; this.VoltageCN1 = 0; this.VoltageCN2 = 0; this.VoltageCN3 = 0; return(true); } }
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 + ")")); } }