using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using CgpibCs;


namespace Slave
{
	/// <summary>
	/// Form1 ̊Tv̐łB
	/// </summary>
	public class Form_slave : System.Windows.Forms.Form
	{
		public System.Windows.Forms.Button cmdInit;
		public System.Windows.Forms.Button cmdDataDel;
		public System.Windows.Forms.GroupBox Frame1;
		public System.Windows.Forms.ComboBox cboEoi;
		public System.Windows.Forms.ComboBox cboDelim;
		public System.Windows.Forms.TextBox txtMyAddr;
		public System.Windows.Forms.TextBox txtDevName;
		public System.Windows.Forms.Label Label4;
		public System.Windows.Forms.Label Label3;
		public System.Windows.Forms.Label Label2;
		public System.Windows.Forms.Label Label1;
		public System.Windows.Forms.GroupBox Frame5;
		public System.Windows.Forms.RadioButton optSrqSend;
		public System.Windows.Forms.RadioButton optSrqNotSend;
		public System.Windows.Forms.TextBox txtSPollStb;
		public System.Windows.Forms.Button cmdSendSrq;
		public System.Windows.Forms.Label Label6;
		public System.Windows.Forms.Label Label5;
		public System.Windows.Forms.GroupBox Frame2;
		public System.Windows.Forms.Button cmdRec;
		public System.Windows.Forms.Button cmdSend;
		public System.Windows.Forms.TextBox txtRec;
		public System.Windows.Forms.TextBox txtSend;
		public System.Windows.Forms.Button cmdExit;
		public System.Windows.Forms.Button cmdRetDel;
		public System.Windows.Forms.GroupBox Frame4;
		public System.Windows.Forms.RadioButton optPPollResponseIst1;
		public System.Windows.Forms.Button cmdParallelpollSetting;
		public System.Windows.Forms.RadioButton optPPollResponseIst0;
		public System.Windows.Forms.RadioButton optPPollResponseSrq;
		public System.Windows.Forms.RadioButton optPPollResponseNot;
		public System.Windows.Forms.GroupBox Frame3;
		public System.Windows.Forms.ListBox lstRet;
		/// <summary>
		/// KvȃfUCiϐłB
		/// </summary>
		private System.ComponentModel.Container components = null;

		/// <summary>
		/// NXCgpibCX^X쐬
		/// </summary>
		Cgpib	gpib = new Cgpib();
		short	m_Id;


		public Form_slave()
		{
			//
			// Windows tH[ fUCi T|[gɕKvłB
			//
			InitializeComponent();

			//
			// TODO: InitializeComponent ĂяǒɁARXgN^ R[hǉĂB
			//
		}

