Пример #1
0
        private void button2_Click(object sender, EventArgs e)
        {
            AD9958 selectedDDS = ddsList[deviceListBox.SelectedIndex];

            selectedDDS.SetLinearSweep(2, 50e6, 60e6, 2e-6, 0.1);
            selectedDDS.SetDifferentialSweep(100);
        }
Пример #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            AD9958            selectedDDS = ddsList[deviceListBox.SelectedIndex];
            ModulationSetting setting     = modulationUserControl1.ModulationSetting;

            selectedDDS.SetModulation(setting.Channel, setting.Levels, setting.Mode, setting.ChannelWords.ToArray());
        }
Пример #3
0
        private void setChannelButton_Click(object sender, EventArgs e)
        {
            // Parse information
            AD9958         selectedDDS = ddsList[deviceListBox.SelectedIndex];
            ChannelSetting setting     = ((IChannelSetting)channelTabControl.SelectedTab.Controls[0]).ChannelSetting;

            setChannel(selectedDDS, setting);
        }
Пример #4
0
 private void setChannel(AD9958 dds, ChannelSetting Setting)
 {
     if (Setting.Channel == 2)
     {
         dds.SetTwoChannelRelativePhase(Setting.Frequency, Setting.Phase);
     }
     else
     {
         dds.SetFrequency(Setting.Channel, Setting.Frequency);
     }
 }
Пример #5
0
        private void button3_Click(object sender, EventArgs e)
        {
            AD9958        selectedDDS = ddsList[deviceListBox.SelectedIndex];
            List <double> freqs       = new List <double>();
            double        start       = 10e6;
            double        incr        = 1e6;

            for (int k = 0; k < 20; k++)
            {
                freqs.Add(start + k * incr);
            }
            selectedDDS.SetFrequencyList(freqs.ToArray());
        }
Пример #6
0
        public void singletone(int channel, int amplitude, double freq)
        {
            AD9958 selectedDDS = ddsList[0];

            selectedDDS.MasterReset();

            //Set a saftely limit for the rf amplifier for evaporative cooling NTU.
            if (amplitude > 400)
            {
                amplitude = 400;
            }

            selectedDDS.SetFrequency(channel, amplitude, freq);
        }
Пример #7
0
        public string sweep(int channel, int amplitude, double startFreq, double stopFreq, double rate)
        {
            AD9958 selectedDDS = ddsList[0];

            selectedDDS.MasterReset();

            //Set a saftely limit for the rf amplifier for evaporative cooling NTU.
            if (amplitude > 400)
            {
                amplitude = 400;
            }

            string bytesWritten = selectedDDS.SetLinearSweep2(channel, amplitude, startFreq, stopFreq, rate);

            return(bytesWritten);
        }
Пример #8
0
        private void button5_Click(object sender, EventArgs e)
        {
            AD9958        selectedDDS = ddsList[deviceListBox.SelectedIndex];
            List <double> freqs       = new List <double>();
            List <double> relAmp      = new List <double>();
            double        start       = 10e6;
            double        incr        = 1e6;

            int nSteps = 20;

            for (int k = 0; k < nSteps; k++)
            {
                freqs.Add(start + k * incr);
                relAmp.Add(1 - (k / ((double)nSteps)));
            }
            selectedDDS.SetFrequencyAmplitudeList(freqs.ToArray(), relAmp.ToArray());
        }
Пример #9
0
        private void button4_Click(object sender, EventArgs e)
        {
            AD9958 selectedDDS = ddsList[deviceListBox.SelectedIndex];
            double startSlope  = 100;
            double slopeIncr   = 100;

            List <double> slopes = new List <double>();

            selectedDDS.SetLinearSweep(2, 50e6, 60e6, 2e-6, 10e3);
            selectedDDS.SetDifferentialSweep(startSlope);

            for (int k = 0; k < 10; k++)
            {
                slopes.Add(startSlope + k * slopeIncr);
            }

            selectedDDS.SetDifferentialSweepList(slopes.ToArray());
        }
