﻿using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using CdioCs;

namespace MultiIO
{
	/// <summary>
	/// Summary description for MultiIO.
	/// </summary>
	public class MultiIO : System.Windows.Forms.Form
	{
		private System.Windows.Forms.Label label_DeviceName;
		private System.Windows.Forms.TextBox textBox_DeviceName;
		private System.Windows.Forms.GroupBox groupBox_MultiPortInput;
		private System.Windows.Forms.Label label_MultiPortInput_PortData;
		private System.Windows.Forms.Label label_MultiPortInput_0;
		private System.Windows.Forms.Label label_MultiPortInput_1;
		private System.Windows.Forms.Label label_MultiPortInput_2;
		private System.Windows.Forms.Label label_MultiPortInput_3;
		private System.Windows.Forms.Label label_MultiPortInput_4;
		private System.Windows.Forms.Label label_MultiPortInput_5;
		private System.Windows.Forms.Label label_MultiPortInput_6;
		private System.Windows.Forms.Label label_MultiPortInput_7;
		private System.Windows.Forms.TextBox textBox_MultiPortInput_0;
		private System.Windows.Forms.TextBox textBox_MultiPortInput_1;
		private System.Windows.Forms.TextBox textBox_MultiPortInput_2;
		private System.Windows.Forms.TextBox textBox_MultiPortInput_3;
		private System.Windows.Forms.TextBox textBox_MultiPortInput_4;
		private System.Windows.Forms.TextBox textBox_MultiPortInput_5;
		private System.Windows.Forms.TextBox textBox_MultiPortInput_6;
		private System.Windows.Forms.TextBox textBox_MultiPortInput_7;
		private System.Windows.Forms.Button button_DioInpMutiByte;
		private System.Windows.Forms.Button button_DioInit;
		private System.Windows.Forms.GroupBox groupBox_MultiBitInput;
		private System.Windows.Forms.Label label_BitData;
		private System.Windows.Forms.Label label_MultiBit_0;
		private System.Windows.Forms.Label label_MultiBit_1;
		private System.Windows.Forms.Label label_MultiBit_2;
		private System.Windows.Forms.Label label_MultiBit_3;
		private System.Windows.Forms.Label label_MultiBit_4;
		private System.Windows.Forms.Label label_MultiBit_5;
		private System.Windows.Forms.Label label_MultiBit_6;
		private System.Windows.Forms.Label label_MultiBit_7;
		private System.Windows.Forms.TextBox textBox_MultiBitInput_0;
		private System.Windows.Forms.TextBox textBox_MultiBitInput_1;
		private System.Windows.Forms.TextBox textBox_MultiBitInput_2;
		private System.Windows.Forms.TextBox textBox_MultiBitInput_3;
		private System.Windows.Forms.TextBox textBox_MultiBitInput_4;
		private System.Windows.Forms.TextBox textBox_MultiBitInput_5;
		private System.Windows.Forms.TextBox textBox_MultiBitInput_6;
		private System.Windows.Forms.TextBox textBox_MultiBitInput_7;
		private System.Windows.Forms.Button button_DioInpMutiBit;
		private System.Windows.Forms.GroupBox groupBoxMultiBitOutput;
		private System.Windows.Forms.Label label_MultiBitOutput_BitData;
		private System.Windows.Forms.Label label_MultiBitOutput_0;
		private System.Windows.Forms.Label label_MultiBitOutput_1;
		private System.Windows.Forms.Label label_MultiBitOutput_2;
		private System.Windows.Forms.Label label_MultiBitOutput_3;
		private System.Windows.Forms.Label label_MultiBitOutput_4;
		private System.Windows.Forms.Label label_MultiBitOutput_5;
		private System.Windows.Forms.Label label_MultiBitOutput_6;
		private System.Windows.Forms.Label label_MultiBitOutput_7;
		private System.Windows.Forms.TextBox textBox_MultiBitOutput_0;
		private System.Windows.Forms.TextBox textBox_MultiBitOutput_1;
		private System.Windows.Forms.TextBox textBox_MultiBitOutput_2;
		private System.Windows.Forms.TextBox textBox_MultiBitOutput_3;
		private System.Windows.Forms.TextBox textBox_MultiBitOutput_4;
		private System.Windows.Forms.TextBox textBox_MultiBitOutput_5;
		private System.Windows.Forms.TextBox textBox_MultiBitOutput_6;
		private System.Windows.Forms.TextBox textBox_MultiBitOutput_7;
		private System.Windows.Forms.Button button_DioOutMutiBit;
		private System.Windows.Forms.GroupBox groupBox_MultiPortOutput;
		private System.Windows.Forms.Label label1_MultiPortOutput_PortData;
		private System.Windows.Forms.Label label_MultiPortOutput_0;
		private System.Windows.Forms.Label label_MultiPortOutput_1;
		private System.Windows.Forms.Label label_MultiPortOutput_2;
		private System.Windows.Forms.Label label_MultiPortOutput_3;
		private System.Windows.Forms.Label label_MultiPortOutput_4;
		private System.Windows.Forms.Label label_MultiPortOutput_5;
		private System.Windows.Forms.Label label_MultiPortOutput_6;
		private System.Windows.Forms.Label label_MultiPortOutput_7;
		private System.Windows.Forms.TextBox textBox_MultiPortOutput_0;
		private System.Windows.Forms.TextBox textBox_MultiPortOutput_1;
		private System.Windows.Forms.TextBox textBox_MultiPortOutput_2;
		private System.Windows.Forms.TextBox textBox_MultiPortOutput_3;
		private System.Windows.Forms.TextBox textBox_MultiPortOutput_4;
		private System.Windows.Forms.TextBox textBox_MultiPortOutput_5;
		private System.Windows.Forms.TextBox textBox_MultiPortOutput_6;
		private System.Windows.Forms.TextBox textBox_MultiPortOutput_7;
		private System.Windows.Forms.Button button_DioOutMultiByte;
		private System.Windows.Forms.Label label_ReturnCode;
		private System.Windows.Forms.TextBox textBox_ReturnCode;
		private System.Windows.Forms.Button button_DioExit;
		private System.Windows.Forms.Button button_Exit;
		private System.Windows.Forms.GroupBox groupBox1;
		private System.Windows.Forms.Label label1;
		private System.Windows.Forms.TextBox textBox_DirData;
		private System.Windows.Forms.Button button_DioSetIoDirection;
		/// <summary>
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.Container components = null;

		private System.Windows.Forms.TextBox[] m_InPort = new System.Windows.Forms.TextBox[8];
		private System.Windows.Forms.TextBox[] m_InBit = new System.Windows.Forms.TextBox[8];
		private System.Windows.Forms.TextBox[] m_OutPort = new System.Windows.Forms.TextBox[8];
		private System.Windows.Forms.TextBox[] m_OutBit = new System.Windows.Forms.TextBox[8];

		/// <summary>
		/// Create instance Cdio class
		/// </summary>
		Cdio  dio = new Cdio();

		public short m_Id;
		public short m_InPortNum;
		public short m_OutPortNum;