		/// <summary>
		/// gpĂ郊\[XɌ㏈s܂B
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if (components != null) 
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows Form Designer generated code
		/// <summary>
		/// fUCi T|[gɕKvȃ\bhłB̃\bh̓e
		/// R[h GfB^ŕύXȂłB
		/// </summary>
		private void InitializeComponent()
		{
			this.cmdInit = new System.Windows.Forms.Button();
			this.cmdDataDel = new System.Windows.Forms.Button();
			this.Frame1 = new System.Windows.Forms.GroupBox();
			this.cboEoi = new System.Windows.Forms.ComboBox();
			this.cboDelim = new System.Windows.Forms.ComboBox();
			this.txtMyAddr = new System.Windows.Forms.TextBox();
			this.txtDevName = new System.Windows.Forms.TextBox();
			this.Label4 = new System.Windows.Forms.Label();
			this.Label3 = new System.Windows.Forms.Label();
			this.Label2 = new System.Windows.Forms.Label();
			this.Label1 = new System.Windows.Forms.Label();
			this.Frame5 = new System.Windows.Forms.GroupBox();
			this.optSrqSend = new System.Windows.Forms.RadioButton();
			this.optSrqNotSend = new System.Windows.Forms.RadioButton();
			this.txtSPollStb = new System.Windows.Forms.TextBox();
			this.cmdSendSrq = new System.Windows.Forms.Button();
			this.Label6 = new System.Windows.Forms.Label();
			this.Label5 = new System.Windows.Forms.Label();
			this.Frame2 = new System.Windows.Forms.GroupBox();
			this.cmdRec = new System.Windows.Forms.Button();
			this.cmdSend = new System.Windows.Forms.Button();
			this.txtRec = new System.Windows.Forms.TextBox();
			this.txtSend = new System.Windows.Forms.TextBox();
			this.cmdExit = new System.Windows.Forms.Button();
			this.cmdRetDel = new System.Windows.Forms.Button();
			this.Frame4 = new System.Windows.Forms.GroupBox();
			this.optPPollResponseIst1 = new System.Windows.Forms.RadioButton();
			this.cmdParallelpollSetting = new System.Windows.Forms.Button();
			this.optPPollResponseIst0 = new System.Windows.Forms.RadioButton();
			this.optPPollResponseSrq = new System.Windows.Forms.RadioButton();
			this.optPPollResponseNot = new System.Windows.Forms.RadioButton();
			this.Frame3 = new System.Windows.Forms.GroupBox();
			this.lstRet = new System.Windows.Forms.ListBox();
			this.Frame1.SuspendLayout();
			this.Frame5.SuspendLayout();
			this.Frame2.SuspendLayout();
			this.Frame4.SuspendLayout();
			this.Frame3.SuspendLayout();
			this.SuspendLayout();
			// 
			// cmdInit
			// 
			this.cmdInit.BackColor = System.Drawing.SystemColors.Control;
			this.cmdInit.Cursor = System.Windows.Forms.Cursors.Default;
			this.cmdInit.ForeColor = System.Drawing.SystemColors.ControlText;
			this.cmdInit.Location = new System.Drawing.Point(368, 16);
			this.cmdInit.Name = "cmdInit";
			this.cmdInit.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.cmdInit.Size = new System.Drawing.Size(113, 25);
			this.cmdInit.TabIndex = 32;
			this.cmdInit.Text = "(&I)";
			this.cmdInit.Click += new System.EventHandler(this.cmdInit_Click);
			// 
			// cmdDataDel
			// 
			this.cmdDataDel.BackColor = System.Drawing.SystemColors.Control;
			this.cmdDataDel.Cursor = System.Windows.Forms.Cursors.Default;
			this.cmdDataDel.ForeColor = System.Drawing.SystemColors.ControlText;
			this.cmdDataDel.Location = new System.Drawing.Point(16, 280);
			this.cmdDataDel.Name = "cmdDataDel";
			this.cmdDataDel.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.cmdDataDel.Size = new System.Drawing.Size(113, 25);
			this.cmdDataDel.TabIndex = 37;
			this.cmdDataDel.Text = "f[^";
			this.cmdDataDel.Click += new System.EventHandler(this.cmdDataDel_Click);
			// 
			// Frame1
			// 
			this.Frame1.BackColor = System.Drawing.SystemColors.Control;
			this.Frame1.Controls.AddRange(new System.Windows.Forms.Control[] {
																				 this.cboEoi,
																				 this.cboDelim,
																				 this.txtMyAddr,
																				 this.txtDevName,
																				 this.Label4,
																				 this.Label3,
																				 this.Label2,
																				 this.Label1});
			this.Frame1.ForeColor = System.Drawing.SystemColors.ControlText;
			this.Frame1.Location = new System.Drawing.Point(8, 16);
			this.Frame1.Name = "Frame1";
			this.Frame1.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.Frame1.Size = new System.Drawing.Size(353, 81);
			this.Frame1.TabIndex = 31;
			this.Frame1.TabStop = false;
			this.Frame1.Text = "@";
			// 
			// cboEoi
			// 
			this.cboEoi.BackColor = System.Drawing.SystemColors.Window;
			this.cboEoi.Cursor = System.Windows.Forms.Cursors.Default;
			this.cboEoi.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
			this.cboEoi.ForeColor = System.Drawing.SystemColors.WindowText;
			this.cboEoi.Items.AddRange(new object[] {
														"o͂Ȃ",
														"o͂"});
			this.cboEoi.Location = new System.Drawing.Point(256, 48);
			this.cboEoi.Name = "cboEoi";
			this.cboEoi.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.cboEoi.Size = new System.Drawing.Size(89, 20);
			this.cboEoi.TabIndex = 8;
			// 
			// cboDelim
			// 
			this.cboDelim.BackColor = System.Drawing.SystemColors.Window;
			this.cboDelim.Cursor = System.Windows.Forms.Cursors.Default;
			this.cboDelim.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
			this.cboDelim.ForeColor = System.Drawing.SystemColors.WindowText;
			this.cboDelim.Items.AddRange(new object[] {
														  "gpȂ",
														  "CR+LF",
														  "CR",
														  "LF"});
			this.cboDelim.Location = new System.Drawing.Point(80, 48);
			this.cboDelim.Name = "cboDelim";
			this.cboDelim.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.cboDelim.Size = new System.Drawing.Size(73, 20);
			this.cboDelim.TabIndex = 6;
			// 
			// txtMyAddr
			// 
			this.txtMyAddr.AcceptsReturn = true;
			this.txtMyAddr.AutoSize = false;
			this.txtMyAddr.BackColor = System.Drawing.SystemColors.Window;
			this.txtMyAddr.Cursor = System.Windows.Forms.Cursors.IBeam;
			this.txtMyAddr.Enabled = false;
			this.txtMyAddr.ForeColor = System.Drawing.SystemColors.WindowText;
			this.txtMyAddr.Location = new System.Drawing.Point(256, 16);
			this.txtMyAddr.MaxLength = 0;
			this.txtMyAddr.Name = "txtMyAddr";
			this.txtMyAddr.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.txtMyAddr.Size = new System.Drawing.Size(33, 25);
			this.txtMyAddr.TabIndex = 4;
			this.txtMyAddr.Text = "";
			// 
			// txtDevName
			// 
			this.txtDevName.AcceptsReturn = true;
			this.txtDevName.AutoSize = false;
			this.txtDevName.BackColor = System.Drawing.SystemColors.Window;
			this.txtDevName.Cursor = System.Windows.Forms.Cursors.IBeam;
			this.txtDevName.ForeColor = System.Drawing.SystemColors.WindowText;
			this.txtDevName.Location = new System.Drawing.Point(80, 16);
			this.txtDevName.MaxLength = 0;
			this.txtDevName.Name = "txtDevName";
			this.txtDevName.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.txtDevName.Size = new System.Drawing.Size(73, 25);
			this.txtDevName.TabIndex = 2;
			this.txtDevName.Text = "";
			// 
			// Label4
			// 
			this.Label4.BackColor = System.Drawing.SystemColors.Control;
			this.Label4.Cursor = System.Windows.Forms.Cursors.Default;
			this.Label4.ForeColor = System.Drawing.SystemColors.ControlText;
			this.Label4.Location = new System.Drawing.Point(168, 48);
			this.Label4.Name = "Label4";
			this.Label4.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.Label4.Size = new System.Drawing.Size(57, 17);
			this.Label4.TabIndex = 7;
			this.Label4.Text = "EOI =";
			// 
			// Label3
			// 
			this.Label3.BackColor = System.Drawing.SystemColors.Control;
			this.Label3.Cursor = System.Windows.Forms.Cursors.Default;
			this.Label3.ForeColor = System.Drawing.SystemColors.ControlText;
			this.Label3.Location = new System.Drawing.Point(8, 48);
			this.Label3.Name = "Label3";
			this.Label3.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.Label3.Size = new System.Drawing.Size(65, 17);
			this.Label3.TabIndex = 5;
			this.Label3.Text = "f~^ =";
			// 
			// Label2
			// 
			this.Label2.BackColor = System.Drawing.SystemColors.Control;
			this.Label2.Cursor = System.Windows.Forms.Cursors.Default;
			this.Label2.ForeColor = System.Drawing.SystemColors.ControlText;
			this.Label2.Location = new System.Drawing.Point(168, 24);
			this.Label2.Name = "Label2";
			this.Label2.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.Label2.Size = new System.Drawing.Size(81, 17);
			this.Label2.TabIndex = 3;
			this.Label2.Text = "@AhX =";
			// 
			// Label1
			// 
			this.Label1.BackColor = System.Drawing.SystemColors.Control;
			this.Label1.Cursor = System.Windows.Forms.Cursors.Default;
			this.Label1.ForeColor = System.Drawing.SystemColors.ControlText;
			this.Label1.Location = new System.Drawing.Point(8, 24);
			this.Label1.Name = "Label1";
			this.Label1.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.Label1.Size = new System.Drawing.Size(73, 17);
			this.Label1.TabIndex = 1;
			this.Label1.Text = "foCX =";
			// 
			// Frame5
			// 
			this.Frame5.BackColor = System.Drawing.SystemColors.Control;
			this.Frame5.Controls.AddRange(new System.Windows.Forms.Control[] {
																				 this.optSrqSend,
																				 this.optSrqNotSend,
																				 this.txtSPollStb,
																				 this.cmdSendSrq,
																				 this.Label6,
																				 this.Label5});
			this.Frame5.ForeColor = System.Drawing.SystemColors.ControlText;
			this.Frame5.Location = new System.Drawing.Point(576, 16);
			this.Frame5.Name = "Frame5";
			this.Frame5.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.Frame5.Size = new System.Drawing.Size(145, 129);
			this.Frame5.TabIndex = 39;
			this.Frame5.TabStop = false;
			this.Frame5.Text = "VA|[";
			// 
			// optSrqSend
			// 
			this.optSrqSend.BackColor = System.Drawing.SystemColors.Control;
			this.optSrqSend.Cursor = System.Windows.Forms.Cursors.Default;
			this.optSrqSend.ForeColor = System.Drawing.SystemColors.ControlText;
			this.optSrqSend.Location = new System.Drawing.Point(8, 40);
			this.optSrqSend.Name = "optSrqSend";
			this.optSrqSend.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.optSrqSend.Size = new System.Drawing.Size(113, 17);
			this.optSrqSend.TabIndex = 27;
			this.optSrqSend.TabStop = true;
			this.optSrqSend.Text = "SRQo";
			// 
			// optSrqNotSend
			// 
			this.optSrqNotSend.BackColor = System.Drawing.SystemColors.Control;
			this.optSrqNotSend.Checked = true;
			this.optSrqNotSend.Cursor = System.Windows.Forms.Cursors.Default;
			this.optSrqNotSend.ForeColor = System.Drawing.SystemColors.ControlText;
			this.optSrqNotSend.Location = new System.Drawing.Point(8, 16);
			this.optSrqNotSend.Name = "optSrqNotSend";
			this.optSrqNotSend.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.optSrqNotSend.Size = new System.Drawing.Size(113, 17);
			this.optSrqNotSend.TabIndex = 26;
			this.optSrqNotSend.TabStop = true;
			this.optSrqNotSend.Text = "SRQoȂ\r\n";
			// 
			// txtSPollStb
			// 
			this.txtSPollStb.AcceptsReturn = true;
			this.txtSPollStb.AutoSize = false;
			this.txtSPollStb.BackColor = System.Drawing.SystemColors.Window;
			this.txtSPollStb.Cursor = System.Windows.Forms.Cursors.IBeam;
			this.txtSPollStb.ForeColor = System.Drawing.SystemColors.WindowText;
			this.txtSPollStb.ImeMode = System.Windows.Forms.ImeMode.Off;
			this.txtSPollStb.Location = new System.Drawing.Point(112, 64);
			this.txtSPollStb.MaxLength = 3;
			this.txtSPollStb.Name = "txtSPollStb";
			this.txtSPollStb.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.txtSPollStb.Size = new System.Drawing.Size(25, 25);
			this.txtSPollStb.TabIndex = 24;
			this.txtSPollStb.Text = "0";
			// 
			// cmdSendSrq
			// 
			this.cmdSendSrq.BackColor = System.Drawing.SystemColors.Control;
			this.cmdSendSrq.Cursor = System.Windows.Forms.Cursors.Default;
			this.cmdSendSrq.ForeColor = System.Drawing.SystemColors.ControlText;
			this.cmdSendSrq.Location = new System.Drawing.Point(16, 96);
			this.cmdSendSrq.Name = "cmdSendSrq";
			this.cmdSendSrq.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.cmdSendSrq.Size = new System.Drawing.Size(113, 25);
			this.cmdSendSrq.TabIndex = 22;
			this.cmdSendSrq.Text = "ݒl𔽉f";
			this.cmdSendSrq.Click += new System.EventHandler(this.cmdSendSrq_Click);
			// 
			// Label6
			// 
			this.Label6.BackColor = System.Drawing.SystemColors.Control;
			this.Label6.Cursor = System.Windows.Forms.Cursors.Default;
			this.Label6.ForeColor = System.Drawing.SystemColors.ControlText;
			this.Label6.Location = new System.Drawing.Point(16, 80);
			this.Label6.Name = "Label6";
			this.Label6.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.Label6.Size = new System.Drawing.Size(88, 17);
			this.Label6.TabIndex = 25;
			this.Label6.Text = "(0`255Őݒ)";
			// 
			// Label5
			// 
			this.Label5.BackColor = System.Drawing.SystemColors.Control;
			this.Label5.Cursor = System.Windows.Forms.Cursors.Default;
			this.Label5.ForeColor = System.Drawing.SystemColors.ControlText;
			this.Label5.Location = new System.Drawing.Point(8, 64);
			this.Label5.Name = "Label5";
			this.Label5.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.Label5.Size = new System.Drawing.Size(97, 17);
			this.Label5.TabIndex = 23;
			this.Label5.Text = "Xe[^XoCg =";
			// 
			// Frame2
			// 
			this.Frame2.BackColor = System.Drawing.SystemColors.Control;
			this.Frame2.Controls.AddRange(new System.Windows.Forms.Control[] {
																				 this.cmdRec,
																				 this.cmdSend,
																				 this.txtRec,
																				 this.txtSend});
			this.Frame2.ForeColor = System.Drawing.SystemColors.ControlText;
			this.Frame2.Location = new System.Drawing.Point(8, 104);
			this.Frame2.Name = "Frame2";
			this.Frame2.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.Frame2.Size = new System.Drawing.Size(545, 81);
			this.Frame2.TabIndex = 34;
			this.Frame2.TabStop = false;
			this.Frame2.Text = "Mf[^";
			// 
			// cmdRec
			// 
			this.cmdRec.BackColor = System.Drawing.SystemColors.Control;
			this.cmdRec.Cursor = System.Windows.Forms.Cursors.Default;
			this.cmdRec.ForeColor = System.Drawing.SystemColors.ControlText;
			this.cmdRec.Location = new System.Drawing.Point(424, 48);
			this.cmdRec.Name = "cmdRec";
			this.cmdRec.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.cmdRec.Size = new System.Drawing.Size(105, 25);
			this.cmdRec.TabIndex = 30;
			this.cmdRec.Text = "M";
			this.cmdRec.Click += new System.EventHandler(this.cmdRec_Click);
			// 
			// cmdSend
			// 
			this.cmdSend.BackColor = System.Drawing.SystemColors.Control;
			this.cmdSend.Cursor = System.Windows.Forms.Cursors.Default;
			this.cmdSend.ForeColor = System.Drawing.SystemColors.ControlText;
			this.cmdSend.Location = new System.Drawing.Point(424, 16);
			this.cmdSend.Name = "cmdSend";
			this.cmdSend.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.cmdSend.Size = new System.Drawing.Size(105, 25);
			this.cmdSend.TabIndex = 29;
			this.cmdSend.Text = "M";
			this.cmdSend.Click += new System.EventHandler(this.cmdSend_Click);
			// 
			// txtRec
			// 
			this.txtRec.AcceptsReturn = true;
			this.txtRec.AutoSize = false;
			this.txtRec.BackColor = System.Drawing.SystemColors.Window;
			this.txtRec.Cursor = System.Windows.Forms.Cursors.IBeam;
			this.txtRec.ForeColor = System.Drawing.SystemColors.WindowText;
			this.txtRec.Location = new System.Drawing.Point(8, 48);
			this.txtRec.MaxLength = 0;
			this.txtRec.Name = "txtRec";
			this.txtRec.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.txtRec.Size = new System.Drawing.Size(393, 25);
			this.txtRec.TabIndex = 13;
			this.txtRec.Text = "";
			// 
			// txtSend
			// 
			this.txtSend.AcceptsReturn = true;
			this.txtSend.AutoSize = false;
			this.txtSend.BackColor = System.Drawing.SystemColors.Window;
			this.txtSend.Cursor = System.Windows.Forms.Cursors.IBeam;
			this.txtSend.ForeColor = System.Drawing.SystemColors.WindowText;
			this.txtSend.Location = new System.Drawing.Point(8, 16);
			this.txtSend.MaxLength = 0;
			this.txtSend.Name = "txtSend";
			this.txtSend.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.txtSend.Size = new System.Drawing.Size(393, 25);
			this.txtSend.TabIndex = 12;
			this.txtSend.Text = "";
			// 
			// cmdExit
			// 
			this.cmdExit.BackColor = System.Drawing.SystemColors.Control;
			this.cmdExit.Cursor = System.Windows.Forms.Cursors.Default;
			this.cmdExit.ForeColor = System.Drawing.SystemColors.ControlText;
			this.cmdExit.Location = new System.Drawing.Point(368, 56);
			this.cmdExit.Name = "cmdExit";
			this.cmdExit.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.cmdExit.Size = new System.Drawing.Size(113, 25);
			this.cmdExit.TabIndex = 33;
			this.cmdExit.Text = "I(&X)";
			this.cmdExit.Click += new System.EventHandler(this.cmdExit_Click);
			// 
			// cmdRetDel
			// 
			this.cmdRetDel.BackColor = System.Drawing.SystemColors.Control;
			this.cmdRetDel.Cursor = System.Windows.Forms.Cursors.Default;
			this.cmdRetDel.ForeColor = System.Drawing.SystemColors.ControlText;
			this.cmdRetDel.Location = new System.Drawing.Point(144, 280);
			this.cmdRetDel.Name = "cmdRetDel";
			this.cmdRetDel.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.cmdRetDel.Size = new System.Drawing.Size(113, 25);
			this.cmdRetDel.TabIndex = 38;
			this.cmdRetDel.Text = "߂l";
			this.cmdRetDel.Click += new System.EventHandler(this.cmdRetDel_Click);
			// 
			// Frame4
			// 
			this.Frame4.BackColor = System.Drawing.SystemColors.Control;
			this.Frame4.Controls.AddRange(new System.Windows.Forms.Control[] {
																				 this.optPPollResponseIst1,
																				 this.cmdParallelpollSetting,
																				 this.optPPollResponseIst0,
																				 this.optPPollResponseSrq,
																				 this.optPPollResponseNot});
			this.Frame4.ForeColor = System.Drawing.SystemColors.ControlText;
			this.Frame4.Location = new System.Drawing.Point(576, 168);
			this.Frame4.Name = "Frame4";
			this.Frame4.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.Frame4.Size = new System.Drawing.Size(145, 161);
			this.Frame4.TabIndex = 36;
			this.Frame4.TabStop = false;
			this.Frame4.Text = "p|[";
			// 
			// optPPollResponseIst1
			// 
			this.optPPollResponseIst1.BackColor = System.Drawing.SystemColors.Control;
			this.optPPollResponseIst1.Cursor = System.Windows.Forms.Cursors.Default;
			this.optPPollResponseIst1.ForeColor = System.Drawing.SystemColors.ControlText;
			this.optPPollResponseIst1.Location = new System.Drawing.Point(8, 70);
			this.optPPollResponseIst1.Name = "optPPollResponseIst1";
			this.optPPollResponseIst1.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.optPPollResponseIst1.Size = new System.Drawing.Size(129, 17);
			this.optPPollResponseIst1.TabIndex = 32;
			this.optPPollResponseIst1.TabStop = true;
			this.optPPollResponseIst1.Text = "ISTbitŉ(IST=1)";
			// 
			// cmdParallelpollSetting
			// 
			this.cmdParallelpollSetting.BackColor = System.Drawing.SystemColors.Control;
			this.cmdParallelpollSetting.Cursor = System.Windows.Forms.Cursors.Default;
			this.cmdParallelpollSetting.ForeColor = System.Drawing.SystemColors.ControlText;
			this.cmdParallelpollSetting.Location = new System.Drawing.Point(24, 120);
			this.cmdParallelpollSetting.Name = "cmdParallelpollSetting";
			this.cmdParallelpollSetting.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.cmdParallelpollSetting.Size = new System.Drawing.Size(105, 25);
			this.cmdParallelpollSetting.TabIndex = 31;
			this.cmdParallelpollSetting.Text = "ݒl𔽉f";
			this.cmdParallelpollSetting.Click += new System.EventHandler(this.cmdParallelpollSetting_Click);
			// 
			// optPPollResponseIst0
			// 
			this.optPPollResponseIst0.BackColor = System.Drawing.SystemColors.Control;
			this.optPPollResponseIst0.Cursor = System.Windows.Forms.Cursors.Default;
			this.optPPollResponseIst0.ForeColor = System.Drawing.SystemColors.ControlText;
			this.optPPollResponseIst0.Location = new System.Drawing.Point(8, 43);
			this.optPPollResponseIst0.Name = "optPPollResponseIst0";
			this.optPPollResponseIst0.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.optPPollResponseIst0.Size = new System.Drawing.Size(129, 17);
			this.optPPollResponseIst0.TabIndex = 18;
			this.optPPollResponseIst0.TabStop = true;
			this.optPPollResponseIst0.Text = "ISTbitŉ(IST=0)";
			// 
			// optPPollResponseSrq
			// 
			this.optPPollResponseSrq.BackColor = System.Drawing.SystemColors.Control;
			this.optPPollResponseSrq.Cursor = System.Windows.Forms.Cursors.Default;
			this.optPPollResponseSrq.ForeColor = System.Drawing.SystemColors.ControlText;
			this.optPPollResponseSrq.Location = new System.Drawing.Point(8, 96);
			this.optPPollResponseSrq.Name = "optPPollResponseSrq";
			this.optPPollResponseSrq.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.optPPollResponseSrq.Size = new System.Drawing.Size(129, 16);
			this.optPPollResponseSrq.TabIndex = 17;
			this.optPPollResponseSrq.TabStop = true;
			this.optPPollResponseSrq.Text = "SRQɂ킹ĉ";
			// 
			// optPPollResponseNot
			// 
			this.optPPollResponseNot.BackColor = System.Drawing.SystemColors.Control;
			this.optPPollResponseNot.Checked = true;
			this.optPPollResponseNot.Cursor = System.Windows.Forms.Cursors.Default;
			this.optPPollResponseNot.ForeColor = System.Drawing.SystemColors.ControlText;
			this.optPPollResponseNot.Location = new System.Drawing.Point(8, 16);
			this.optPPollResponseNot.Name = "optPPollResponseNot";
			this.optPPollResponseNot.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.optPPollResponseNot.Size = new System.Drawing.Size(89, 17);
			this.optPPollResponseNot.TabIndex = 16;
			this.optPPollResponseNot.TabStop = true;
			this.optPPollResponseNot.Text = "Ȃ";
			// 
			// Frame3
			// 
			this.Frame3.BackColor = System.Drawing.SystemColors.Control;
			this.Frame3.Controls.AddRange(new System.Windows.Forms.Control[] {
																				 this.lstRet});
			this.Frame3.ForeColor = System.Drawing.SystemColors.ControlText;
			this.Frame3.Location = new System.Drawing.Point(8, 192);
			this.Frame3.Name = "Frame3";
			this.Frame3.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.Frame3.Size = new System.Drawing.Size(545, 81);
			this.Frame3.TabIndex = 35;
			this.Frame3.TabStop = false;
			this.Frame3.Text = "߂l";
			// 
			// lstRet
			// 
			this.lstRet.BackColor = System.Drawing.SystemColors.Window;
			this.lstRet.Cursor = System.Windows.Forms.Cursors.Default;
			this.lstRet.ForeColor = System.Drawing.SystemColors.WindowText;
			this.lstRet.ItemHeight = 12;
			this.lstRet.Location = new System.Drawing.Point(8, 16);
			this.lstRet.Name = "lstRet";
			this.lstRet.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.lstRet.Size = new System.Drawing.Size(529, 52);
			this.lstRet.TabIndex = 28;
			// 
			// Form_slave
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(5, 12);
			this.ClientSize = new System.Drawing.Size(728, 334);
			this.Controls.AddRange(new System.Windows.Forms.Control[] {
																		  this.cmdInit,
																		  this.cmdDataDel,
																		  this.Frame1,
																		  this.Frame5,
																		  this.Frame2,
																		  this.cmdExit,
																		  this.cmdRetDel,
																		  this.Frame4,
																		  this.Frame3});
			this.Name = "Form_slave";
			this.Text = "Slave";
			this.Load += new System.EventHandler(this.Form_slave_Load);
			this.Frame1.ResumeLayout(false);
			this.Frame5.ResumeLayout(false);
			this.Frame2.ResumeLayout(false);
			this.Frame4.ResumeLayout(false);
			this.Frame3.ResumeLayout(false);
			this.ResumeLayout(false);

		}
		#endregion