Пример #10
0
        public void Initialize()
        {
            mocks      = new Mockery();
            mockDevice = mocks.NewMock <IDDSUSBChip>();
            dds        = new AD9958(mockDevice);

            // Define some messages
            // FullDDSReset via EP1
            fullDDSReset = new Message(new byte[] { 0x03, 0x08, 0x0b });

            // Set to Two Level Modulation
            // Call to Function Register 1 according to Christian's implementation
            setTwoLevel = new Message(new byte[] { 0x01, 0xa8, 0x00, 0x20 });

            // Set to single tone
            // Call to channel function register with AFP select none,
            // the middle byte to default and the LSByte to all zeros
            // as in Christians code
            setSingleTone = new Message(new byte[] { 0x03, 0x00, 0x03, 0x00 });

            // Select both channels
            // Call to channel select register with both channels on and open and
            // write mode MSB serial 4 bit mode
            selectBothChannels = new Message(new byte[] { 0x00, (byte)(0xc0 + 0x36) });

            // Select channel zero
            selectChannelZero = new Message(new byte[] { 0x00, 0x76 });

            // Select channel one
            selectChannelOne = new Message(new byte[] { 0x00, 0xB6 });

            // Set frequency to 100 MHz
            // 0x33 0x33 0x33 0x33 / 2**32 = 0.2
            setFreqTo100MHz = new Message(new byte[] { 0x04, 0x33, 0x33, 0x33, 0x33 });

            // Set phase to zero
            setPhaseToZero = new Message(new byte[] { 0x05, 0x00, 0x00 });

            // Initialization after MasterReset
            initialization = new Message();
            initialization.Add(selectBothChannels);
            initialization.Add(setSingleTone);
            initialization.Add(setTwoLevel);
        }
Пример #11
0
        private void button2_Click(object sender, EventArgs e)
        {
            AD9958             selectedDDS = ddsList[deviceListBox.SelectedIndex];
            LinearSweepSetting setting     = linearSweepControl1.LinearSweepSetting;

            int    channel      = setting.Channel;
            double startFreq    = setting.StartFreq;
            double stopFreq     = setting.StopFreq;
            double dFreq        = setting.DeltaFreq;
            double dt           = setting.DeltaTime;
            string bytesWritten = selectedDDS.SetLinearSweep(channel, startFreq, stopFreq, dt, dFreq);

            //string bytesWritten = selectedDDS.SetLinearSweep(0, 1e6, 10e6, 160e-9, 1.6);
            //selectedDDS.SetDifferentialSweep(100);
            // selectedDDS.SetMultiTaskList();
            // string bytesWritten = selectedDDS.programInBytes();
            // string bytesWritten = selectedDDS.SetMultiTaskList();
            //  string bytesWritten = selectedDDS.SetLinearSweep(2, 50e6, 60e6, 1e-6, 1);
            textBox1.Text = bytesWritten;
        }
Пример #12
0
        public void Initialize()
        {
            mocks = new Mockery();
            mockMicrocontroller = mocks.NewMock <IDDSUSBChip>();
            dds = new AD9958(mockMicrocontroller);

            // Define some messages
            // Select channel zero
            selectChannelZero = new Message(new byte[] { 0x00, 0x76 });

            // Set to Two Level Modulation
            // Call to Function Register 1 according to Christian's implementation
            setTwoLevel = new Message(new byte[] { 0x01, 0xa8, 0x00, 0x20 });

            // Set to frequency modulation
            // Call to channel function register with AFP select FM,
            // the middle byte to default and the LSByte to all zeros
            // as in Christians code
            selectFrequencyModulation = new Message(new byte[] { 0x03, 0x80, 0x03, 0x00 });

            // Set frequency tuning word of current channel to 1 MHz
            // 0x00 0x83 0x12 0x6E / 2**32 = 0.002
            setFreqTuningWord1MHz = new Message(new byte[] { 0x04, 0x00, 0x83, 0x12, 0x6F });

            // Set Channel Word Register 1 to 2 MHz
            setChanWordOne2MHz = new Message(new byte[] { 0x0A, 0x01, 0x06, 0x24, 0xDD });

            // Set to phase modulation
            // Call to channel function register with AFP select PM,
            // the middle byte to default and the LSByte to all zeros
            // as in Christians code
            selectPhaseModulation = new Message(new byte[] { 0x03, 0xC0, 0x03, 0x00 });

            // Set phase tuning word to zero
            setPhaseTuningWordZero = new Message(new byte[] { 0x05, 0x00, 0x00 });

            // Set channel register word 1 to pi (resolution 14bit)
            // Pi is 2**13 (10 0000 0000) we have to MSB align it in the 32 bit CW1 register
            // where we set all others to zero
            setChanWordOnePi = new Message(new byte[] { 0x0A, 0x80, 0x00, 0x00, 0x00 });
        }