		public MultiIO()
		{
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();

			//
			// TODO: Add any constructor code after InitializeComponent call
			//
			m_InPort[0] = textBox_MultiPortInput_0;
			m_InPort[1] = textBox_MultiPortInput_1;
			m_InPort[2] = textBox_MultiPortInput_2;
			m_InPort[3] = textBox_MultiPortInput_3;
			m_InPort[4] = textBox_MultiPortInput_4;
			m_InPort[5] = textBox_MultiPortInput_5;
			m_InPort[6] = textBox_MultiPortInput_6;
			m_InPort[7] = textBox_MultiPortInput_7;

			m_InBit[0] = textBox_MultiBitInput_0;
			m_InBit[1] = textBox_MultiBitInput_1;
			m_InBit[2] = textBox_MultiBitInput_2;
			m_InBit[3] = textBox_MultiBitInput_3;
			m_InBit[4] = textBox_MultiBitInput_4;
			m_InBit[5] = textBox_MultiBitInput_5;
			m_InBit[6] = textBox_MultiBitInput_6;
			m_InBit[7] = textBox_MultiBitInput_7;

			m_OutPort[0] = textBox_MultiPortOutput_0;
			m_OutPort[1] = textBox_MultiPortOutput_1;
			m_OutPort[2] = textBox_MultiPortOutput_2;
			m_OutPort[3] = textBox_MultiPortOutput_3;
			m_OutPort[4] = textBox_MultiPortOutput_4;
			m_OutPort[5] = textBox_MultiPortOutput_5;
			m_OutPort[6] = textBox_MultiPortOutput_6;
			m_OutPort[7] = textBox_MultiPortOutput_7;

			m_OutBit[0] = textBox_MultiBitOutput_0;
			m_OutBit[1] = textBox_MultiBitOutput_1;
			m_OutBit[2] = textBox_MultiBitOutput_2;
			m_OutBit[3] = textBox_MultiBitOutput_3;
			m_OutBit[4] = textBox_MultiBitOutput_4;
			m_OutBit[5] = textBox_MultiBitOutput_5;
			m_OutBit[6] = textBox_MultiBitOutput_6;
			m_OutBit[7] = textBox_MultiBitOutput_7;
		}

		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if (components != null) 
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
			this.label_DeviceName = new System.Windows.Forms.Label();
			this.textBox_DeviceName = new System.Windows.Forms.TextBox();
			this.groupBox_MultiPortInput = new System.Windows.Forms.GroupBox();
			this.label_MultiPortInput_PortData = new System.Windows.Forms.Label();
			this.label_MultiPortInput_0 = new System.Windows.Forms.Label();
			this.label_MultiPortInput_1 = new System.Windows.Forms.Label();
			this.label_MultiPortInput_2 = new System.Windows.Forms.Label();
			this.label_MultiPortInput_3 = new System.Windows.Forms.Label();
			this.label_MultiPortInput_4 = new System.Windows.Forms.Label();
			this.label_MultiPortInput_5 = new System.Windows.Forms.Label();
			this.label_MultiPortInput_6 = new System.Windows.Forms.Label();
			this.label_MultiPortInput_7 = new System.Windows.Forms.Label();
			this.textBox_MultiPortInput_0 = new System.Windows.Forms.TextBox();
			this.textBox_MultiPortInput_1 = new System.Windows.Forms.TextBox();
			this.textBox_MultiPortInput_2 = new System.Windows.Forms.TextBox();
			this.textBox_MultiPortInput_3 = new System.Windows.Forms.TextBox();
			this.textBox_MultiPortInput_4 = new System.Windows.Forms.TextBox();
			this.textBox_MultiPortInput_5 = new System.Windows.Forms.TextBox();
			this.textBox_MultiPortInput_6 = new System.Windows.Forms.TextBox();
			this.textBox_MultiPortInput_7 = new System.Windows.Forms.TextBox();
			this.button_DioInpMutiByte = new System.Windows.Forms.Button();
			this.button_DioInit = new System.Windows.Forms.Button();
			this.groupBox_MultiBitInput = new System.Windows.Forms.GroupBox();
			this.label_BitData = new System.Windows.Forms.Label();
			this.label_MultiBit_0 = new System.Windows.Forms.Label();
			this.label_MultiBit_1 = new System.Windows.Forms.Label();
			this.label_MultiBit_2 = new System.Windows.Forms.Label();
			this.label_MultiBit_3 = new System.Windows.Forms.Label();
			this.label_MultiBit_4 = new System.Windows.Forms.Label();
			this.label_MultiBit_5 = new System.Windows.Forms.Label();
			this.label_MultiBit_6 = new System.Windows.Forms.Label();
			this.label_MultiBit_7 = new System.Windows.Forms.Label();
			this.textBox_MultiBitInput_0 = new System.Windows.Forms.TextBox();
			this.textBox_MultiBitInput_1 = new System.Windows.Forms.TextBox();
			this.textBox_MultiBitInput_2 = new System.Windows.Forms.TextBox();
			this.textBox_MultiBitInput_3 = new System.Windows.Forms.TextBox();
			this.textBox_MultiBitInput_4 = new System.Windows.Forms.TextBox();
			this.textBox_MultiBitInput_5 = new System.Windows.Forms.TextBox();
			this.textBox_MultiBitInput_6 = new System.Windows.Forms.TextBox();
			this.textBox_MultiBitInput_7 = new System.Windows.Forms.TextBox();
			this.button_DioInpMutiBit = new System.Windows.Forms.Button();
			this.groupBoxMultiBitOutput = new System.Windows.Forms.GroupBox();
			this.label_MultiBitOutput_BitData = new System.Windows.Forms.Label();
			this.label_MultiBitOutput_0 = new System.Windows.Forms.Label();
			this.label_MultiBitOutput_1 = new System.Windows.Forms.Label();
			this.label_MultiBitOutput_2 = new System.Windows.Forms.Label();
			this.label_MultiBitOutput_3 = new System.Windows.Forms.Label();
			this.label_MultiBitOutput_4 = new System.Windows.Forms.Label();
			this.label_MultiBitOutput_5 = new System.Windows.Forms.Label();
			this.label_MultiBitOutput_6 = new System.Windows.Forms.Label();
			this.label_MultiBitOutput_7 = new System.Windows.Forms.Label();
			this.textBox_MultiBitOutput_0 = new System.Windows.Forms.TextBox();
			this.textBox_MultiBitOutput_1 = new System.Windows.Forms.TextBox();
			this.textBox_MultiBitOutput_2 = new System.Windows.Forms.TextBox();
			this.textBox_MultiBitOutput_3 = new System.Windows.Forms.TextBox();
			this.textBox_MultiBitOutput_4 = new System.Windows.Forms.TextBox();
			this.textBox_MultiBitOutput_5 = new System.Windows.Forms.TextBox();
			this.textBox_MultiBitOutput_6 = new System.Windows.Forms.TextBox();
			this.textBox_MultiBitOutput_7 = new System.Windows.Forms.TextBox();
			this.button_DioOutMutiBit = new System.Windows.Forms.Button();
			this.groupBox_MultiPortOutput = new System.Windows.Forms.GroupBox();
			this.label1_MultiPortOutput_PortData = new System.Windows.Forms.Label();
			this.label_MultiPortOutput_0 = new System.Windows.Forms.Label();
			this.label_MultiPortOutput_1 = new System.Windows.Forms.Label();
			this.label_MultiPortOutput_2 = new System.Windows.Forms.Label();
			this.label_MultiPortOutput_3 = new System.Windows.Forms.Label();
			this.label_MultiPortOutput_4 = new System.Windows.Forms.Label();
			this.label_MultiPortOutput_5 = new System.Windows.Forms.Label();
			this.label_MultiPortOutput_6 = new System.Windows.Forms.Label();
			this.label_MultiPortOutput_7 = new System.Windows.Forms.Label();
			this.textBox_MultiPortOutput_0 = new System.Windows.Forms.TextBox();
			this.textBox_MultiPortOutput_1 = new System.Windows.Forms.TextBox();
			this.textBox_MultiPortOutput_2 = new System.Windows.Forms.TextBox();
			this.textBox_MultiPortOutput_3 = new System.Windows.Forms.TextBox();
			this.textBox_MultiPortOutput_4 = new System.Windows.Forms.TextBox();
			this.textBox_MultiPortOutput_5 = new System.Windows.Forms.TextBox();
			this.textBox_MultiPortOutput_6 = new System.Windows.Forms.TextBox();
			this.textBox_MultiPortOutput_7 = new System.Windows.Forms.TextBox();
			this.button_DioOutMultiByte = new System.Windows.Forms.Button();
			this.label_ReturnCode = new System.Windows.Forms.Label();
			this.textBox_ReturnCode = new System.Windows.Forms.TextBox();
			this.button_DioExit = new System.Windows.Forms.Button();
			this.button_Exit = new System.Windows.Forms.Button();
			this.groupBox1 = new System.Windows.Forms.GroupBox();
			this.button_DioSetIoDirection = new System.Windows.Forms.Button();
			this.textBox_DirData = new System.Windows.Forms.TextBox();
			this.label1 = new System.Windows.Forms.Label();
			this.groupBox_MultiPortInput.SuspendLayout();
			this.groupBox_MultiBitInput.SuspendLayout();
			this.groupBoxMultiBitOutput.SuspendLayout();
			this.groupBox_MultiPortOutput.SuspendLayout();
			this.groupBox1.SuspendLayout();
			this.SuspendLayout();
			// 
			// label_DeviceName
			// 
			this.label_DeviceName.Location = new System.Drawing.Point(24, 24);
			this.label_DeviceName.Name = "label_DeviceName";
			this.label_DeviceName.TabIndex = 0;
			this.label_DeviceName.Text = "Device Name:";
			// 
			// textBox_DeviceName
			// 
			this.textBox_DeviceName.Location = new System.Drawing.Point(128, 24);
			this.textBox_DeviceName.Name = "textBox_DeviceName";
			this.textBox_DeviceName.TabIndex = 1;
			this.textBox_DeviceName.Text = "DIO000";
			// 
			// groupBox_MultiPortInput
			// 
			this.groupBox_MultiPortInput.Controls.AddRange(new System.Windows.Forms.Control[] {
																								  this.label_MultiPortInput_PortData,
																								  this.label_MultiPortInput_0,
																								  this.label_MultiPortInput_1,
																								  this.label_MultiPortInput_2,
																								  this.label_MultiPortInput_3,
																								  this.label_MultiPortInput_4,
																								  this.label_MultiPortInput_5,
																								  this.label_MultiPortInput_6,
																								  this.label_MultiPortInput_7,
																								  this.textBox_MultiPortInput_0,
																								  this.textBox_MultiPortInput_1,
																								  this.textBox_MultiPortInput_2,
																								  this.textBox_MultiPortInput_3,
																								  this.textBox_MultiPortInput_4,
																								  this.textBox_MultiPortInput_5,
																								  this.textBox_MultiPortInput_6,
																								  this.textBox_MultiPortInput_7,
																								  this.button_DioInpMutiByte});
			this.groupBox_MultiPortInput.Location = new System.Drawing.Point(24, 134);
			this.groupBox_MultiPortInput.Name = "groupBox_MultiPortInput";
			this.groupBox_MultiPortInput.Size = new System.Drawing.Size(504, 72);
			this.groupBox_MultiPortInput.TabIndex = 2;
			this.groupBox_MultiPortInput.TabStop = false;
			this.groupBox_MultiPortInput.Text = "MultiPort Input";
			// 
			// label_MultiPortInput_PortData
			// 
			this.label_MultiPortInput_PortData.Location = new System.Drawing.Point(16, 40);
			this.label_MultiPortInput_PortData.Name = "label_MultiPortInput_PortData";
			this.label_MultiPortInput_PortData.TabIndex = 3;
			this.label_MultiPortInput_PortData.Text = "Port Data:";
			// 
			// label_MultiPortInput_0
			// 
			this.label_MultiPortInput_0.Location = new System.Drawing.Point(128, 16);
			this.label_MultiPortInput_0.Name = "label_MultiPortInput_0";
			this.label_MultiPortInput_0.Size = new System.Drawing.Size(16, 23);
			this.label_MultiPortInput_0.TabIndex = 4;
			this.label_MultiPortInput_0.Text = "0";
			// 
			// label_MultiPortInput_1
			// 
			this.label_MultiPortInput_1.Location = new System.Drawing.Point(160, 16);
			this.label_MultiPortInput_1.Name = "label_MultiPortInput_1";
			this.label_MultiPortInput_1.Size = new System.Drawing.Size(16, 23);
			this.label_MultiPortInput_1.TabIndex = 5;
			this.label_MultiPortInput_1.Text = "1";
			// 
			// label_MultiPortInput_2
			// 
			this.label_MultiPortInput_2.Location = new System.Drawing.Point(192, 16);
			this.label_MultiPortInput_2.Name = "label_MultiPortInput_2";
			this.label_MultiPortInput_2.Size = new System.Drawing.Size(16, 23);
			this.label_MultiPortInput_2.TabIndex = 6;
			this.label_MultiPortInput_2.Text = "2";
			// 
			// label_MultiPortInput_3
			// 
			this.label_MultiPortInput_3.Location = new System.Drawing.Point(224, 16);
			this.label_MultiPortInput_3.Name = "label_MultiPortInput_3";
			this.label_MultiPortInput_3.Size = new System.Drawing.Size(16, 23);
			this.label_MultiPortInput_3.TabIndex = 7;
			this.label_MultiPortInput_3.Text = "3";
			// 
			// label_MultiPortInput_4
			// 
			this.label_MultiPortInput_4.Location = new System.Drawing.Point(256, 16);
			this.label_MultiPortInput_4.Name = "label_MultiPortInput_4";
			this.label_MultiPortInput_4.Size = new System.Drawing.Size(16, 23);
			this.label_MultiPortInput_4.TabIndex = 7;
			this.label_MultiPortInput_4.Text = "4";
			// 
			// label_MultiPortInput_5
			// 
			this.label_MultiPortInput_5.Location = new System.Drawing.Point(288, 16);
			this.label_MultiPortInput_5.Name = "label_MultiPortInput_5";
			this.label_MultiPortInput_5.Size = new System.Drawing.Size(16, 23);
			this.label_MultiPortInput_5.TabIndex = 7;
			this.label_MultiPortInput_5.Text = "5";
			// 
			// label_MultiPortInput_6
			// 
			this.label_MultiPortInput_6.Location = new System.Drawing.Point(320, 16);
			this.label_MultiPortInput_6.Name = "label_MultiPortInput_6";
			this.label_MultiPortInput_6.Size = new System.Drawing.Size(16, 23);
			this.label_MultiPortInput_6.TabIndex = 7;
			this.label_MultiPortInput_6.Text = "6";
			// 
			// label_MultiPortInput_7
			// 
			this.label_MultiPortInput_7.Location = new System.Drawing.Point(352, 16);
			this.label_MultiPortInput_7.Name = "label_MultiPortInput_7";
			this.label_MultiPortInput_7.Size = new System.Drawing.Size(16, 23);
			this.label_MultiPortInput_7.TabIndex = 7;
			this.label_MultiPortInput_7.Text = "7";
			// 
			// textBox_MultiPortInput_0
			// 
			this.textBox_MultiPortInput_0.Location = new System.Drawing.Point(120, 40);
			this.textBox_MultiPortInput_0.Name = "textBox_MultiPortInput_0";
			this.textBox_MultiPortInput_0.Size = new System.Drawing.Size(24, 19);
			this.textBox_MultiPortInput_0.TabIndex = 3;
			this.textBox_MultiPortInput_0.Text = "0";
			this.textBox_MultiPortInput_0.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
			// 
			// textBox_MultiPortInput_1
			// 
			this.textBox_MultiPortInput_1.Location = new System.Drawing.Point(152, 40);
			this.textBox_MultiPortInput_1.Name = "textBox_MultiPortInput_1";
			this.textBox_MultiPortInput_1.Size = new System.Drawing.Size(24, 19);
			this.textBox_MultiPortInput_1.TabIndex = 4;
			this.textBox_MultiPortInput_1.Text = "0";
			this.textBox_MultiPortInput_1.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
			// 
			// textBox_MultiPortInput_2
			// 
			this.textBox_MultiPortInput_2.Location = new System.Drawing.Point(184, 40);
			this.textBox_MultiPortInput_2.Name = "textBox_MultiPortInput_2";
			this.textBox_MultiPortInput_2.Size = new System.Drawing.Size(24, 19);
			this.textBox_MultiPortInput_2.TabIndex = 5;
			this.textBox_MultiPortInput_2.Text = "0";
			this.textBox_MultiPortInput_2.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
			// 
			// textBox_MultiPortInput_3
			// 
			this.textBox_MultiPortInput_3.Location = new System.Drawing.Point(216, 40);
			this.textBox_MultiPortInput_3.Name = "textBox_MultiPortInput_3";
			this.textBox_MultiPortInput_3.Size = new System.Drawing.Size(24, 19);
			this.textBox_MultiPortInput_3.TabIndex = 5;
			this.textBox_MultiPortInput_3.Text = "0";
			this.textBox_MultiPortInput_3.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
			// 
			// textBox_MultiPortInput_4
			// 
			this.textBox_MultiPortInput_4.Location = new System.Drawing.Point(248, 40);
			this.textBox_MultiPortInput_4.Name = "textBox_MultiPortInput_4";
			this.textBox_MultiPortInput_4.Size = new System.Drawing.Size(24, 19);
			this.textBox_MultiPortInput_4.TabIndex = 5;
			this.textBox_MultiPortInput_4.Text = "0";
			this.textBox_MultiPortInput_4.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
			// 
			// textBox_MultiPortInput_5
			// 
			this.textBox_MultiPortInput_5.Location = new System.Drawing.Point(280, 40);
			this.textBox_MultiPortInput_5.Name = "textBox_MultiPortInput_5";
			this.textBox_MultiPortInput_5.Size = new System.Drawing.Size(24, 19);
			this.textBox_MultiPortInput_5.TabIndex = 5;
			this.textBox_MultiPortInput_5.Text = "0";
			this.textBox_MultiPortInput_5.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
			// 
			// textBox_MultiPortInput_6
			// 
			this.textBox_MultiPortInput_6.Location = new System.Drawing.Point(312, 40);
			this.textBox_MultiPortInput_6.Name = "textBox_MultiPortInput_6";
			this.textBox_MultiPortInput_6.Size = new System.Drawing.Size(24, 19);
			this.textBox_MultiPortInput_6.TabIndex = 5;
			this.textBox_MultiPortInput_6.Text = "0";
			this.textBox_MultiPortInput_6.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
			// 
			// textBox_MultiPortInput_7
			// 
			this.textBox_MultiPortInput_7.Location = new System.Drawing.Point(344, 40);
			this.textBox_MultiPortInput_7.Name = "textBox_MultiPortInput_7";
			this.textBox_MultiPortInput_7.Size = new System.Drawing.Size(24, 19);
			this.textBox_MultiPortInput_7.TabIndex = 5;
			this.textBox_MultiPortInput_7.Text = "0";
			this.textBox_MultiPortInput_7.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
			// 
			// button_DioInpMutiByte
			// 
			this.button_DioInpMutiByte.Location = new System.Drawing.Point(384, 40);
			this.button_DioInpMutiByte.Name = "button_DioInpMutiByte";
			this.button_DioInpMutiByte.Size = new System.Drawing.Size(104, 23);
			this.button_DioInpMutiByte.TabIndex = 3;
			this.button_DioInpMutiByte.Text = "DioInpMultiByte";
			this.button_DioInpMutiByte.Click += new System.EventHandler(this.button_DioInpMutiByte_Click);
			// 
			// button_DioInit
			// 
			this.button_DioInit.Location = new System.Drawing.Point(408, 24);
			this.button_DioInit.Name = "button_DioInit";
			this.button_DioInit.Size = new System.Drawing.Size(104, 23);
			this.button_DioInit.TabIndex = 4;
			this.button_DioInit.Text = "DioInit";
			this.button_DioInit.Click += new System.EventHandler(this.button_DioInit_Click);
			// 
			// groupBox_MultiBitInput
			// 
			this.groupBox_MultiBitInput.Controls.AddRange(new System.Windows.Forms.Control[] {
																								 this.label_BitData,
																								 this.label_MultiBit_0,
																								 this.label_MultiBit_1,
																								 this.label_MultiBit_2,
																								 this.label_MultiBit_3,
																								 this.label_MultiBit_4,
																								 this.label_MultiBit_5,
																								 this.label_MultiBit_6,
																								 this.label_MultiBit_7,
																								 this.textBox_MultiBitInput_0,
																								 this.textBox_MultiBitInput_1,
																								 this.textBox_MultiBitInput_2,
																								 this.textBox_MultiBitInput_3,
																								 this.textBox_MultiBitInput_4,
																								 this.textBox_MultiBitInput_5,
																								 this.textBox_MultiBitInput_6,
																								 this.textBox_MultiBitInput_7,
																								 this.button_DioInpMutiBit});
			this.groupBox_MultiBitInput.Location = new System.Drawing.Point(24, 212);
			this.groupBox_MultiBitInput.Name = "groupBox_MultiBitInput";
			this.groupBox_MultiBitInput.Size = new System.Drawing.Size(504, 72);
			this.groupBox_MultiBitInput.TabIndex = 5;
			this.groupBox_MultiBitInput.TabStop = false;
			this.groupBox_MultiBitInput.Text = "MultiBit Input";
			// 
			// label_BitData
			// 
			this.label_BitData.Location = new System.Drawing.Point(16, 40);
			this.label_BitData.Name = "label_BitData";
			this.label_BitData.TabIndex = 3;
			this.label_BitData.Text = "Bit Data:";
			// 
			// label_MultiBit_0
			// 
			this.label_MultiBit_0.Location = new System.Drawing.Point(128, 16);
			this.label_MultiBit_0.Name = "label_MultiBit_0";
			this.label_MultiBit_0.Size = new System.Drawing.Size(16, 23);
			this.label_MultiBit_0.TabIndex = 4;
			this.label_MultiBit_0.Text = "0";
			// 
			// label_MultiBit_1
			// 
			this.label_MultiBit_1.Location = new System.Drawing.Point(160, 16);
			this.label_MultiBit_1.Name = "label_MultiBit_1";
			this.label_MultiBit_1.Size = new System.Drawing.Size(16, 23);
			this.label_MultiBit_1.TabIndex = 5;
			this.label_MultiBit_1.Text = "1";
			// 
			// label_MultiBit_2
			// 
			this.label_MultiBit_2.Location = new System.Drawing.Point(192, 16);
			this.label_MultiBit_2.Name = "label_MultiBit_2";
			this.label_MultiBit_2.Size = new System.Drawing.Size(16, 23);
			this.label_MultiBit_2.TabIndex = 6;
			this.label_MultiBit_2.Text = "2";
			// 
			// label_MultiBit_3
			// 
			this.label_MultiBit_3.Location = new System.Drawing.Point(224, 16);
			this.label_MultiBit_3.Name = "label_MultiBit_3";
			this.label_MultiBit_3.Size = new System.Drawing.Size(16, 23);
			this.label_MultiBit_3.TabIndex = 7;
			this.label_MultiBit_3.Text = "3";
			// 
			// label_MultiBit_4
			// 
			this.label_MultiBit_4.Location = new System.Drawing.Point(256, 16);
			this.label_MultiBit_4.Name = "label_MultiBit_4";
			this.label_MultiBit_4.Size = new System.Drawing.Size(16, 23);
			this.label_MultiBit_4.TabIndex = 7;
			this.label_MultiBit_4.Text = "4";
			// 
			// label_MultiBit_5
			// 
			this.label_MultiBit_5.Location = new System.Drawing.Point(288, 16);
			this.label_MultiBit_5.Name = "label_MultiBit_5";
			this.label_MultiBit_5.Size = new System.Drawing.Size(16, 23);
			this.label_MultiBit_5.TabIndex = 7;
			this.label_MultiBit_5.Text = "5";
			// 
			// label_MultiBit_6
			// 
			this.label_MultiBit_6.Location = new System.Drawing.Point(320, 16);
			this.label_MultiBit_6.Name = "label_MultiBit_6";
			this.label_MultiBit_6.Size = new System.Drawing.Size(16, 23);
			this.label_MultiBit_6.TabIndex = 7;
			this.label_MultiBit_6.Text = "6";
			// 
			// label_MultiBit_7
			// 
			this.label_MultiBit_7.Location = new System.Drawing.Point(352, 16);
			this.label_MultiBit_7.Name = "label_MultiBit_7";
			this.label_MultiBit_7.Size = new System.Drawing.Size(16, 23);
			this.label_MultiBit_7.TabIndex = 7;
			this.label_MultiBit_7.Text = "7";
			// 
			// textBox_MultiBitInput_0
			// 
			this.textBox_MultiBitInput_0.Location = new System.Drawing.Point(120, 40);
			this.textBox_MultiBitInput_0.Name = "textBox_MultiBitInput_0";
			this.textBox_MultiBitInput_0.Size = new System.Drawing.Size(24, 19);
			this.textBox_MultiBitInput_0.TabIndex = 3;
			this.textBox_MultiBitInput_0.Text = "0";
			this.textBox_MultiBitInput_0.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
			// 
			// textBox_MultiBitInput_1
			// 
			this.textBox_MultiBitInput_1.Location = new System.Drawing.Point(152, 40);
			this.textBox_MultiBitInput_1.Name = "textBox_MultiBitInput_1";
			this.textBox_MultiBitInput_1.Size = new System.Drawing.Size(24, 19);
			this.textBox_MultiBitInput_1.TabIndex = 4;
			this.textBox_MultiBitInput_1.Text = "0";
			this.textBox_MultiBitInput_1.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
			// 
			// textBox_MultiBitInput_2
			// 
			this.textBox_MultiBitInput_2.Location = new System.Drawing.Point(184, 40);
			this.textBox_MultiBitInput_2.Name = "textBox_MultiBitInput_2";
			this.textBox_MultiBitInput_2.Size = new System.Drawing.Size(24, 19);
			this.textBox_MultiBitInput_2.TabIndex = 5;
			this.textBox_MultiBitInput_2.Text = "0";
			this.textBox_MultiBitInput_2.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
			// 
			// textBox_MultiBitInput_3
			// 
			this.textBox_MultiBitInput_3.Location = new System.Drawing.Point(216, 40);
			this.textBox_MultiBitInput_3.Name = "textBox_MultiBitInput_3";
			this.textBox_MultiBitInput_3.Size = new System.Drawing.Size(24, 19);
			this.textBox_MultiBitInput_3.TabIndex = 5;
			this.textBox_MultiBitInput_3.Text = "0";
			this.textBox_MultiBitInput_3.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
			// 
			// textBox_MultiBitInput_4
			// 
			this.textBox_MultiBitInput_4.Location = new System.Drawing.Point(248, 40);
			this.textBox_MultiBitInput_4.Name = "textBox_MultiBitInput_4";
			this.textBox_MultiBitInput_4.Size = new System.Drawing.Size(24, 19);
			this.textBox_MultiBitInput_4.TabIndex = 5;
			this.textBox_MultiBitInput_4.Text = "0";
			this.textBox_MultiBitInput_4.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
			// 
			// textBox_MultiBitInput_5
			// 
			this.textBox_MultiBitInput_5.Location = new System.Drawing.Point(280, 40);
			this.textBox_MultiBitInput_5.Name = "textBox_MultiBitInput_5";
			this.textBox_MultiBitInput_5.Size = new System.Drawing.Size(24, 19);
			this.textBox_MultiBitInput_5.TabIndex = 5;
			this.textBox_MultiBitInput_5.Text = "0";
			this.textBox_MultiBitInput_5.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
			// 
			// textBox_MultiBitInput_6
			// 
			this.textBox_MultiBitInput_6.Location = new System.Drawing.Point(312, 40);
			this.textBox_MultiBitInput_6.Name = "textBox_MultiBitInput_6";
			this.textBox_MultiBitInput_6.Size = new System.Drawing.Size(24, 19);
			this.textBox_MultiBitInput_6.TabIndex = 5;
			this.textBox_MultiBitInput_6.Text = "0";
			this.textBox_MultiBitInput_6.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
			// 
			// textBox_MultiBitInput_7
			// 
			this.textBox_MultiBitInput_7.Location = new System.Drawing.Point(344, 40);
			this.textBox_MultiBitInput_7.Name = "textBox_MultiBitInput_7";
			this.textBox_MultiBitInput_7.Size = new System.Drawing.Size(24, 19);
			this.textBox_MultiBitInput_7.TabIndex = 5;
			this.textBox_MultiBitInput_7.Text = "0";
			this.textBox_MultiBitInput_7.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
			// 
			// button_DioInpMutiBit
			// 
			this.button_DioInpMutiBit.Location = new System.Drawing.Point(384, 40);
			this.button_DioInpMutiBit.Name = "button_DioInpMutiBit";
			this.button_DioInpMutiBit.Size = new System.Drawing.Size(104, 23);
			this.button_DioInpMutiBit.TabIndex = 3;
			this.button_DioInpMutiBit.Text = "DioInpMultiBit";
			this.button_DioInpMutiBit.Click += new System.EventHandler(this.button_DioInpMutiBit_Click);
			// 
			// groupBoxMultiBitOutput
			// 
			this.groupBoxMultiBitOutput.Controls.AddRange(new System.Windows.Forms.Control[] {
																								 this.label_MultiBitOutput_BitData,
																								 this.label_MultiBitOutput_0,
																								 this.label_MultiBitOutput_1,
																								 this.label_MultiBitOutput_2,
																								 this.label_MultiBitOutput_3,
																								 this.label_MultiBitOutput_4,
																								 this.label_MultiBitOutput_5,
																								 this.label_MultiBitOutput_6,
																								 this.label_MultiBitOutput_7,
																								 this.textBox_MultiBitOutput_0,
																								 this.textBox_MultiBitOutput_1,
																								 this.textBox_MultiBitOutput_2,
																								 this.textBox_MultiBitOutput_3,
																								 this.textBox_MultiBitOutput_4,
																								 this.textBox_MultiBitOutput_5,
																								 this.textBox_MultiBitOutput_6,
																								 this.textBox_MultiBitOutput_7,
																								 this.button_DioOutMutiBit});
			this.groupBoxMultiBitOutput.Location = new System.Drawing.Point(24, 368);
			this.groupBoxMultiBitOutput.Name = "groupBoxMultiBitOutput";
			this.groupBoxMultiBitOutput.Size = new System.Drawing.Size(504, 72);
			this.groupBoxMultiBitOutput.TabIndex = 7;
			this.groupBoxMultiBitOutput.TabStop = false;
			this.groupBoxMultiBitOutput.Text = "MultiBit Output";
			// 
			// label_MultiBitOutput_BitData
			// 
			this.label_MultiBitOutput_BitData.Location = new System.Drawing.Point(16, 40);
			this.label_MultiBitOutput_BitData.Name = "label_MultiBitOutput_BitData";
			this.label_MultiBitOutput_BitData.TabIndex = 3;
			this.label_MultiBitOutput_BitData.Text = "Bit Data:";
			// 
			// label_MultiBitOutput_0
			// 
			this.label_MultiBitOutput_0.Location = new System.Drawing.Point(128, 16);
			this.label_MultiBitOutput_0.Name = "label_MultiBitOutput_0";
			this.label_MultiBitOutput_0.Size = new System.Drawing.Size(16, 23);
			this.label_MultiBitOutput_0.TabIndex = 4;
			this.label_MultiBitOutput_0.Text = "0";
			// 
			// label_MultiBitOutput_1
			// 
			this.label_MultiBitOutput_1.Location = new System.Drawing.Point(160, 16);
			this.label_MultiBitOutput_1.Name = "label_MultiBitOutput_1";
			this.label_MultiBitOutput_1.Size = new System.Drawing.Size(16, 23);
			this.label_MultiBitOutput_1.TabIndex = 5;
			this.label_MultiBitOutput_1.Text = "1";
			// 
			// label_MultiBitOutput_2
			// 
			this.label_MultiBitOutput_2.Location = new System.Drawing.Point(192, 16);
			this.label_MultiBitOutput_2.Name = "label_MultiBitOutput_2";
			this.label_MultiBitOutput_2.Size = new System.Drawing.Size(16, 23);
			this.label_MultiBitOutput_2.TabIndex = 6;
			this.label_MultiBitOutput_2.Text = "2";
			// 
			// label_MultiBitOutput_3
			// 
			this.label_MultiBitOutput_3.Location = new System.Drawing.Point(224, 16);
			this.label_MultiBitOutput_3.Name = "label_MultiBitOutput_3";
			this.label_MultiBitOutput_3.Size = new System.Drawing.Size(16, 23);
			this.label_MultiBitOutput_3.TabIndex = 7;
			this.label_MultiBitOutput_3.Text = "3";
			// 
			// label_MultiBitOutput_4
			// 
			this.label_MultiBitOutput_4.Location = new System.Drawing.Point(256, 16);
			this.label_MultiBitOutput_4.Name = "label_MultiBitOutput_4";
			this.label_MultiBitOutput_4.Size = new System.Drawing.Size(16, 23);
			this.label_MultiBitOutput_4.TabIndex = 7;
			this.label_MultiBitOutput_4.Text = "4";
			// 
			// label_MultiBitOutput_5
			// 
			this.label_MultiBitOutput_5.Location = new System.Drawing.Point(288, 16);
			this.label_MultiBitOutput_5.Name = "label_MultiBitOutput_5";
			this.label_MultiBitOutput_5.Size = new System.Drawing.Size(16, 23);
			this.label_MultiBitOutput_5.TabIndex = 7;
			this.label_MultiBitOutput_5.Text = "5";
			// 
			// label_MultiBitOutput_6
			// 
			this.label_MultiBitOutput_6.Location = new System.Drawing.Point(320, 16);
			this.label_MultiBitOutput_6.Name = "label_MultiBitOutput_6";
			this.label_MultiBitOutput_6.Size = new System.Drawing.Size(16, 23);
			this.label_MultiBitOutput_6.TabIndex = 7;
			this.label_MultiBitOutput_6.Text = "6";
			// 
			// label_MultiBitOutput_7
			// 
			this.label_MultiBitOutput_7.Location = new System.Drawing.Point(352, 16);
			this.label_MultiBitOutput_7.Name = "label_MultiBitOutput_7";
			this.label_MultiBitOutput_7.Size = new System.Drawing.Size(16, 23);
			this.label_MultiBitOutput_7.TabIndex = 7;
			this.label_MultiBitOutput_7.Text = "7";
			// 
			// textBox_MultiBitOutput_0
			// 
			this.textBox_MultiBitOutput_0.Location = new System.Drawing.Point(120, 40);
			this.textBox_MultiBitOutput_0.Name = "textBox_MultiBitOutput_0";
			this.textBox_MultiBitOutput_0.Size = new System.Drawing.Size(24, 19);
			this.textBox_MultiBitOutput_0.TabIndex = 3;
			this.textBox_MultiBitOutput_0.Text = "0";
			this.textBox_MultiBitOutput_0.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
			// 
			// textBox_MultiBitOutput_1
			// 
			this.textBox_MultiBitOutput_1.Location = new System.Drawing.Point(152, 40);
			this.textBox_MultiBitOutput_1.Name = "textBox_MultiBitOutput_1";
			this.textBox_MultiBitOutput_1.Size = new System.Drawing.Size(24, 19);
			this.textBox_MultiBitOutput_1.TabIndex = 4;
			this.textBox_MultiBitOutput_1.Text = "0";
			this.textBox_MultiBitOutput_1.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
			// 
			// textBox_MultiBitOutput_2
			// 
			this.textBox_MultiBitOutput_2.Location = new System.Drawing.Point(184, 40);
			this.textBox_MultiBitOutput_2.Name = "textBox_MultiBitOutput_2";
			this.textBox_MultiBitOutput_2.Size = new System.Drawing.Size(24, 19);
			this.textBox_MultiBitOutput_2.TabIndex = 5;
			this.textBox_MultiBitOutput_2.Text = "0";
			this.textBox_MultiBitOutput_2.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
			// 
			// textBox_MultiBitOutput_3
			// 
			this.textBox_MultiBitOutput_3.Location = new System.Drawing.Point(216, 40);
			this.textBox_MultiBitOutput_3.Name = "textBox_MultiBitOutput_3";
			this.textBox_MultiBitOutput_3.Size = new System.Drawing.Size(24, 19);
			this.textBox_MultiBitOutput_3.TabIndex = 5;
			this.textBox_MultiBitOutput_3.Text = "0";
			this.textBox_MultiBitOutput_3.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
			// 
			// textBox_MultiBitOutput_4
			// 
			this.textBox_MultiBitOutput_4.Location = new System.Drawing.Point(248, 40);
			this.textBox_MultiBitOutput_4.Name = "textBox_MultiBitOutput_4";
			this.textBox_MultiBitOutput_4.Size = new System.Drawing.Size(24, 19);
			this.textBox_MultiBitOutput_4.TabIndex = 5;
			this.textBox_MultiBitOutput_4.Text = "0";
			this.textBox_MultiBitOutput_4.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
			// 
			// textBox_MultiBitOutput_5
			// 
			this.textBox_MultiBitOutput_5.Location = new System.Drawing.Point(280, 40);
			this.textBox_MultiBitOutput_5.Name = "textBox_MultiBitOutput_5";
			this.textBox_MultiBitOutput_5.Size = new System.Drawing.Size(24, 19);
			this.textBox_MultiBitOutput_5.TabIndex = 5;
			this.textBox_MultiBitOutput_5.Text = "0";
			this.textBox_MultiBitOutput_5.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
			// 
			// textBox_MultiBitOutput_6
			// 
			this.textBox_MultiBitOutput_6.Location = new System.Drawing.Point(312, 40);
			this.textBox_MultiBitOutput_6.Name = "textBox_MultiBitOutput_6";
			this.textBox_MultiBitOutput_6.Size = new System.Drawing.Size(24, 19);
			this.textBox_MultiBitOutput_6.TabIndex = 5;
			this.textBox_MultiBitOutput_6.Text = "0";
			this.textBox_MultiBitOutput_6.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
			// 
			// textBox_MultiBitOutput_7
			// 
			this.textBox_MultiBitOutput_7.Location = new System.Drawing.Point(344, 40);
			this.textBox_MultiBitOutput_7.Name = "textBox_MultiBitOutput_7";
			this.textBox_MultiBitOutput_7.Size = new System.Drawing.Size(24, 19);
			this.textBox_MultiBitOutput_7.TabIndex = 5;
			this.textBox_MultiBitOutput_7.Text = "0";
			this.textBox_MultiBitOutput_7.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
			// 
			// button_DioOutMutiBit
			// 
			this.button_DioOutMutiBit.Location = new System.Drawing.Point(384, 40);
			this.button_DioOutMutiBit.Name = "button_DioOutMutiBit";
			this.button_DioOutMutiBit.Size = new System.Drawing.Size(104, 23);
			this.button_DioOutMutiBit.TabIndex = 3;
			this.button_DioOutMutiBit.Text = "DioOutMultiBit";
			this.button_DioOutMutiBit.Click += new System.EventHandler(this.button_DioOutMutiBit_Click);
			// 
			// groupBox_MultiPortOutput
			// 
			this.groupBox_MultiPortOutput.Controls.AddRange(new System.Windows.Forms.Control[] {
																								   this.label1_MultiPortOutput_PortData,
																								   this.label_MultiPortOutput_0,
																								   this.label_MultiPortOutput_1,
																								   this.label_MultiPortOutput_2,
																								   this.label_MultiPortOutput_3,
																								   this.label_MultiPortOutput_4,
																								   this.label_MultiPortOutput_5,
																								   this.label_MultiPortOutput_6,
																								   this.label_MultiPortOutput_7,
																								   this.textBox_MultiPortOutput_0,
																								   this.textBox_MultiPortOutput_1,
																								   this.textBox_MultiPortOutput_2,
																								   this.textBox_MultiPortOutput_3,
																								   this.textBox_MultiPortOutput_4,
																								   this.textBox_MultiPortOutput_5,
																								   this.textBox_MultiPortOutput_6,
																								   this.textBox_MultiPortOutput_7,
																								   this.button_DioOutMultiByte});
			this.groupBox_MultiPortOutput.Location = new System.Drawing.Point(24, 290);
			this.groupBox_MultiPortOutput.Name = "groupBox_MultiPortOutput";
			this.groupBox_MultiPortOutput.Size = new System.Drawing.Size(504, 72);
			this.groupBox_MultiPortOutput.TabIndex = 6;
			this.groupBox_MultiPortOutput.TabStop = false;
			this.groupBox_MultiPortOutput.Text = "MultiPort Output";
			// 
			// label1_MultiPortOutput_PortData
			// 
			this.label1_MultiPortOutput_PortData.Location = new System.Drawing.Point(16, 40);
			this.label1_MultiPortOutput_PortData.Name = "label1_MultiPortOutput_PortData";
			this.label1_MultiPortOutput_PortData.TabIndex = 3;
			this.label1_MultiPortOutput_PortData.Text = "Port Data:";
			// 
			// label_MultiPortOutput_0
			// 
			this.label_MultiPortOutput_0.Location = new System.Drawing.Point(128, 16);
			this.label_MultiPortOutput_0.Name = "label_MultiPortOutput_0";
			this.label_MultiPortOutput_0.Size = new System.Drawing.Size(16, 23);
			this.label_MultiPortOutput_0.TabIndex = 4;
			this.label_MultiPortOutput_0.Text = "0";
			// 
			// label_MultiPortOutput_1
			// 
			this.label_MultiPortOutput_1.Location = new System.Drawing.Point(160, 16);
			this.label_MultiPortOutput_1.Name = "label_MultiPortOutput_1";
			this.label_MultiPortOutput_1.Size = new System.Drawing.Size(16, 23);
			this.label_MultiPortOutput_1.TabIndex = 5;
			this.label_MultiPortOutput_1.Text = "1";
			// 
			// label_MultiPortOutput_2
			// 
			this.label_MultiPortOutput_2.Location = new System.Drawing.Point(192, 16);
			this.label_MultiPortOutput_2.Name = "label_MultiPortOutput_2";
			this.label_MultiPortOutput_2.Size = new System.Drawing.Size(16, 23);
			this.label_MultiPortOutput_2.TabIndex = 6;
			this.label_MultiPortOutput_2.Text = "2";
			// 
			// label_MultiPortOutput_3
			// 
			this.label_MultiPortOutput_3.Location = new System.Drawing.Point(224, 16);
			this.label_MultiPortOutput_3.Name = "label_MultiPortOutput_3";
			this.label_MultiPortOutput_3.Size = new System.Drawing.Size(16, 23);
			this.label_MultiPortOutput_3.TabIndex = 7;
			this.label_MultiPortOutput_3.Text = "3";
			// 
			// label_MultiPortOutput_4
			// 
			this.label_MultiPortOutput_4.Location = new System.Drawing.Point(256, 16);
			this.label_MultiPortOutput_4.Name = "label_MultiPortOutput_4";
			this.label_MultiPortOutput_4.Size = new System.Drawing.Size(16, 23);
			this.label_MultiPortOutput_4.TabIndex = 7;
			this.label_MultiPortOutput_4.Text = "4";
			// 
			// label_MultiPortOutput_5
			// 
			this.label_MultiPortOutput_5.Location = new System.Drawing.Point(288, 16);
			this.label_MultiPortOutput_5.Name = "label_MultiPortOutput_5";
			this.label_MultiPortOutput_5.Size = new System.Drawing.Size(16, 23);
			this.label_MultiPortOutput_5.TabIndex = 7;
			this.label_MultiPortOutput_5.Text = "5";
			// 
			// label_MultiPortOutput_6
			// 
			this.label_MultiPortOutput_6.Location = new System.Drawing.Point(320, 16);
			this.label_MultiPortOutput_6.Name = "label_MultiPortOutput_6";
			this.label_MultiPortOutput_6.Size = new System.Drawing.Size(16, 23);
			this.label_MultiPortOutput_6.TabIndex = 7;
			this.label_MultiPortOutput_6.Text = "6";
			// 
			// label_MultiPortOutput_7
			// 
			this.label_MultiPortOutput_7.Location = new System.Drawing.Point(352, 16);
			this.label_MultiPortOutput_7.Name = "label_MultiPortOutput_7";
			this.label_MultiPortOutput_7.Size = new System.Drawing.Size(16, 23);
			this.label_MultiPortOutput_7.TabIndex = 7;
			this.label_MultiPortOutput_7.Text = "7";
			// 
			// textBox_MultiPortOutput_0
			// 
			this.textBox_MultiPortOutput_0.Location = new System.Drawing.Point(120, 40);
			this.textBox_MultiPortOutput_0.Name = "textBox_MultiPortOutput_0";
			this.textBox_MultiPortOutput_0.Size = new System.Drawing.Size(24, 19);
			this.textBox_MultiPortOutput_0.TabIndex = 3;
			this.textBox_MultiPortOutput_0.Text = "0";
			this.textBox_MultiPortOutput_0.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
			// 
			// textBox_MultiPortOutput_1
			// 
			this.textBox_MultiPortOutput_1.Location = new System.Drawing.Point(152, 40);
			this.textBox_MultiPortOutput_1.Name = "textBox_MultiPortOutput_1";
			this.textBox_MultiPortOutput_1.Size = new System.Drawing.Size(24, 19);
			this.textBox_MultiPortOutput_1.TabIndex = 4;
			this.textBox_MultiPortOutput_1.Text = "0";
			this.textBox_MultiPortOutput_1.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
			// 
			// textBox_MultiPortOutput_2
			// 
			this.textBox_MultiPortOutput_2.Location = new System.Drawing.Point(184, 40);
			this.textBox_MultiPortOutput_2.Name = "textBox_MultiPortOutput_2";
			this.textBox_MultiPortOutput_2.Size = new System.Drawing.Size(24, 19);
			this.textBox_MultiPortOutput_2.TabIndex = 5;
			this.textBox_MultiPortOutput_2.Text = "0";
			this.textBox_MultiPortOutput_2.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
			// 
			// textBox_MultiPortOutput_3
			// 
			this.textBox_MultiPortOutput_3.Location = new System.Drawing.Point(216, 40);
			this.textBox_MultiPortOutput_3.Name = "textBox_MultiPortOutput_3";
			this.textBox_MultiPortOutput_3.Size = new System.Drawing.Size(24, 19);
			this.textBox_MultiPortOutput_3.TabIndex = 5;
			this.textBox_MultiPortOutput_3.Text = "0";
			this.textBox_MultiPortOutput_3.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
			// 
			// textBox_MultiPortOutput_4
			// 
			this.textBox_MultiPortOutput_4.Location = new System.Drawing.Point(248, 40);
			this.textBox_MultiPortOutput_4.Name = "textBox_MultiPortOutput_4";
			this.textBox_MultiPortOutput_4.Size = new System.Drawing.Size(24, 19);
			this.textBox_MultiPortOutput_4.TabIndex = 5;
			this.textBox_MultiPortOutput_4.Text = "0";
			this.textBox_MultiPortOutput_4.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
			// 
			// textBox_MultiPortOutput_5
			// 
			this.textBox_MultiPortOutput_5.Location = new System.Drawing.Point(280, 40);
			this.textBox_MultiPortOutput_5.Name = "textBox_MultiPortOutput_5";
			this.textBox_MultiPortOutput_5.Size = new System.Drawing.Size(24, 19);
			this.textBox_MultiPortOutput_5.TabIndex = 5;
			this.textBox_MultiPortOutput_5.Text = "0";
			this.textBox_MultiPortOutput_5.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
			// 
			// textBox_MultiPortOutput_6
			// 
			this.textBox_MultiPortOutput_6.Location = new System.Drawing.Point(312, 40);
			this.textBox_MultiPortOutput_6.Name = "textBox_MultiPortOutput_6";
			this.textBox_MultiPortOutput_6.Size = new System.Drawing.Size(24, 19);
			this.textBox_MultiPortOutput_6.TabIndex = 5;
			this.textBox_MultiPortOutput_6.Text = "0";
			this.textBox_MultiPortOutput_6.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
			// 
			// textBox_MultiPortOutput_7
			// 
			this.textBox_MultiPortOutput_7.Location = new System.Drawing.Point(344, 40);
			this.textBox_MultiPortOutput_7.Name = "textBox_MultiPortOutput_7";
			this.textBox_MultiPortOutput_7.Size = new System.Drawing.Size(24, 19);
			this.textBox_MultiPortOutput_7.TabIndex = 5;
			this.textBox_MultiPortOutput_7.Text = "0";
			this.textBox_MultiPortOutput_7.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
			// 
			// button_DioOutMultiByte
			// 
			this.button_DioOutMultiByte.Location = new System.Drawing.Point(384, 40);
			this.button_DioOutMultiByte.Name = "button_DioOutMultiByte";
			this.button_DioOutMultiByte.Size = new System.Drawing.Size(104, 23);
			this.button_DioOutMultiByte.TabIndex = 3;
			this.button_DioOutMultiByte.Text = "DioOutMultiByte";
			this.button_DioOutMultiByte.Click += new System.EventHandler(this.button_DioOutMultiByte_Click);
			// 
			// label_ReturnCode
			// 
			this.label_ReturnCode.Location = new System.Drawing.Point(24, 448);
			this.label_ReturnCode.Name = "label_ReturnCode";
			this.label_ReturnCode.TabIndex = 8;
			this.label_ReturnCode.Text = "Return Code:";
			// 
			// textBox_ReturnCode
			// 
			this.textBox_ReturnCode.Location = new System.Drawing.Point(128, 448);
			this.textBox_ReturnCode.Name = "textBox_ReturnCode";
			this.textBox_ReturnCode.Size = new System.Drawing.Size(264, 19);
			this.textBox_ReturnCode.TabIndex = 9;
			this.textBox_ReturnCode.Text = "";
			// 
			// button_DioExit
			// 
			this.button_DioExit.Location = new System.Drawing.Point(408, 448);
			this.button_DioExit.Name = "button_DioExit";
			this.button_DioExit.Size = new System.Drawing.Size(104, 23);
			this.button_DioExit.TabIndex = 10;
			this.button_DioExit.Text = "DioExit";
			this.button_DioExit.Click += new System.EventHandler(this.button_DioExit_Click);
			// 
			// button_Exit
			// 
			this.button_Exit.Location = new System.Drawing.Point(408, 483);
			this.button_Exit.Name = "button_Exit";
			this.button_Exit.Size = new System.Drawing.Size(104, 23);
			this.button_Exit.TabIndex = 11;
			this.button_Exit.Text = "Exit";
			this.button_Exit.Click += new System.EventHandler(this.button_Exit_Click);
			// 
			// groupBox1
			// 
			this.groupBox1.Controls.AddRange(new System.Windows.Forms.Control[] {
																					this.button_DioSetIoDirection,
																					this.textBox_DirData,
																					this.label1});
			this.groupBox1.Location = new System.Drawing.Point(24, 56);
			this.groupBox1.Name = "groupBox1";
			this.groupBox1.Size = new System.Drawing.Size(504, 72);
			this.groupBox1.TabIndex = 12;
			this.groupBox1.TabStop = false;
			this.groupBox1.Text = "I/O Set";
			// 
			// button_DioSetIoDirection
			// 
			this.button_DioSetIoDirection.Location = new System.Drawing.Point(384, 32);
			this.button_DioSetIoDirection.Name = "button_DioSetIoDirection";
			this.button_DioSetIoDirection.Size = new System.Drawing.Size(104, 23);
			this.button_DioSetIoDirection.TabIndex = 6;
			this.button_DioSetIoDirection.Text = "DioSetIoDirection";
			this.button_DioSetIoDirection.Click += new System.EventHandler(this.button_DioSetIoDirection_Click);
			// 
			// textBox_DirData
			// 
			this.textBox_DirData.Location = new System.Drawing.Point(120, 34);
			this.textBox_DirData.Name = "textBox_DirData";
			this.textBox_DirData.Size = new System.Drawing.Size(83, 19);
			this.textBox_DirData.TabIndex = 5;
			this.textBox_DirData.Text = "";
			// 
			// label1
			// 
			this.label1.Location = new System.Drawing.Point(16, 35);
			this.label1.Name = "label1";
			this.label1.TabIndex = 4;
			this.label1.Text = "I/O Direction:";
			// 
			// MultiIO
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(5, 12);
			this.ClientSize = new System.Drawing.Size(544, 518);
			this.Controls.AddRange(new System.Windows.Forms.Control[] {
																		  this.groupBox1,
																		  this.button_Exit,
																		  this.button_DioExit,
																		  this.textBox_ReturnCode,
																		  this.label_ReturnCode,
																		  this.groupBoxMultiBitOutput,
																		  this.groupBox_MultiPortOutput,
																		  this.groupBox_MultiBitInput,
																		  this.button_DioInit,
																		  this.groupBox_MultiPortInput,
																		  this.textBox_DeviceName,
																		  this.label_DeviceName});
			this.MaximizeBox = false;
			this.MinimizeBox = false;
			this.Name = "MultiIO";
			this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
			this.Text = "MultiIO";
			this.groupBox_MultiPortInput.ResumeLayout(false);
			this.groupBox_MultiBitInput.ResumeLayout(false);
			this.groupBoxMultiBitOutput.ResumeLayout(false);
			this.groupBox_MultiPortOutput.ResumeLayout(false);
			this.groupBox1.ResumeLayout(false);
			this.ResumeLayout(false);

		}
		#endregion

