EasyManua.ls Logo

Hioki BT3564 - 9.3 Accuracy

Hioki BT3564
210 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
8.8 Sample Programs
162
A similar example to Visual Basic
®
2017 in Visual C#
®
2017 follows:
Sample Programs (Visual C#
®
2017)
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;
using System.IO;
using System.IO.Ports;
namespace CSSample
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
//Perform process when Button1 is pressed
private void button1_Click(object sender, EventArgs e)
{
StreamWriter sw;
string recvstr;
int i;
try
{
button1.Enabled = false; //Disable buttons during communication........(a)
button2.Enabled = false;
//Communication port setting.......................(b)
SerialPort1.PortName = "COM1";
SerialPort1.BaudRate = 9600;
SerialPort1.DataBits = 8;
SerialPort1.Parity = Parity.None;
SerialPort1.StopBits = StopBits.One;
SerialPort1.NewLine = "\r\n"; //Terminator setting..........................(c)
SerialPort1.ReadTimeout = 2000; //2 seconds time out.........................(d)
SerialPort1.Open(); //Open a port
SendSetting(); //Instrument settings
sw = new StreamWriter(@"data.csv"); //Create text file to be saved.............(e)
for (i = 0; i < 10; i++)
{
HIOKI BT3564A961-02

Table of Contents

Related product manuals