yefj
Advanced Member level 5
Hello,I have implemented the following code for controlling my spectrum analizer shown bellow.
I cant understand how to properly store a responce from my device. for example there is the simple *idn? command which returns the model. how do store properly the responce. i Have tried to use serialPort1.ReadTo but its description(shown bellow is not very informative. How do i store string responce from my spectrum analizer in C# Thanks.
I cant understand how to properly store a responce from my device. for example there is the simple *idn? command which returns the model. how do store properly the responce. i Have tried to use serialPort1.ReadTo but its description(shown bellow is not very informative. How do i store string responce from my spectrum analizer in C# Thanks.
Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApp1
{
public partial class Form1 : Form
{
bool meter_state = false;
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
serialPort1.Open();
serialPort1.Write("meas:freq:st 500 mhz\n");
serialPort1.ReadTo
serialPort1.Close();
}
private void Form1_Load(object sender, EventArgs e)
{
}
}
}