		/// <summary>
		/// AvP[ṼC Gg |CgłB
		/// </summary>
		[STAThread]
		static void Main() 
		{
			Application.Run(new Form_slave());
		}

		//**************************************************************************************************
		//   lݒ
		//**************************************************************************************************
		private void Form_slave_Load(object sender, System.EventArgs e)
		{
			txtDevName.Text			= "GPIB000";
			cboDelim.SelectedIndex	= 1;						//CR+LF
			cboEoi.SelectedIndex	= 1;						//o͂
			txtSend.Text			= "CONTEC Slave Sample";	//ftHgMf[^
			txtSPollStb.Text		= "0";
		}

		//**************************************************************************************************
		//   nꂽ߂lXg{bNXɔf܂(Tu[`)
		//**************************************************************************************************
		private void funcSetlstRet(string strRet) 
		{
			//Xg{bNX̍Ōɍڂǉ܂
			//256ڂ𒴂ƍڂSč폜܂
			if (lstRet.Items.Count >= 256)
			{
				lstRet.Items.RemoveAt(0);
				lstRet.Items.Add(strRet);
			}
			else
			{
				lstRet.Items.Add(strRet);
			}
			lstRet.SelectedIndex = lstRet.Items.Count - 1;
		}

		//**************************************************************************************************
		//   @̐ݒ(Tu[`)
		//   @\FEquipent IDEf~^EEOI̐ݒs܂
		//   ߂lF    true(), false(ُ)
		//**************************************************************************************************
		private bool funcSetParam() 
		{
			short	Delim;
			short	Eoi;
			short	Eos;
			int		Ret;
			string	strRet;

			//f~^R[hEOIC̐ݒ
			Delim	= (short)cboDelim.SelectedIndex;
			Eoi		= (short)cboEoi.SelectedIndex;
			Eos		= 0;
			Ret		= gpib.SetDelim(
								m_Id,
								Delim,	//f~^R[h̐ݒ
								Eoi,	//EOIC̐ݒ
								Eos		//EOS̐ݒi\j
								);
			if (Ret != 0)
			{
				//G[̏ꍇ
				gpib.GetErrorString(Ret, out strRet);
				funcSetlstRet(strRet);		//Xgɕ\
				return false;
			}
			else  
			{
				funcSetlstRet("u@̐ݒvI");	//Xgɕ\
			}

			return true;
		}

