コード例 #1
0
        private const int LatencyTimer = 255; // Hz

        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
            {
                Console.WriteLine(adc.GetConvertedSample());

               

            } while (true);
            //*/
        }
コード例 #2
0
        private const int LatencyTimer    = 255;  // Hz

        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
            {
                Console.WriteLine(adc.GetConvertedSample());
            } while (true);
            //*/
        }
コード例 #3
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);
        }
コード例 #4
0
 public Maxim186(Maxim186Configuration adcConfig, FtChannelConfig config, SpiConfiguration spiConfig)
     : base(config, spiConfig)
 {
     _adcConfig = adcConfig;
 }
コード例 #5
0
 public Maxim186(Maxim186Configuration adcConfig, FtChannelConfig config)
     : this(adcConfig, config, null)
 {
 }
コード例 #6
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;
        }
コード例 #7
0
 public Maxim186(Maxim186Configuration adcConfig, FtChannelConfig config, SpiConfiguration spiConfig)
     : base(config, spiConfig)
 {
     _adcConfig = adcConfig;
 }
コード例 #8
0
 public Maxim186(Maxim186Configuration adcConfig, FtChannelConfig config)
     : this(adcConfig, config, null)
 {
 }