using System; using System.Drawing; using System.Collections; using System.Windows.Forms; using System.Data; using Quicker; namespace Quicker_VCSharp_Demo { /// /// Form1 的摘要描述。 /// public class Form1 : System.Windows.Forms.Form { private System.Windows.Forms.Button button1; private System.Windows.Forms.Button button2; internal System.Windows.Forms.TextBox SetDOAdr; internal System.Windows.Forms.Label label2; internal System.Windows.Forms.TextBox UserGetRegStrVal; internal System.Windows.Forms.Button button3; internal System.Windows.Forms.Label label3; internal System.Windows.Forms.Label label4; internal System.Windows.Forms.Label label5; internal System.Windows.Forms.Label label8; internal System.Windows.Forms.Label label9; internal System.Windows.Forms.Label label10; internal System.Windows.Forms.Label label11; internal System.Windows.Forms.Label label12; internal System.Windows.Forms.Label label13; internal System.Windows.Forms.Label label14; internal System.Windows.Forms.Label label15; internal System.Windows.Forms.Label label16; internal System.Windows.Forms.Label label17; internal System.Windows.Forms.Label label18; internal System.Windows.Forms.Label label19; internal System.Windows.Forms.Label label20; internal System.Windows.Forms.Label label21; internal System.Windows.Forms.Label label22; internal System.Windows.Forms.Label label23; internal System.Windows.Forms.TextBox GetDIOAdr; internal System.Windows.Forms.TextBox SetAOAdr; internal System.Windows.Forms.TextBox GetAIOAdr; internal System.Windows.Forms.TextBox MBGetRegAdr; internal System.Windows.Forms.TextBox MBGetCoilAdr; internal System.Windows.Forms.TextBox MBSetCoilAdr; internal System.Windows.Forms.TextBox MBSetRegAdr; internal System.Windows.Forms.TextBox MBSetCoilVal; internal System.Windows.Forms.TextBox SetAOVal; internal System.Windows.Forms.TextBox GetAIOVal; internal System.Windows.Forms.TextBox MBGetCoilVal; internal System.Windows.Forms.TextBox MBSetRegVal; internal System.Windows.Forms.TextBox GetDIOVal; internal System.Windows.Forms.TextBox MBGetRegVal; internal System.Windows.Forms.TextBox SetDOVal; internal System.Windows.Forms.TextBox UserSetRegShortAdr; internal System.Windows.Forms.TextBox UserSetRegFloatAdr; internal System.Windows.Forms.TextBox UserGetRegLongAdr; internal System.Windows.Forms.TextBox UserSetRegLongAdr; internal System.Windows.Forms.TextBox UserGetCoilAdr; internal System.Windows.Forms.TextBox UserSetCoilVal; internal System.Windows.Forms.TextBox UserGetRegLongVal; internal System.Windows.Forms.TextBox UserGetCoilVal; internal System.Windows.Forms.TextBox UserSetRegLongVal; internal System.Windows.Forms.TextBox UserGetRegFloatVal; internal System.Windows.Forms.TextBox UserGetRegShortVal; internal System.Windows.Forms.TextBox UserSetRegShortVal; internal System.Windows.Forms.TextBox UserSetRegFloatVal; internal System.Windows.Forms.TextBox UserGetRegShortAdr; internal System.Windows.Forms.TextBox UserGetRegFloatAdr; internal System.Windows.Forms.TextBox UserSetCoilAdr; internal System.Windows.Forms.TextBox UserSetRegStrAdr; internal System.Windows.Forms.TextBox UserGetRegStrAdr; internal System.Windows.Forms.TextBox UserSetRegStrVal; internal System.Windows.Forms.Button Button4; internal System.Windows.Forms.Button Button5; internal System.Windows.Forms.Button Button6; internal System.Windows.Forms.Button Button7; internal System.Windows.Forms.Button Button8; internal System.Windows.Forms.Button Button9; internal System.Windows.Forms.Button Button10; internal System.Windows.Forms.Button Button11; internal System.Windows.Forms.Button Button12; internal System.Windows.Forms.Button Button13; internal System.Windows.Forms.Button Button14; internal System.Windows.Forms.Button Button15; internal System.Windows.Forms.Button Button16; internal System.Windows.Forms.Button Button17; internal System.Windows.Forms.Button Button18; internal System.Windows.Forms.Button Button19; internal System.Windows.Forms.Button Button20; internal System.Windows.Forms.Label label6; internal System.Windows.Forms.Label label7; internal System.Windows.Forms.Label Label24; internal System.Windows.Forms.Label Label25; internal System.Windows.Forms.Button Button21; internal System.Windows.Forms.Button Button22; internal System.Windows.Forms.TextBox SetAOAdrW; internal System.Windows.Forms.TextBox GetAIOAdrW; internal System.Windows.Forms.TextBox SetAOValW; internal System.Windows.Forms.TextBox GetAIOValW; private System.Windows.Forms.Label label1; public Form1() { // // Windows Form 設計工具支援的必要項 // InitializeComponent(); // // TODO: 在 InitializeComponent 呼叫之後加入任何建構函式程式碼 // } /// /// 清除任何使用中的資源。 /// protected override void Dispose( bool disposing ) { base.Dispose( disposing ); } #region Windows Form 設計工具產生的程式碼 /// /// 此為設計工具支援所必須的方法 - 請勿使用程式碼編輯器修改 /// 這個方法的內容。 /// private void InitializeComponent() { this.label1 = new System.Windows.Forms.Label(); this.button1 = new System.Windows.Forms.Button(); this.button2 = new System.Windows.Forms.Button(); this.SetDOAdr = new System.Windows.Forms.TextBox(); this.label2 = new System.Windows.Forms.Label(); this.UserGetRegStrVal = new System.Windows.Forms.TextBox(); this.button3 = new System.Windows.Forms.Button(); this.label3 = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label(); this.label5 = new System.Windows.Forms.Label(); this.label8 = new System.Windows.Forms.Label(); this.label9 = new System.Windows.Forms.Label(); this.label10 = new System.Windows.Forms.Label(); this.label11 = new System.Windows.Forms.Label(); this.label12 = new System.Windows.Forms.Label(); this.label13 = new System.Windows.Forms.Label(); this.label14 = new System.Windows.Forms.Label(); this.label15 = new System.Windows.Forms.Label(); this.label16 = new System.Windows.Forms.Label(); this.label17 = new System.Windows.Forms.Label(); this.label18 = new System.Windows.Forms.Label(); this.label19 = new System.Windows.Forms.Label(); this.label20 = new System.Windows.Forms.Label(); this.label21 = new System.Windows.Forms.Label(); this.label22 = new System.Windows.Forms.Label(); this.label23 = new System.Windows.Forms.Label(); this.GetDIOAdr = new System.Windows.Forms.TextBox(); this.SetAOAdr = new System.Windows.Forms.TextBox(); this.GetAIOAdr = new System.Windows.Forms.TextBox(); this.MBGetRegAdr = new System.Windows.Forms.TextBox(); this.MBGetCoilAdr = new System.Windows.Forms.TextBox(); this.MBSetCoilAdr = new System.Windows.Forms.TextBox(); this.MBSetRegAdr = new System.Windows.Forms.TextBox(); this.MBSetCoilVal = new System.Windows.Forms.TextBox(); this.SetAOVal = new System.Windows.Forms.TextBox(); this.GetAIOVal = new System.Windows.Forms.TextBox(); this.MBGetCoilVal = new System.Windows.Forms.TextBox(); this.MBSetRegVal = new System.Windows.Forms.TextBox(); this.GetDIOVal = new System.Windows.Forms.TextBox(); this.MBGetRegVal = new System.Windows.Forms.TextBox(); this.SetDOVal = new System.Windows.Forms.TextBox(); this.UserSetRegShortAdr = new System.Windows.Forms.TextBox(); this.UserSetRegFloatAdr = new System.Windows.Forms.TextBox(); this.UserGetRegLongAdr = new System.Windows.Forms.TextBox(); this.UserSetRegLongAdr = new System.Windows.Forms.TextBox(); this.UserGetCoilAdr = new System.Windows.Forms.TextBox(); this.UserSetCoilVal = new System.Windows.Forms.TextBox(); this.UserGetRegLongVal = new System.Windows.Forms.TextBox(); this.UserGetCoilVal = new System.Windows.Forms.TextBox(); this.UserSetRegLongVal = new System.Windows.Forms.TextBox(); this.UserGetRegFloatVal = new System.Windows.Forms.TextBox(); this.UserGetRegShortVal = new System.Windows.Forms.TextBox(); this.UserSetRegShortVal = new System.Windows.Forms.TextBox(); this.UserSetRegFloatVal = new System.Windows.Forms.TextBox(); this.UserGetRegShortAdr = new System.Windows.Forms.TextBox(); this.UserGetRegFloatAdr = new System.Windows.Forms.TextBox(); this.UserSetCoilAdr = new System.Windows.Forms.TextBox(); this.UserSetRegStrAdr = new System.Windows.Forms.TextBox(); this.UserGetRegStrAdr = new System.Windows.Forms.TextBox(); this.UserSetRegStrVal = new System.Windows.Forms.TextBox(); this.Button4 = new System.Windows.Forms.Button(); this.Button5 = new System.Windows.Forms.Button(); this.Button6 = new System.Windows.Forms.Button(); this.Button7 = new System.Windows.Forms.Button(); this.Button8 = new System.Windows.Forms.Button(); this.Button9 = new System.Windows.Forms.Button(); this.Button10 = new System.Windows.Forms.Button(); this.Button11 = new System.Windows.Forms.Button(); this.Button12 = new System.Windows.Forms.Button(); this.Button13 = new System.Windows.Forms.Button(); this.Button14 = new System.Windows.Forms.Button(); this.Button15 = new System.Windows.Forms.Button(); this.Button16 = new System.Windows.Forms.Button(); this.Button17 = new System.Windows.Forms.Button(); this.Button18 = new System.Windows.Forms.Button(); this.Button19 = new System.Windows.Forms.Button(); this.Button20 = new System.Windows.Forms.Button(); this.label6 = new System.Windows.Forms.Label(); this.label7 = new System.Windows.Forms.Label(); this.Label24 = new System.Windows.Forms.Label(); this.Label25 = new System.Windows.Forms.Label(); this.Button21 = new System.Windows.Forms.Button(); this.Button22 = new System.Windows.Forms.Button(); this.SetAOAdrW = new System.Windows.Forms.TextBox(); this.GetAIOAdrW = new System.Windows.Forms.TextBox(); this.SetAOValW = new System.Windows.Forms.TextBox(); this.GetAIOValW = new System.Windows.Forms.TextBox(); // // label1 // this.label1.Size = new System.Drawing.Size(104, 20); this.label1.Text = "All function test"; // // button1 // this.button1.Location = new System.Drawing.Point(312, 16); this.button1.Size = new System.Drawing.Size(80, 20); this.button1.Text = "Start Quicker"; this.button1.Click += new System.EventHandler(this.button1_Click_1); // // button2 // this.button2.Location = new System.Drawing.Point(424, 16); this.button2.Size = new System.Drawing.Size(80, 20); this.button2.Text = "Stop Quicker"; this.button2.Click += new System.EventHandler(this.button2_Click); // // SetDOAdr // this.SetDOAdr.Location = new System.Drawing.Point(80, 70); this.SetDOAdr.Size = new System.Drawing.Size(40, 22); this.SetDOAdr.Text = "1"; this.SetDOAdr.TextChanged += new System.EventHandler(this.SetDOAdr_TextChanged); // // label2 // this.label2.Location = new System.Drawing.Point(80, 46); this.label2.Size = new System.Drawing.Size(48, 20); this.label2.Text = "Address"; // // UserGetRegStrVal // this.UserGetRegStrVal.Location = new System.Drawing.Point(408, 286); this.UserGetRegStrVal.Size = new System.Drawing.Size(72, 22); this.UserGetRegStrVal.Text = "0"; // // button3 // this.button3.Location = new System.Drawing.Point(488, 286); this.button3.Size = new System.Drawing.Size(40, 20); this.button3.Text = "Get"; this.button3.Click += new System.EventHandler(this.button3_Click); // // label3 // this.label3.Location = new System.Drawing.Point(136, 46); this.label3.Size = new System.Drawing.Size(48, 20); this.label3.Text = "Value"; // // label4 // this.label4.Location = new System.Drawing.Point(8, 78); this.label4.Size = new System.Drawing.Size(48, 20); this.label4.Text = "SetDO"; // // label5 // this.label5.Location = new System.Drawing.Point(8, 102); this.label5.Size = new System.Drawing.Size(48, 20); this.label5.Text = "GetDIO"; // // label8 // this.label8.Location = new System.Drawing.Point(8, 224); this.label8.Size = new System.Drawing.Size(64, 20); this.label8.Text = "MBSetCoil"; // // label9 // this.label9.Location = new System.Drawing.Point(8, 248); this.label9.Size = new System.Drawing.Size(64, 20); this.label9.Text = "MBGetCoil"; // // label10 // this.label10.Location = new System.Drawing.Point(8, 272); this.label10.Size = new System.Drawing.Size(64, 20); this.label10.Text = "MBSetReg"; // // label11 // this.label11.Location = new System.Drawing.Point(8, 296); this.label11.Size = new System.Drawing.Size(64, 20); this.label11.Text = "MBGetReg"; // // label12 // this.label12.Location = new System.Drawing.Point(256, 78); this.label12.Size = new System.Drawing.Size(64, 20); this.label12.Text = "UserSetCoil"; // // label13 // this.label13.Location = new System.Drawing.Point(256, 102); this.label13.Size = new System.Drawing.Size(64, 20); this.label13.Text = "UserGetCoil"; // // label14 // this.label14.Location = new System.Drawing.Point(256, 126); this.label14.Size = new System.Drawing.Size(112, 20); this.label14.Text = "UserSetReg(Short)"; // // label15 // this.label15.Location = new System.Drawing.Point(256, 150); this.label15.Size = new System.Drawing.Size(112, 20); this.label15.Text = "UserGetReg(Short)"; // // label16 // this.label16.Location = new System.Drawing.Point(256, 174); this.label16.Size = new System.Drawing.Size(112, 20); this.label16.Text = "UserSetReg(Float)"; // // label17 // this.label17.Location = new System.Drawing.Point(256, 198); this.label17.Size = new System.Drawing.Size(112, 20); this.label17.Text = "UserGetReg(Float)"; // // label18 // this.label18.Location = new System.Drawing.Point(256, 246); this.label18.Size = new System.Drawing.Size(112, 20); this.label18.Text = "UserGetReg(Long)"; // // label19 // this.label19.Location = new System.Drawing.Point(256, 222); this.label19.Size = new System.Drawing.Size(112, 20); this.label19.Text = "UserSetReg(Long)"; // // label20 // this.label20.Location = new System.Drawing.Point(424, 46); this.label20.Size = new System.Drawing.Size(48, 20); this.label20.Text = "Value"; // // label21 // this.label21.Location = new System.Drawing.Point(368, 46); this.label21.Size = new System.Drawing.Size(48, 20); this.label21.Text = "Address"; // // label22 // this.label22.Location = new System.Drawing.Point(256, 270); this.label22.Size = new System.Drawing.Size(112, 20); this.label22.Text = "UserSetReg_Str"; // // label23 // this.label23.Location = new System.Drawing.Point(256, 294); this.label23.Size = new System.Drawing.Size(112, 20); this.label23.Text = "UserGetReg_Str"; // // GetDIOAdr // this.GetDIOAdr.Location = new System.Drawing.Point(80, 94); this.GetDIOAdr.Size = new System.Drawing.Size(40, 22); this.GetDIOAdr.Text = "1"; this.GetDIOAdr.TextChanged += new System.EventHandler(this.GetDIOAdr_TextChanged); // // SetAOAdr // this.SetAOAdr.Location = new System.Drawing.Point(80, 118); this.SetAOAdr.Size = new System.Drawing.Size(40, 22); this.SetAOAdr.Text = "3"; this.SetAOAdr.TextChanged += new System.EventHandler(this.SetAOAdr_TextChanged); // // GetAIOAdr // this.GetAIOAdr.Location = new System.Drawing.Point(80, 142); this.GetAIOAdr.Size = new System.Drawing.Size(40, 22); this.GetAIOAdr.Text = "3"; this.GetAIOAdr.TextChanged += new System.EventHandler(this.GetAIOAdr_TextChanged); // // MBGetRegAdr // this.MBGetRegAdr.Location = new System.Drawing.Point(80, 288); this.MBGetRegAdr.Size = new System.Drawing.Size(40, 22); this.MBGetRegAdr.Text = "500"; this.MBGetRegAdr.TextChanged += new System.EventHandler(this.MBGetRegAdr_TextChanged); // // MBGetCoilAdr // this.MBGetCoilAdr.Location = new System.Drawing.Point(80, 240); this.MBGetCoilAdr.Size = new System.Drawing.Size(40, 22); this.MBGetCoilAdr.Text = "500"; this.MBGetCoilAdr.TextChanged += new System.EventHandler(this.MBGetCoilAdr_TextChanged); // // MBSetCoilAdr // this.MBSetCoilAdr.Location = new System.Drawing.Point(80, 216); this.MBSetCoilAdr.Size = new System.Drawing.Size(40, 22); this.MBSetCoilAdr.Text = "500"; this.MBSetCoilAdr.TextChanged += new System.EventHandler(this.MBSetCoilAdr_TextChanged); // // MBSetRegAdr // this.MBSetRegAdr.Location = new System.Drawing.Point(80, 264); this.MBSetRegAdr.Size = new System.Drawing.Size(40, 22); this.MBSetRegAdr.Text = "500"; this.MBSetRegAdr.TextChanged += new System.EventHandler(this.MBSetRegAdr_TextChanged); // // MBSetCoilVal // this.MBSetCoilVal.Location = new System.Drawing.Point(128, 216); this.MBSetCoilVal.Size = new System.Drawing.Size(64, 22); this.MBSetCoilVal.Text = "1"; this.MBSetCoilVal.TextChanged += new System.EventHandler(this.MBSetCoilVal_TextChanged); // // SetAOVal // this.SetAOVal.Location = new System.Drawing.Point(128, 118); this.SetAOVal.Size = new System.Drawing.Size(64, 22); this.SetAOVal.Text = "5.5"; // // GetAIOVal // this.GetAIOVal.Location = new System.Drawing.Point(128, 142); this.GetAIOVal.Size = new System.Drawing.Size(64, 22); this.GetAIOVal.Text = "0"; // // MBGetCoilVal // this.MBGetCoilVal.Location = new System.Drawing.Point(128, 240); this.MBGetCoilVal.Size = new System.Drawing.Size(64, 22); this.MBGetCoilVal.Text = "0"; // // MBSetRegVal // this.MBSetRegVal.Location = new System.Drawing.Point(128, 264); this.MBSetRegVal.Size = new System.Drawing.Size(64, 22); this.MBSetRegVal.Text = "32767"; // // GetDIOVal // this.GetDIOVal.Location = new System.Drawing.Point(128, 94); this.GetDIOVal.Size = new System.Drawing.Size(64, 22); this.GetDIOVal.Text = "0"; // // MBGetRegVal // this.MBGetRegVal.Location = new System.Drawing.Point(128, 288); this.MBGetRegVal.Size = new System.Drawing.Size(64, 22); this.MBGetRegVal.Text = "0"; // // SetDOVal // this.SetDOVal.Location = new System.Drawing.Point(128, 70); this.SetDOVal.Size = new System.Drawing.Size(64, 22); this.SetDOVal.Text = "1"; this.SetDOVal.TextChanged += new System.EventHandler(this.SetDOVal_TextChanged); // // UserSetRegShortAdr // this.UserSetRegShortAdr.Location = new System.Drawing.Point(368, 118); this.UserSetRegShortAdr.Size = new System.Drawing.Size(40, 22); this.UserSetRegShortAdr.Text = "7"; this.UserSetRegShortAdr.TextChanged += new System.EventHandler(this.UserSetRegShortAdr_TextChanged); // // UserSetRegFloatAdr // this.UserSetRegFloatAdr.Location = new System.Drawing.Point(368, 166); this.UserSetRegFloatAdr.Size = new System.Drawing.Size(40, 22); this.UserSetRegFloatAdr.Text = "5"; this.UserSetRegFloatAdr.TextChanged += new System.EventHandler(this.UserSetRegFloatAdr_TextChanged); // // UserGetRegLongAdr // this.UserGetRegLongAdr.Location = new System.Drawing.Point(368, 238); this.UserGetRegLongAdr.Size = new System.Drawing.Size(40, 22); this.UserGetRegLongAdr.Text = "3"; this.UserGetRegLongAdr.TextChanged += new System.EventHandler(this.UserGetRegLongAdr_TextChanged); // // UserSetRegLongAdr // this.UserSetRegLongAdr.Location = new System.Drawing.Point(368, 214); this.UserSetRegLongAdr.Size = new System.Drawing.Size(40, 22); this.UserSetRegLongAdr.Text = "3"; this.UserSetRegLongAdr.TextChanged += new System.EventHandler(this.UserSetRegLongAdr_TextChanged); // // UserGetCoilAdr // this.UserGetCoilAdr.Location = new System.Drawing.Point(368, 94); this.UserGetCoilAdr.Size = new System.Drawing.Size(40, 22); this.UserGetCoilAdr.Text = "1"; this.UserGetCoilAdr.TextChanged += new System.EventHandler(this.UserGetCoilAdr_TextChanged); // // UserSetCoilVal // this.UserSetCoilVal.Location = new System.Drawing.Point(416, 70); this.UserSetCoilVal.Size = new System.Drawing.Size(64, 22); this.UserSetCoilVal.Text = "1"; this.UserSetCoilVal.TextChanged += new System.EventHandler(this.UserSetCoilVal_TextChanged); // // UserGetRegLongVal // this.UserGetRegLongVal.Location = new System.Drawing.Point(416, 238); this.UserGetRegLongVal.Size = new System.Drawing.Size(64, 22); this.UserGetRegLongVal.Text = "0"; // // UserGetCoilVal // this.UserGetCoilVal.Location = new System.Drawing.Point(416, 94); this.UserGetCoilVal.Size = new System.Drawing.Size(64, 22); this.UserGetCoilVal.Text = "0"; // // UserSetRegLongVal // this.UserSetRegLongVal.Location = new System.Drawing.Point(416, 214); this.UserSetRegLongVal.Size = new System.Drawing.Size(64, 22); this.UserSetRegLongVal.Text = "1234567"; // // UserGetRegFloatVal // this.UserGetRegFloatVal.Location = new System.Drawing.Point(416, 190); this.UserGetRegFloatVal.Size = new System.Drawing.Size(64, 22); this.UserGetRegFloatVal.Text = "0"; // // UserGetRegShortVal // this.UserGetRegShortVal.Location = new System.Drawing.Point(416, 142); this.UserGetRegShortVal.Size = new System.Drawing.Size(64, 22); this.UserGetRegShortVal.Text = "0"; // // UserSetRegShortVal // this.UserSetRegShortVal.Location = new System.Drawing.Point(416, 118); this.UserSetRegShortVal.Size = new System.Drawing.Size(64, 22); this.UserSetRegShortVal.Text = "12345"; // // UserSetRegFloatVal // this.UserSetRegFloatVal.Location = new System.Drawing.Point(416, 166); this.UserSetRegFloatVal.Size = new System.Drawing.Size(64, 22); this.UserSetRegFloatVal.Text = "3.8"; // // UserGetRegShortAdr // this.UserGetRegShortAdr.Location = new System.Drawing.Point(368, 142); this.UserGetRegShortAdr.Size = new System.Drawing.Size(40, 22); this.UserGetRegShortAdr.Text = "7"; this.UserGetRegShortAdr.TextChanged += new System.EventHandler(this.UserGetRegShortAdr_TextChanged); // // UserGetRegFloatAdr // this.UserGetRegFloatAdr.Location = new System.Drawing.Point(368, 190); this.UserGetRegFloatAdr.Size = new System.Drawing.Size(40, 22); this.UserGetRegFloatAdr.Text = "5"; this.UserGetRegFloatAdr.TextChanged += new System.EventHandler(this.UserGetRegFloatAdr_TextChanged); // // UserSetCoilAdr // this.UserSetCoilAdr.Location = new System.Drawing.Point(368, 70); this.UserSetCoilAdr.Size = new System.Drawing.Size(40, 22); this.UserSetCoilAdr.Text = "1"; this.UserSetCoilAdr.TextChanged += new System.EventHandler(this.UserSetCoilAdr_TextChanged); // // UserSetRegStrAdr // this.UserSetRegStrAdr.Location = new System.Drawing.Point(368, 262); this.UserSetRegStrAdr.Size = new System.Drawing.Size(40, 22); this.UserSetRegStrAdr.Text = "1"; this.UserSetRegStrAdr.TextChanged += new System.EventHandler(this.UserSetRegStrAdr_TextChanged); // // UserGetRegStrAdr // this.UserGetRegStrAdr.Location = new System.Drawing.Point(368, 286); this.UserGetRegStrAdr.Size = new System.Drawing.Size(40, 22); this.UserGetRegStrAdr.Text = "1"; this.UserGetRegStrAdr.TextChanged += new System.EventHandler(this.UserGetRegStrAdr_TextChanged); // // UserSetRegStrVal // this.UserSetRegStrVal.Location = new System.Drawing.Point(408, 262); this.UserSetRegStrVal.Size = new System.Drawing.Size(72, 22); this.UserSetRegStrVal.Text = "Quicker"; // // Button4 // this.Button4.Location = new System.Drawing.Point(488, 262); this.Button4.Size = new System.Drawing.Size(40, 20); this.Button4.Text = "Set"; this.Button4.Click += new System.EventHandler(this.Button4_Click); // // Button5 // this.Button5.Location = new System.Drawing.Point(488, 70); this.Button5.Size = new System.Drawing.Size(40, 20); this.Button5.Text = "Set"; this.Button5.Click += new System.EventHandler(this.Button5_Click); // // Button6 // this.Button6.Location = new System.Drawing.Point(488, 94); this.Button6.Size = new System.Drawing.Size(40, 20); this.Button6.Text = "Get"; this.Button6.Click += new System.EventHandler(this.Button6_Click); // // Button7 // this.Button7.Location = new System.Drawing.Point(488, 118); this.Button7.Size = new System.Drawing.Size(40, 20); this.Button7.Text = "Set"; this.Button7.Click += new System.EventHandler(this.Button7_Click); // // Button8 // this.Button8.Location = new System.Drawing.Point(488, 142); this.Button8.Size = new System.Drawing.Size(40, 20); this.Button8.Text = "Get"; this.Button8.Click += new System.EventHandler(this.Button8_Click); // // Button9 // this.Button9.Location = new System.Drawing.Point(488, 166); this.Button9.Size = new System.Drawing.Size(40, 20); this.Button9.Text = "Set"; this.Button9.Click += new System.EventHandler(this.Button9_Click); // // Button10 // this.Button10.Location = new System.Drawing.Point(488, 190); this.Button10.Size = new System.Drawing.Size(40, 20); this.Button10.Text = "Get"; this.Button10.Click += new System.EventHandler(this.Button10_Click); // // Button11 // this.Button11.Location = new System.Drawing.Point(488, 214); this.Button11.Size = new System.Drawing.Size(40, 20); this.Button11.Text = "Set"; this.Button11.Click += new System.EventHandler(this.Button11_Click); // // Button12 // this.Button12.Location = new System.Drawing.Point(488, 238); this.Button12.Size = new System.Drawing.Size(40, 20); this.Button12.Text = "Get"; this.Button12.Click += new System.EventHandler(this.Button12_Click); // // Button13 // this.Button13.Location = new System.Drawing.Point(200, 118); this.Button13.Size = new System.Drawing.Size(40, 20); this.Button13.Text = "Set"; this.Button13.Click += new System.EventHandler(this.Button13_Click); // // Button14 // this.Button14.Location = new System.Drawing.Point(200, 264); this.Button14.Size = new System.Drawing.Size(40, 20); this.Button14.Text = "Set"; this.Button14.Click += new System.EventHandler(this.Button14_Click); // // Button15 // this.Button15.Location = new System.Drawing.Point(200, 142); this.Button15.Size = new System.Drawing.Size(40, 20); this.Button15.Text = "Get"; this.Button15.Click += new System.EventHandler(this.Button15_Click); // // Button16 // this.Button16.Location = new System.Drawing.Point(200, 288); this.Button16.Size = new System.Drawing.Size(40, 20); this.Button16.Text = "Get"; this.Button16.Click += new System.EventHandler(this.Button16_Click); // // Button17 // this.Button17.Location = new System.Drawing.Point(200, 216); this.Button17.Size = new System.Drawing.Size(40, 20); this.Button17.Text = "Set"; this.Button17.Click += new System.EventHandler(this.Button17_Click); // // Button18 // this.Button18.Location = new System.Drawing.Point(200, 240); this.Button18.Size = new System.Drawing.Size(40, 20); this.Button18.Text = "Get"; this.Button18.Click += new System.EventHandler(this.Button18_Click); // // Button19 // this.Button19.Location = new System.Drawing.Point(200, 70); this.Button19.Size = new System.Drawing.Size(40, 20); this.Button19.Text = "Set"; this.Button19.Click += new System.EventHandler(this.Button19_Click); // // Button20 // this.Button20.Location = new System.Drawing.Point(200, 94); this.Button20.Size = new System.Drawing.Size(40, 20); this.Button20.Text = "Get"; this.Button20.Click += new System.EventHandler(this.Button20_Click); // // label6 // this.label6.Location = new System.Drawing.Point(0, 120); this.label6.Size = new System.Drawing.Size(80, 20); this.label6.Text = "SetAO_Float"; // // label7 // this.label7.Location = new System.Drawing.Point(0, 144); this.label7.Size = new System.Drawing.Size(80, 20); this.label7.Text = "GetAIO_Float"; // // Label24 // this.Label24.Location = new System.Drawing.Point(0, 168); this.Label24.Size = new System.Drawing.Size(80, 20); this.Label24.Text = "SetAO_Word"; // // Label25 // this.Label25.Location = new System.Drawing.Point(0, 192); this.Label25.Size = new System.Drawing.Size(80, 20); this.Label25.Text = "GetAIO_Word"; // // Button21 // this.Button21.Location = new System.Drawing.Point(200, 168); this.Button21.Size = new System.Drawing.Size(40, 20); this.Button21.Text = "Set"; this.Button21.Click += new System.EventHandler(this.Button21_Click); // // Button22 // this.Button22.Location = new System.Drawing.Point(200, 192); this.Button22.Size = new System.Drawing.Size(40, 20); this.Button22.Text = "Get"; this.Button22.Click += new System.EventHandler(this.Button22_Click); // // SetAOAdrW // this.SetAOAdrW.Location = new System.Drawing.Point(80, 168); this.SetAOAdrW.Size = new System.Drawing.Size(40, 22); this.SetAOAdrW.Text = "7"; this.SetAOAdrW.TextChanged += new System.EventHandler(this.SetAOAdrW_TextChanged); // // GetAIOAdrW // this.GetAIOAdrW.Location = new System.Drawing.Point(80, 192); this.GetAIOAdrW.Size = new System.Drawing.Size(40, 22); this.GetAIOAdrW.Text = "7"; this.GetAIOAdrW.TextChanged += new System.EventHandler(this.GetAIOAdrW_TextChanged); // // SetAOValW // this.SetAOValW.Location = new System.Drawing.Point(128, 168); this.SetAOValW.Size = new System.Drawing.Size(64, 22); this.SetAOValW.Text = "120"; // // GetAIOValW // this.GetAIOValW.Location = new System.Drawing.Point(128, 192); this.GetAIOValW.Size = new System.Drawing.Size(64, 22); this.GetAIOValW.Text = "0"; // // Form1 // this.ClientSize = new System.Drawing.Size(538, 320); this.Controls.Add(this.Button21); this.Controls.Add(this.Button22); this.Controls.Add(this.SetAOAdrW); this.Controls.Add(this.GetAIOAdrW); this.Controls.Add(this.SetAOValW); this.Controls.Add(this.GetAIOValW); this.Controls.Add(this.label6); this.Controls.Add(this.label7); this.Controls.Add(this.Label24); this.Controls.Add(this.Label25); this.Controls.Add(this.SetDOAdr); this.Controls.Add(this.label2); this.Controls.Add(this.UserGetRegStrVal); this.Controls.Add(this.button3); this.Controls.Add(this.label3); this.Controls.Add(this.label4); this.Controls.Add(this.label5); this.Controls.Add(this.label8); this.Controls.Add(this.label9); this.Controls.Add(this.label10); this.Controls.Add(this.label11); this.Controls.Add(this.label12); this.Controls.Add(this.label13); this.Controls.Add(this.label14); this.Controls.Add(this.label15); this.Controls.Add(this.label16); this.Controls.Add(this.label17); this.Controls.Add(this.label18); this.Controls.Add(this.label19); this.Controls.Add(this.label20); this.Controls.Add(this.label21); this.Controls.Add(this.label22); this.Controls.Add(this.label23); this.Controls.Add(this.GetDIOAdr); this.Controls.Add(this.SetAOAdr); this.Controls.Add(this.GetAIOAdr); this.Controls.Add(this.MBGetRegAdr); this.Controls.Add(this.MBGetCoilAdr); this.Controls.Add(this.MBSetCoilAdr); this.Controls.Add(this.MBSetRegAdr); this.Controls.Add(this.MBSetCoilVal); this.Controls.Add(this.SetAOVal); this.Controls.Add(this.GetAIOVal); this.Controls.Add(this.MBGetCoilVal); this.Controls.Add(this.MBSetRegVal); this.Controls.Add(this.GetDIOVal); this.Controls.Add(this.MBGetRegVal); this.Controls.Add(this.SetDOVal); this.Controls.Add(this.UserSetRegShortAdr); this.Controls.Add(this.UserSetRegFloatAdr); this.Controls.Add(this.UserGetRegLongAdr); this.Controls.Add(this.UserSetRegLongAdr); this.Controls.Add(this.UserGetCoilAdr); this.Controls.Add(this.UserSetCoilVal); this.Controls.Add(this.UserGetRegLongVal); this.Controls.Add(this.UserGetCoilVal); this.Controls.Add(this.UserSetRegLongVal); this.Controls.Add(this.UserGetRegFloatVal); this.Controls.Add(this.UserGetRegShortVal); this.Controls.Add(this.UserSetRegShortVal); this.Controls.Add(this.UserSetRegFloatVal); this.Controls.Add(this.UserGetRegShortAdr); this.Controls.Add(this.UserGetRegFloatAdr); this.Controls.Add(this.UserSetCoilAdr); this.Controls.Add(this.UserSetRegStrAdr); this.Controls.Add(this.UserGetRegStrAdr); this.Controls.Add(this.UserSetRegStrVal); this.Controls.Add(this.Button4); this.Controls.Add(this.Button5); this.Controls.Add(this.Button6); this.Controls.Add(this.Button7); this.Controls.Add(this.Button8); this.Controls.Add(this.Button9); this.Controls.Add(this.Button10); this.Controls.Add(this.Button11); this.Controls.Add(this.Button12); this.Controls.Add(this.Button13); this.Controls.Add(this.Button14); this.Controls.Add(this.Button15); this.Controls.Add(this.Button16); this.Controls.Add(this.Button17); this.Controls.Add(this.Button18); this.Controls.Add(this.Button19); this.Controls.Add(this.Button20); this.Controls.Add(this.button1); this.Controls.Add(this.label1); this.Controls.Add(this.button2); this.Text = "Quicker_VCSharp_Demo 2005.3.8"; } #endregion /// /// 應用程式的主進入點。 /// static void Main() { Application.Run(new Form1()); } //unsafe private void button1_Click(object sender, System.EventArgs e) //{ // short SetReg = 123; // long* pshort = &SetReg; // long plong = *pshort; // Quicker.UserShare.UserSetReg(1, out plong,0); // short iStatus=0; // void* pshortS = &iStatus; // long plongS = 0; // plongS = *((long*)pshortS); // Quicker.UserShare.UserGetReg(1,out plongS,0); // textBox1.Text = plongS.ToString(); //} //char[] UserGetStr = new char[256]; byte m_SetDOVal=1, m_MBSetCoilVal=1, m_UserSetCoilVal=1; ushort m_SetDOAdr=1, m_GetDIOAdr=1, m_SetAOAdr=3, m_GetAIOAdr=3, m_UserSetRegStrAdr=1, m_UserGetRegStrAdr=1; ushort m_SetAOAdrW=7, m_GetAIOAdrW=7; ushort m_UserGetRegFloatAdr=5, m_UserSetRegFloatAdr=5, m_MBSetCoilAdr=500, m_MBGetCoilAdr=500, m_MBSetRegAdr=500, m_MBGetRegAdr=500; ushort m_UserSetCoilAdr=1, m_UserGetCoilAdr=1, m_UserSetRegShortAdr=7, m_UserGetRegShortAdr=7, m_UserGetRegLongAdr=3, m_UserSetRegLongAdr=3; private void button1_Click_1(object sender, System.EventArgs e) { Quicker.System.StartQuicker(1); } private void Button5_Click(object sender, System.EventArgs e) { Quicker.UserShare.UserSetCoil(m_UserSetCoilAdr, m_UserSetCoilVal); } private void button2_Click(object sender, System.EventArgs e) { Quicker.System.StopQuicker(); } private void SetDOAdr_TextChanged(object sender, System.EventArgs e) { m_SetDOAdr = Convert.ToUInt16(SetDOAdr.Text); } private void GetDIOAdr_TextChanged(object sender, System.EventArgs e) { m_GetDIOAdr = Convert.ToUInt16(GetDIOAdr.Text); } private void SetAOAdr_TextChanged(object sender, System.EventArgs e) { m_SetAOAdr = Convert.ToUInt16(SetAOAdr.Text); } private void GetAIOAdr_TextChanged(object sender, System.EventArgs e) { m_GetAIOAdr = Convert.ToUInt16(GetAIOAdr.Text); } private void MBSetCoilAdr_TextChanged(object sender, System.EventArgs e) { m_MBSetCoilAdr = Convert.ToUInt16(MBSetCoilAdr.Text); } private void MBGetCoilAdr_TextChanged(object sender, System.EventArgs e) { m_MBGetCoilAdr = Convert.ToUInt16(MBGetCoilAdr.Text); } private void MBSetRegAdr_TextChanged(object sender, System.EventArgs e) { m_MBSetRegAdr = Convert.ToUInt16(MBSetRegAdr.Text); } private void MBGetRegAdr_TextChanged(object sender, System.EventArgs e) { m_MBGetRegAdr = Convert.ToUInt16(MBGetRegAdr.Text); } private void UserSetCoilAdr_TextChanged(object sender, System.EventArgs e) { m_UserSetCoilAdr = Convert.ToUInt16(UserSetCoilAdr.Text); } private void UserGetCoilAdr_TextChanged(object sender, System.EventArgs e) { m_UserGetCoilAdr = Convert.ToUInt16(UserGetCoilAdr.Text); } private void UserSetRegShortAdr_TextChanged(object sender, System.EventArgs e) { m_UserSetRegShortAdr = Convert.ToUInt16(UserSetRegShortAdr.Text); } private void UserGetRegShortAdr_TextChanged(object sender, System.EventArgs e) { m_UserGetRegShortAdr = Convert.ToUInt16(UserGetRegShortAdr.Text); } private void UserSetRegFloatAdr_TextChanged(object sender, System.EventArgs e) { m_UserSetRegFloatAdr = Convert.ToUInt16(UserSetRegFloatAdr.Text); } private void UserGetRegFloatAdr_TextChanged(object sender, System.EventArgs e) { m_UserGetRegFloatAdr = Convert.ToUInt16(UserGetRegFloatAdr.Text); } private void UserSetRegLongAdr_TextChanged(object sender, System.EventArgs e) { m_UserSetRegLongAdr = Convert.ToUInt16(UserSetRegLongAdr.Text); } private void UserGetRegLongAdr_TextChanged(object sender, System.EventArgs e) { m_UserGetRegLongAdr = Convert.ToUInt16(UserGetRegLongAdr.Text); } private void UserSetRegStrAdr_TextChanged(object sender, System.EventArgs e) { m_UserSetRegStrAdr = Convert.ToUInt16(UserSetRegStrAdr.Text); } private void UserGetRegStrAdr_TextChanged(object sender, System.EventArgs e) { m_UserGetRegStrAdr = Convert.ToUInt16(UserGetRegStrAdr.Text); } private void SetDOVal_TextChanged(object sender, System.EventArgs e) { m_SetDOVal = Convert.ToByte(SetDOVal.Text); } private void Button19_Click(object sender, System.EventArgs e) { Quicker.QuickerIO.SetDO(m_SetDOAdr, m_SetDOVal); } private void Button20_Click(object sender, System.EventArgs e) { byte m_GetDIOVal; Quicker.QuickerIO.GetDIO(m_GetDIOAdr,out m_GetDIOVal, 0); GetDIOVal.Text = m_GetDIOVal.ToString(); } private void Button13_Click(object sender, System.EventArgs e) { float AO=Convert.ToSingle(SetAOVal.Text); Quicker.QuickerIO.SetAO_Float(m_SetAOAdr,out AO); AO.ToString(); } private void Button15_Click(object sender, System.EventArgs e) { byte Rtn; float m_GetAIOVal; Rtn = Quicker.QuickerIO.GetAIO_Float(m_GetAIOAdr,out m_GetAIOVal, 0); if(Rtn == 0) GetAIOVal.Text = m_GetAIOVal.ToString(); else MessageBox.Show("GetAIOVal Fail"); } private void MBSetCoilVal_TextChanged(object sender, System.EventArgs e) { m_MBSetCoilVal = Convert.ToByte(MBSetCoilVal.Text); } private void Button18_Click(object sender, System.EventArgs e) { byte m_MBGetCoilVal; Quicker.Modbus.MBGetCoil(m_MBGetCoilAdr,out m_MBGetCoilVal, 1); MBGetCoilVal.Text = m_MBGetCoilVal.ToString(); } private void Button17_Click(object sender, System.EventArgs e) { Quicker.Modbus.MBSetCoil(m_MBSetCoilAdr, m_MBSetCoilVal, 1); } private void Button14_Click(object sender, System.EventArgs e) { Quicker.Modbus.MBSetReg(m_MBSetRegAdr, Convert.ToInt16(MBSetRegVal.Text), 1); } private void Button16_Click(object sender, System.EventArgs e) { byte Rtn; short m_MBGetRegVal; Rtn = Quicker.Modbus.MBGetReg(m_MBGetRegAdr,out m_MBGetRegVal, 1); if(Rtn == 0) MBGetRegVal.Text = m_MBGetRegVal.ToString(); else MessageBox.Show("MBGetRegVal Fail"); } private void UserSetCoilVal_TextChanged(object sender, System.EventArgs e) { m_UserSetCoilVal = Convert.ToByte(UserSetCoilVal.Text); } private void Button6_Click(object sender, System.EventArgs e) { byte m_UserGetCoilVal; Quicker.UserShare.UserGetCoil(m_UserGetCoilAdr,out m_UserGetCoilVal); UserGetCoilVal.Text = m_UserGetCoilVal.ToString(); } private void Button7_Click(object sender, System.EventArgs e) { int RegShort=Convert.ToInt32(UserSetRegShortVal.Text); //MessageBox.Show(m_UserSetRegShortAdr.ToString()); //MessageBox.Show(RegShort.ToString()); Quicker.UserShare.UserSetReg_Short(m_UserSetRegShortAdr,out RegShort); RegShort.ToString(); } private void Button8_Click(object sender, System.EventArgs e) { byte Rtn; int m_UserGetRegShortVal; Rtn = Quicker.UserShare.UserGetReg_Short(m_UserGetRegShortAdr,out m_UserGetRegShortVal); if(Rtn == 0) UserGetRegShortVal.Text = m_UserGetRegShortVal.ToString(); else MessageBox.Show("UserGetRegShortVal Fail"); } private void Button9_Click(object sender, System.EventArgs e) { byte Rtn; float RegFloat=Convert.ToSingle(UserSetRegFloatVal.Text); //MessageBox.Show(m_UserSetRegFloatAdr.ToString()); //MessageBox.Show(RegFloat.ToString()); Rtn = Quicker.UserShare.UserSetReg_Float(m_UserSetRegFloatAdr,out RegFloat); RegFloat.ToString(); } private void Button10_Click(object sender, System.EventArgs e) { byte Rtn; float m_UserGetRegFloatVal; Rtn = Quicker.UserShare.UserGetReg_Float(m_UserGetRegFloatAdr,out m_UserGetRegFloatVal); if(Rtn == 0) UserGetRegFloatVal.Text = m_UserGetRegFloatVal.ToString(); else MessageBox.Show("UserGetRegFloat Fail"); } private void Button11_Click(object sender, System.EventArgs e) { int RegLong=Convert.ToInt32(UserSetRegLongVal.Text); //MessageBox.Show(m_UserSetRegLongAdr.ToString()); //MessageBox.Show(RegLong.ToString()); Quicker.UserShare.UserSetReg_Long(m_UserSetRegLongAdr,out RegLong); RegLong.ToString(); } private void Button12_Click(object sender, System.EventArgs e) { byte Rtn; int m_UserGetRegLongVal; Rtn = Quicker.UserShare.UserGetReg_Long(m_UserGetRegLongAdr,out m_UserGetRegLongVal); if(Rtn == 0) UserGetRegLongVal.Text = m_UserGetRegLongVal.ToString(); else MessageBox.Show("UserGetRegLongVal Fail"); } private void Button4_Click(object sender, System.EventArgs e) { byte Rtn; Rtn = Quicker.UserShare.UserSetReg_Str(Convert.ToUInt16(m_UserSetRegStrAdr), Convert.ToString(UserSetRegStrVal.Text).ToCharArray()); } unsafe private void button3_Click(object sender, System.EventArgs e) { byte Rtn; byte[] UserGetStr = new byte[256]; Rtn = Quicker.UserShare.UserGetReg_Str(Convert.ToUInt16(m_UserGetRegStrAdr), UserGetStr); if(Rtn == 0) UserGetRegStrVal.Text = System.Text.Encoding.Unicode.GetString(UserGetStr,0,UserGetStr.Length); else MessageBox.Show("UserGetRegStr Fail"); } private void SetAOAdrW_TextChanged(object sender, System.EventArgs e) { m_SetAOAdrW = Convert.ToUInt16(SetAOAdrW.Text); } private void GetAIOAdrW_TextChanged(object sender, System.EventArgs e) { m_GetAIOAdrW = Convert.ToUInt16(GetAIOAdrW.Text); } private void Button21_Click(object sender, System.EventArgs e) { ushort AO=Convert.ToUInt16(SetAOValW.Text); Quicker.QuickerIO.SetAO_Word(m_SetAOAdrW,out AO); AO.ToString(); } private void Button22_Click(object sender, System.EventArgs e) { byte Rtn; ushort m_GetAIOValW; Rtn = Quicker.QuickerIO.GetAIO_Word(m_GetAIOAdrW,out m_GetAIOValW, 0); if(Rtn == 0) GetAIOValW.Text = m_GetAIOValW.ToString(); else MessageBox.Show("GetAIOVal Fail"); } } }