		/// <summary>
		/// The main entry point for the application.
		/// </summary>
		[STAThread]
		static void Main() 
		{
			Application.Run(new MultiIO());
		}

		private void button_DioInit_Click(object sender, System.EventArgs e)
		{
			// Initialization handling
			int	Ret;
			Ret = dio.Init(textBox_DeviceName.Text, out m_Id);

			string	ErrorString;
			dio.GetErrorString(Ret, out ErrorString);
			textBox_ReturnCode.Text = "Ret = " + System.Convert.ToString(Ret) + " : " + ErrorString;
			if (Ret != (int)CdioConst.DIO_ERR_SUCCESS) 
			{
				return;
			}
			//-----------------------------
			// Get all ports number
			//-----------------------------
			Ret = dio.GetMaxPorts(m_Id, out m_InPortNum, out m_OutPortNum);

			dio.GetErrorString(Ret, out ErrorString);
			textBox_ReturnCode.Text = "Ret = " + System.Convert.ToString(Ret) + " : " + ErrorString;
			if (Ret != (int)CdioConst.DIO_ERR_SUCCESS) 
			{
				return;
			}
			// This sample must not exceed 8 ports
			if (m_InPortNum > 8) 
			{
				m_InPortNum = 8;
			}
			if (m_OutPortNum > 8) 
			{
				m_OutPortNum = 8;
			}
			//-----------------------------
			// Mask screen
			//-----------------------------
			for (short InPort = m_InPortNum; InPort < 8; InPort++) 
			{
				m_InPort[InPort].Enabled = false;
			}
			for (short OutPort = m_OutPortNum; OutPort < 8; OutPort++) 
			{
				m_OutPort[OutPort].Enabled = false;
			}
		}