		//**************************************************************************************************
		//   
		//   @\FfoCXfoCXID擾
		//**************************************************************************************************
		private void cmdInit_Click(object sender, System.EventArgs e)
		{
			int		Ret;
			int		Data;
			string	strRet;

			Ret = gpib.Init(txtDevName.Text, out m_Id);
			if (Ret != 0) 
			{
				//G[̏ꍇ
				gpib.GetErrorString(Ret, out strRet);
				funcSetlstRet(strRet);		//Xgɕ\
			} 
			else  
			{
				//ɃfoCXID擾łꍇ
				strRet = "GpibInit : foCXID = " + m_Id;
				funcSetlstRet(strRet);	//Xgɕ\
				//@AhX̎擾
				Ret = gpib.GetStatus(m_Id, 0x08, out Data);
				if (Ret == 0)
				{
					txtMyAddr.Text = Data.ToString();
				}
				//X[uɐݒ肳Ă邩ǂ̊mF
				Ret = gpib.GetStatus(m_Id, 0x0A, out Data);
				if ((Ret == 0) && (Data == 0)) 
				{
					MessageBox.Show("X[uɐݒ肳Ă܂BvpeBŃX[uɐݒ肵ĂB");
				} 
				else 
				{
					funcSetlstRet("uvI");	//Xgɕ\
				}
			}

			gpib.SendIFC(m_Id, 1);	//IFC𑗏o
		}

