public Keithley2430(string resourceName)
 {
     Driver      = new VisaDevice(resourceName);
     SMU_Channel = new Keithley2430Channel();
     SMU_Channel.Initialize(Driver);
     //SMU_Channel = new Keithley2430Channel(Driver);
 }
        void cmdStartIV_at_defR_Click(object sender, RoutedEventArgs e)
        {
            // Has to be implemented in another section of code

            var smuDriver = new VisaDevice("GPIB0::26::INSTR") as IDeviceIO;
            var keithley  = new Keithley26xxB <Keithley2602B>(smuDriver);
            var smu       = keithley[Keithley26xxB_Channels.Channel_A];

            var motorDriver = new SerialDevice("COM1", 115200, Parity.None, 8, StopBits.One);
            var motor       = new SA_2036U012V(motorDriver) as IMotionController1D;

            experiment              = new IV_DefinedResistance(smu, motor) as IExperiment;
            experiment.DataArrived += experimentIV_at_def_R_DataArrived;

            experiment.Status   += experimentStatus;
            experiment.Progress += experimentProgress;

            if (measurementInterface != null)
            {
                if (measurementInterface is IV_at_DefinedResistance)
                {
                    experiment.Start(((measurementInterface as IV_at_DefinedResistance).DataContext as IV_DefinedResistanceModel).ExperimentSettigns);
                }
            }
        }
예제 #3
0
        /// <summary>
        /// Find all available instruments.
        /// </summary>
        private void Find()
        {
            // Find all available VISA-over-USB devices.
            IEnumerable <string> devices = VisaDevice.Find(VisaPattern.USB);

            // Remove all items.
            comboBoxResources.Items.Clear();

            // Add found items.
            foreach (string d in devices)
            {
                comboBoxResources.Items.Add(d);
            }

            // Select the first item.
            comboBoxResources.SelectedIndex = 0;
        }
예제 #4
0
        public void Open()
        {
            // The device uses a USB VISA interface, so look for devices with that pattern.
            string[] resourceStrings = VisaDevice.Find(VisaPattern.USB).ToArray();
            string   errorMessage    = string.Empty;
            bool     success         = false;

            // Try each resource, and use the first one that opens successfully.
            foreach (string resouceName in resourceStrings)
            {
                bool status = true;
                try
                {
                    // Open a connection to the desired instrument.
                    Open(resouceName);
                }
                catch (DeviceCommunicationException ex)
                {
                    // Save the error message to display to the user later.
                    errorMessage = ex.Message;

                    // Note that the instrument didn't open.
                    status = false;
                }

                // Stop when one of the resource strings connects successfully.
                if (status == true)
                {
                    success = true;
                    break;
                }
            }

            // If none of the resource strings yielded an instrument connection, throw
            // an exception.
            if (success == false)
            {
                throw new DeviceCommunicationException("Device was not found."
                                                       + Environment.NewLine + "Details:"
                                                       + Environment.NewLine + errorMessage);
            }
        }