Exemplo n.º 1
0
        private const int LatencyTimer = 255; // Hz

        #endregion Fields

        #region Methods

        private static void Main(string[] args)
        {
            var adcSpiConfig = new FtChannelConfig
                                   {
                                       ClockRate = ConnectionSpeed,
                                       LatencyTimer = LatencyTimer,
                                       configOptions =
                                           FtConfigOptions.Mode0 | FtConfigOptions.CsDbus3 | FtConfigOptions.CsActivelow
                                   };

            var adcConfig = new Maxim186Configuration
                                {
                                    Channel = Maxim186.Channel.Channel0,
                                    ConversionType = Maxim186.ConversionType.SingleEnded,
                                    Polarity = Maxim186.Polarity.Unipolar,
                                    PowerMode = Maxim186.PowerMode.InternalClockMode
                                };

            var adc = new Maxim186(adcConfig, adcSpiConfig);

            do
            {

                int val = adc.GetConvertedSample();
                Console.WriteLine(val);
                val = adc.GetConvertedSampleFrom(Maxim186.Channel.Channel1);

            } while (true);
        }
Exemplo n.º 2
0
        private byte GetAdcControlWord(Maxim186Configuration config, Channel? channel = null)
        {
            int word = 0;
            channel = channel ?? config.Channel;
            word = 1 << 7; // Reserved Bit
            word |= (int)channel.Value << 4; // channel
            word |= (int)config.Polarity << 3;
            word |= (int)config.ConversionType << 2;
            word |= (int)config.PowerMode;

            return (byte)word;
        }
Exemplo n.º 3
0
 public Maxim186(Maxim186Configuration adcConfig, FtChannelConfig config, SpiConfiguration spiConfig)
     : base(config, spiConfig)
 {
     _adcConfig = adcConfig;
 }
Exemplo n.º 4
0
 public Maxim186(Maxim186Configuration adcConfig, FtChannelConfig config)
     : this(adcConfig, config, null)
 {
 }