		//**************************************************************************************************
		//   I
		//   @\FfoCXID𖳌ɂ
		//**************************************************************************************************
		private void cmdExit_Click(object sender, System.EventArgs e)
		{
			int		Ret;
			string	strRet;

			Ret = gpib.Exit(m_Id);
			if (Ret != 0) 
			{
				//G[̏ꍇ
				gpib.GetErrorString(Ret, out strRet);
				funcSetlstRet(strRet);		//Xgɕ\
			}
			this.Close();
		}

		//**************************************************************************************************
		//   f[^̑M
		//   @\F}X^@Ƀf[^𑗐M
		//**************************************************************************************************
		private void cmdSend_Click(object sender, System.EventArgs e)
		{
			int		SendLen;
			int		Ret;
			string	strRet;
			string	SendBuf;

			//Equipent IDEf~^EEOI̐ݒ
			if (funcSetParam() == false) return;

			//GfBbg{bNX瑗Mf[^擾
			SendBuf	= txtSend.Text;
			SendLen = SendBuf.Length;
			if (SendLen == 0) 
			{
				funcSetlstRet("GpibSendData : Mf[^܂");	//Xgɕ\
				return;
			}

			funcSetlstRet("GpibSendData : M...");		//Xgɕ\
			//Ms
			Ret = gpib.SendData(m_Id, ref SendLen, SendBuf);
			if (Ret != 0) 
			{
				//G[̏ꍇ
				gpib.GetErrorString(Ret, out strRet);
				funcSetlstRet(strRet);						//Xgɕ\
			} 
			else  
			{
				//ɑMłꍇ
				strRet	= "GpibSendData : Mf[^ = " + SendLen.ToString();
				funcSetlstRet(strRet);						//Xgɕ\
				funcSetlstRet("uf[^̑MvI");	//Xgɕ\
			}
		}