		private void button_DioInpMutiByte_Click(object sender, System.EventArgs e)
		{
			short[]	PortNo = new short[8];
			byte[]	Data = new byte[8];
			//-----------------------------
			// Set Port No.
			//-----------------------------
			for (short InPort = 0; InPort < m_InPortNum; InPort++) 
			{
				PortNo[InPort] = InPort;
			}
			//-----------------------------
			// Port input
			//-----------------------------
			int Ret;
			Ret = dio.InpMultiByte(m_Id, PortNo, m_InPortNum, Data);
			//-----------------------------
			// Error process
			//-----------------------------
			string ErrorString;
			dio.GetErrorString(Ret, out ErrorString);
			textBox_ReturnCode.Text = "Ret = " + System.Convert.ToString(Ret) + " : " + ErrorString;
			if (Ret != (int)CdioConst.DIO_ERR_SUCCESS) 
			{
				return;
			}
			//-----------------------------
			// Data express
			//-----------------------------
			for (short InPort = 0; InPort < m_InPortNum; InPort++) 
			{
				m_InPort[InPort].Text = System.Convert.ToString(Data[InPort], 16);
			}		
		}

		private void button_DioInpMutiBit_Click(object sender, System.EventArgs e)
		{
			short[]	BitNo = new short[8];
			byte[]	Data = new byte[8];
			//-----------------------------
			// Set Bit No.
			//-----------------------------
			for (short InBit = 0; InBit < 8; InBit++) 
			{
				BitNo[InBit] = InBit;
			}
			//-----------------------------
			// Bit input
			//-----------------------------
			int Ret;
			Ret = dio.InpMultiBit(m_Id, BitNo, 8, Data);
			//-----------------------------
			// Error process
			//-----------------------------
			string ErrorString;
			dio.GetErrorString(Ret, out ErrorString);
			textBox_ReturnCode.Text = "Ret = " + System.Convert.ToString(Ret) + " : " + ErrorString;
			if (Ret != (int)CdioConst.DIO_ERR_SUCCESS) 
			{
				return;
			}
			//-----------------------------
			// Data express
			//-----------------------------
			for (short InBit = 0; InBit < 8; InBit++) 
			{
				m_InBit[InBit].Text = System.Convert.ToString(Data[InBit], 16);
			}			
		}

