private void InitDriverChannel(AnalogInChannelsEnum ChannelName, out AgilentU254xAnalogInChannel channel) { lock (initDriverChannelLock) { switch (ChannelName) { case AnalogInChannelsEnum.AIn1: channel = _driver.AnalogIn.Channels.get_Item(ChannelNamesEnum.AIN1); break; case AnalogInChannelsEnum.AIn2: channel = _driver.AnalogIn.Channels.get_Item(ChannelNamesEnum.AIN2); break; case AnalogInChannelsEnum.AIn3: channel = _driver.AnalogIn.Channels.get_Item(ChannelNamesEnum.AIN3); break; case AnalogInChannelsEnum.AIn4: channel = _driver.AnalogIn.Channels.get_Item(ChannelNamesEnum.AIN4); break; default: throw new ArgumentException(); } } }
public ChannelParams(AnalogInChannelsEnum channelName, Filter channelFilter, ProgrammableGainAmplifier channelPGA, AnalogInLatch channelLatch) { _channelName = channelName; ChannelFilter = channelFilter; ChannelPGA = channelPGA; CommonLatch = channelLatch; }
public AI_Channel this[AnalogInChannelsEnum index] { get { return(_channels[(int)index]); } }
public AI_Channel(AnalogInChannelsEnum channelName, ref AgilentU254x Driver, ChannelModeSwitch ModeSwitch, Filter ChannelFilter, ProgrammableGainAmplifier ChannelPGA, AnalogInLatch CommonLatch) { _channelName = channelName; _driver = Driver; _modeSwitch = ModeSwitch; Parameters = new ChannelParams(_channelName, ChannelFilter, ChannelPGA, CommonLatch); InitDriverChannel(_channelName, out _channel); ChannelData = new ConcurrentQueue <Point[]>(); }
public void SetChannelMode(AnalogInChannelsEnum channel, ChannelModeEnum mode) { switch (channel) { case AnalogInChannelsEnum.AIn1: { _SelectorA0.Reset(); _SelectorA1.Reset(); } break; case AnalogInChannelsEnum.AIn2: { _SelectorA0.Set(); _SelectorA1.Reset(); } break; case AnalogInChannelsEnum.AIn3: { _SelectorA0.Reset(); _SelectorA1.Set(); } break; case AnalogInChannelsEnum.AIn4: { _SelectorA0.Set(); _SelectorA1.Set(); } break; default: throw new ArgumentException(); } switch (mode) { case ChannelModeEnum.AC: _setResetBit.Reset(); break; case ChannelModeEnum.DC: _setResetBit.Set(); break; default: throw new ArgumentException(); } Pulse(); }
public void SetCutOffFrequencyAndGain(AnalogInChannelsEnum channelName, FilterCutOffFrequencies cutoff, FilterGain gain) { if (cutoff < FilterCutOffFrequencies.Freq_0kHz || cutoff > FilterCutOffFrequencies.Freq_150kHz) { throw new ArgumentException("Frequency out of range"); } if (gain < FilterGain.gain1 || gain > FilterGain.gain16) { throw new ArgumentException("Gain out of range"); } var valForLatch = (int)cutoff | (int)gain; _channel.WriteByte(valForLatch); CutoffFrequency = cutoff; Gain = gain; }