		//**************************************************************************************************
		//   f[^̎M
		//   @\F}X^@킩f[^M
		//**************************************************************************************************
		private void cmdRec_Click(object sender, System.EventArgs e)
		{
			int		RecLen;
			int		Ret;
			string	strRet;
			string	RecBuf;

			//Equipent IDEf~^EEOI̐ݒ
			if (funcSetParam() == false) return;

			RecLen = 256;	//Mobt@TCYw
			funcSetlstRet("GpibRecData : M...");	//Xgɕ\
			//Ms
			Ret = gpib.RecData(m_Id, ref RecLen, out RecBuf);
			if (Ret != 0) 
			{
				//G[̏ꍇ
				gpib.GetErrorString(Ret, out strRet);
				funcSetlstRet(strRet);						//Xgɕ\
			} 
			else 
			{
				//ɎMłꍇ
				txtRec.Text	= RecBuf.Substring(0,RecLen);
				strRet	= "GpibRecData : Mf[^ = " + RecLen.ToString();
				funcSetlstRet(strRet);						//Xgɕ\
				funcSetlstRet("uf[^̎MvI");	//Xgɕ\
			}

		}

		//**************************************************************************************************
		//   Xe[^XoCg̐ݒ
		//   @\FSRQoAXe[^XoCgݒ肷
		//**************************************************************************************************
		private void cmdSendSrq_Click(object sender, System.EventArgs e)
		{
			int		Ret;
			string	strRet;
			short	intSrqSend;

			//SRQݒl擾
			if(optSrqNotSend.Checked == true)
			{
				intSrqSend = 0;
			}
			else
			{
				intSrqSend = 1;
			}
			//SRQoAXe[^XoCgݒ֐s
			Ret = gpib.SendSRQ(m_Id, intSrqSend, short.Parse(txtSPollStb.Text));
			if (Ret != 0) 
			{
				//G[̏ꍇ
				gpib.GetErrorString(Ret, out strRet);
				funcSetlstRet(strRet);						//Xgɕ\
			} 
			else 
			{
				funcSetlstRet("uSRQoAXe[^XoCg̐ݒvI");	//Xgɕ\
			}
		}