		private void button_DioOutMultiByte_Click(object sender, System.EventArgs e)
		{
			short[]	PortNo = new short[8];
			byte[]	Data = new byte[8];
			//-----------------------------
			// Get data
			//-----------------------------
			for (short OutPort = 0; OutPort < m_OutPortNum; OutPort++) 
			{
				try 
				{
					Data[OutPort] = System.Convert.ToByte(m_OutPort[OutPort].Text, 16);
				}
				catch 
				{
					Data[OutPort] = 0;
				}
			}
			//-----------------------------
			// Set Port No.
			//-----------------------------
			for (short OutPort = 0; OutPort < m_OutPortNum; OutPort++) 
			{
				PortNo[OutPort] = OutPort;
			}
			//-----------------------------
			// Port output
			//-----------------------------
			int Ret;
			Ret = dio.OutMultiByte(m_Id, PortNo, m_OutPortNum, Data);
			//-----------------------------
			// Error process
			//-----------------------------
			string ErrorString;
			dio.GetErrorString(Ret, out ErrorString);
			textBox_ReturnCode.Text = "Ret = " + System.Convert.ToString(Ret) + " : " + ErrorString;
			if (Ret != (int)CdioConst.DIO_ERR_SUCCESS) 
			{
				return;
			}
		}

		private void button_DioOutMutiBit_Click(object sender, System.EventArgs e)
		{
			short[]	BitNo = new short[8];
			byte[]	Data = new byte[8];
			//-----------------------------
			// Get data
			//-----------------------------
			for (short OutBit = 0; OutBit < 8; OutBit++) 
			{
				try 
				{
					Data[OutBit] = System.Convert.ToByte(m_OutBit[OutBit].Text, 16);
				}
				catch 
				{
					Data[OutBit] = 0;
				}
			}
			//-----------------------------
			// Set Bit No.
			//-----------------------------
			for (short OutBit = 0; OutBit < 8; OutBit++) 
			{
				BitNo[OutBit] = OutBit;
			}
			//-----------------------------
			// Bit output
			//-----------------------------
			int Ret;
			Ret = dio.OutMultiBit(m_Id, BitNo, 8, Data);
			//-----------------------------
			// Error process
			//-----------------------------
			string ErrorString;
			dio.GetErrorString(Ret, out ErrorString);
			textBox_ReturnCode.Text = "Ret = " + System.Convert.ToString(Ret) + " : " + ErrorString;
			if (Ret != (int)CdioConst.DIO_ERR_SUCCESS) 
			{
				return;
			}		
		}