Пример #13
0
        public void Initialize()
        {
            mocks      = new Mockery();
            mockDevice = mocks.NewMock <IDDSUSBChip>();
            dds        = new AD9958(mockDevice);

            // Define some common calls

            // Set to Two Level Modulation
            // Call to Function Register 1 according to Christian's implementation
            setTwoLevel = new Message(new byte[] { 0x01, 0xa8, 0x00, 0x20 });

            // Set to single tone
            // Call to channel function register with AFP select none,
            // the middle byte to default and the LSByte to all zeros
            // as in Christians code
            setSingleTone = new Message(new byte[] { 0x03, 0x00, 0x03, 0x00 });

            // Select both channels
            // Call to channel select register with both channels on and open and
            // write mode MSB serial 4 bit mode
            selectBothChannels = new Message(new byte[] { 0x00, (byte)(0xc0 + 0x36) });

            // Full_DDS_Reset via EP1
            fullDDSReset = new Message(new byte[] { 0x03, 0x08, 0x0b });

            // Start_Transfer via EP1
            startTransfer = new Message(0x03, 0x03, 0x06);

            // Stop Transfer via EP1
            stopTransfer = new Message(0x03, 0x04, 0x07);

            // ListplayMode via EP1 (10 byte length)
            listPlayMode10bytes = new Message(0x04, 0x0b, 0x0a, 0x19);

            // StartListplayMode via EP1
            startListPlayMode = new Message(0x03, 0x0c, 0x0f);

            // StopListplay mode via EP1
            stopListPlayMode = new Message(0x03, 0x0e, 0x11);
        }
Пример #14
0
        private void sweepButton_Click(object sender, EventArgs e)
        {
            AD9958       selectedDDS = ddsList[deviceListBox.SelectedIndex];
            SweepSetting setting     = sweepControl1.SweepSetting;

            int    channel   = setting.Channel;
            int    amplitude = setting.AmplitudeScaleFactor;
            double startFreq = setting.StartFreq;
            double stopFreq  = setting.StopFreq;
            double rate      = setting.Rate;

            string bytesWritten = selectedDDS.SetLinearSweep2(channel, amplitude, startFreq, stopFreq, rate);


            //string bytesWritten = selectedDDS.SetLinearSweep(0, 1e6, 10e6, 160e-9, 1.6);
            //selectedDDS.SetDifferentialSweep(100);
            // selectedDDS.SetMultiTaskList();
            //string bytesWritten = selectedDDS.programInBytes();
            // string bytesWritten = selectedDDS.SetMultiTaskList();
            //  string bytesWritten = selectedDDS.SetLinearSweep(2, 50e6, 60e6, 1e-6, 1);
            textBox1.Text = bytesWritten;
        }
Пример #15
0
        private void fullResetButton_Click(object sender, EventArgs e)
        {
            AD9958 selectedDDS = ddsList[deviceListBox.SelectedIndex];

            selectedDDS.MasterReset();
        }
Пример #16
0
 public void Initialize()
 {
     mocks = new Mockery();
     mockMicrocontroller = mocks.NewMock <IDDSUSBChip>();
     dds = new AD9958(mockMicrocontroller);
 }