		//**************************************************************************************************
		//   p|[̐ݒ
		//**************************************************************************************************
		private void cmdParallelpollSetting_Click(object sender, System.EventArgs e)
		{
			short	Response = 0;
			short	Ist = 0;
			int		Ret;
			string	strRet;

			if (optPPollResponseNot.Checked == true)
			{
				//uȂv
				Response	= 0;
			}
			else if(optPPollResponseIst0.Checked == true)
			{
				//uISTbitŉiIST=0jv
				Response	= 1;
				Ist			= 0;
			}
			else if (optPPollResponseIst1.Checked == true)
			{
				//uISTbitŉiIST=1jv
				Response	= 1;
				Ist			= 1;
			}
			else if (optPPollResponseSrq.Checked == true)
			{
				//uSRQɍ킹ĉv
				Response	= 2;
			}

			//p|[ݒ֐̎s
			Ret = gpib.SetPPollResponse(m_Id, Response);
			if (Ret != 0) 
			{
				//G[̏ꍇ
				gpib.GetErrorString(Ret, out strRet);
				funcSetlstRet(strRet);	//Xgɕ\
			} 
			else 
			{
				funcSetlstRet("up|[̐ݒvI");	//Xgɕ\
			}

			if (Response == 1) 
			{
				//ISTbitݒ֐̎s
				Ret = gpib.SetIst(m_Id, Ist);
				if (Ret != 0) 
				{
					//G[̏ꍇ
					gpib.GetErrorString(Ret, out strRet);
					funcSetlstRet(strRet);	//Xgɕ\
				} 
				else 
				{
					funcSetlstRet("up|[ISTݒvI");	//Xgɕ\
				}
			}
		}

		//**************************************************************************************************
		//   MeLXgf[^
		//**************************************************************************************************
		private void cmdDataDel_Click(object sender, System.EventArgs e)
		{
			txtSend.Text	= "";	
			txtRec.Text		= "";
		}

		//**************************************************************************************************
		//   ߂lf[^
		//**************************************************************************************************
		private void cmdRetDel_Click(object sender, System.EventArgs e)
		{
	        lstRet.Items.Clear();
		}

	}
}