		private void button_DioExit_Click(object sender, System.EventArgs e)
		{
			// Exit handling of device
			int	Ret;
			Ret = dio.Exit(m_Id);
			//-----------------------------
			// Error process
			//-----------------------------
			string	ErrorString;
			dio.GetErrorString(Ret, out ErrorString);
			textBox_ReturnCode.Text = "Ret = " + System.Convert.ToString(Ret) + " : " + ErrorString;
		}

		private void button_Exit_Click(object sender, System.EventArgs e)
		{
			this.Close();
		}

		private void button_DioSetIoDirection_Click(object sender, System.EventArgs e)
		{
			uint dwDir;

			//-----------------------------
			// Get IoDirection
			//-----------------------------
			try 
			{
				dwDir = System.Convert.ToByte(textBox_DirData.Text, 16);
			}
			catch 
			{
				dwDir = 0;
			}
			//-----------------------------
			// Set IoDirection
			//-----------------------------
			int	Ret;
			Ret = dio.SetIoDirection(m_Id, dwDir);
			//-----------------------------
			// Error process
			//-----------------------------
			string	ErrorString;
			dio.GetErrorString(Ret, out ErrorString);
			textBox_ReturnCode.Text = "Ret = " + System.Convert.ToString(Ret) + " : " + ErrorString;
		}
	}
}
