Függvény generátor

A Fizipedia wikiből

SIGLENT SDG1025 kezelése C# programból. Fájl:SIGLENT.zip

Referenciákhoz hozzá kell adni: VISA Com Library C:\Program Files\IVI Foundation\VISA\VisaCom64\Primary Interop Assemblies\Ivi.Visa.Interop.dll

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
 
namespace FGEN
{
    public partial class FGEN : Form
    {
        private Ivi.Visa.Interop.ResourceManager rm;
        private Ivi.Visa.Interop.FormattedIO488 Siglent; 
 
        public FGEN()
        {
            InitializeComponent();
        }
 
        private void FGEN_Load(object sender, EventArgs e)
        {
            // Init VISA communication
            string VISA_address = "USB0::0xF4ED::0xEE3A::SDG100E4140436::INSTR";
            rm = new Ivi.Visa.Interop.ResourceManager();
            Siglent = new Ivi.Visa.Interop.FormattedIO488();
            Siglent.IO = (Ivi.Visa.Interop.IMessage) rm.Open(VISA_address, 
                Ivi.Visa.Interop.AccessMode.EXCLUSIVE_LOCK, 0, "");
        }
 
        private void IDbutton_Click(object sender, EventArgs e)
        {
            Siglent.WriteString("*IDN?", true);
            IDtextBox.Text = Siglent.ReadString();
        }
 
        private void Freqbutton_Click(object sender, EventArgs e)
        {
            Siglent.WriteString("C1:BSWV FRQ, "+FreqtextBox.Text, true);
        }
 
        private void checkBox1_CheckedChanged(object sender, EventArgs e)
        {
            if (checkBox1.Checked)
            {
                Siglent.WriteString("C1:OUTP ON", true);
            }
            else
            {
                Siglent.WriteString("C1:OUTP OFF", true);
            }
        }
 
        private void radioButton1_CheckedChanged(object sender, EventArgs e)
        {
            if (radioButton1.Checked)
            {
                Siglent.WriteString("C1:BSWV WVTP, SINE", true);
            }
        }
 
        private void radioButton3_CheckedChanged(object sender, EventArgs e)
        {
            if (radioButton3.Checked)
            {
                Siglent.WriteString("C1:BSWV WVTP, SQUARE", true);
            }
        }
 
        private void radioButton2_CheckedChanged(object sender, EventArgs e)
        {
            if (radioButton2.Checked)
            {
                Siglent.WriteString("C1:BSWV WVTP, RAMP", true);
            }
        }
 
        private void FGEN_FormClosing(object sender, FormClosingEventArgs e)
        {
            // Close VISA Communication
            Siglent.IO.Close();
        }
    }
}