udpate ulteriore demo...

This commit is contained in:
Samuele E. Locatelli
2017-11-28 18:14:25 +01:00
parent e2c23ff934
commit f85bc50c81
2 changed files with 75 additions and 64 deletions
+64 -64
View File
@@ -38,14 +38,14 @@
this.txtMemSize = new System.Windows.Forms.TextBox();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.textBox1 = new System.Windows.Forms.TextBox();
this.txtOut = new System.Windows.Forms.TextBox();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.label4 = new System.Windows.Forms.Label();
this.txtRack = new System.Windows.Forms.TextBox();
this.label5 = new System.Windows.Forms.Label();
this.txtSlot = new System.Windows.Forms.TextBox();
this.label6 = new System.Windows.Forms.Label();
this.textBox2 = new System.Windows.Forms.TextBox();
this.label6 = new System.Windows.Forms.Label();
this.txtSlot = new System.Windows.Forms.TextBox();
this.label5 = new System.Windows.Forms.Label();
this.txtRack = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label();
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
this.groupBox3.SuspendLayout();
@@ -107,7 +107,7 @@
this.txtMemArea.Name = "txtMemArea";
this.txtMemArea.Size = new System.Drawing.Size(107, 22);
this.txtMemArea.TabIndex = 4;
this.txtMemArea.Text = "DB241.DBD0";
this.txtMemArea.Text = "DB241.DBD0.0";
this.txtMemArea.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
//
// label3
@@ -148,7 +148,7 @@
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBox2.AutoSize = true;
this.groupBox2.Controls.Add(this.textBox1);
this.groupBox2.Controls.Add(this.txtOut);
this.groupBox2.Location = new System.Drawing.Point(12, 118);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(731, 240);
@@ -156,17 +156,17 @@
this.groupBox2.TabStop = false;
this.groupBox2.Text = "Risultati";
//
// textBox1
// txtOut
//
this.textBox1.BackColor = System.Drawing.SystemColors.Desktop;
this.textBox1.Dock = System.Windows.Forms.DockStyle.Fill;
this.textBox1.ForeColor = System.Drawing.SystemColors.ControlLightLight;
this.textBox1.Location = new System.Drawing.Point(3, 18);
this.textBox1.Multiline = true;
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(725, 219);
this.textBox1.TabIndex = 0;
this.textBox1.Text = "...";
this.txtOut.BackColor = System.Drawing.SystemColors.Desktop;
this.txtOut.Dock = System.Windows.Forms.DockStyle.Fill;
this.txtOut.ForeColor = System.Drawing.SystemColors.ControlLightLight;
this.txtOut.Location = new System.Drawing.Point(3, 18);
this.txtOut.Multiline = true;
this.txtOut.Name = "txtOut";
this.txtOut.Size = new System.Drawing.Size(725, 219);
this.txtOut.TabIndex = 0;
this.txtOut.Text = "...";
//
// groupBox3
//
@@ -187,49 +187,6 @@
this.groupBox3.TabStop = false;
this.groupBox3.Text = "Parametri PLC";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(208, 27);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(40, 17);
this.label4.TabIndex = 4;
this.label4.Text = "Rack";
//
// txtRack
//
this.txtRack.Location = new System.Drawing.Point(254, 24);
this.txtRack.Name = "txtRack";
this.txtRack.Size = new System.Drawing.Size(41, 22);
this.txtRack.TabIndex = 5;
this.txtRack.Text = "0";
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(208, 64);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(32, 17);
this.label5.TabIndex = 4;
this.label5.Text = "Slot";
//
// txtSlot
//
this.txtSlot.Location = new System.Drawing.Point(254, 61);
this.txtSlot.Name = "txtSlot";
this.txtSlot.Size = new System.Drawing.Size(41, 22);
this.txtSlot.TabIndex = 5;
this.txtSlot.Text = "0";
//
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(302, 14);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(114, 17);
this.label6.TabIndex = 6;
this.label6.Text = "Note Rack / Slot:";
//
// textBox2
//
this.textBox2.BackColor = System.Drawing.SystemColors.Menu;
@@ -242,7 +199,50 @@
this.textBox2.TabIndex = 7;
this.textBox2.Text = "S7-1200/S7-1500: 0/0\r\nS7-300/S7-400: 0/2\r\nSlot > 0 se eth ext";
//
// MainForm
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(302, 14);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(114, 17);
this.label6.TabIndex = 6;
this.label6.Text = "Note Rack / Slot:";
//
// txtSlot
//
this.txtSlot.Location = new System.Drawing.Point(254, 61);
this.txtSlot.Name = "txtSlot";
this.txtSlot.Size = new System.Drawing.Size(41, 22);
this.txtSlot.TabIndex = 5;
this.txtSlot.Text = "0";
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(208, 64);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(32, 17);
this.label5.TabIndex = 4;
this.label5.Text = "Slot";
//
// txtRack
//
this.txtRack.Location = new System.Drawing.Point(254, 24);
this.txtRack.Name = "txtRack";
this.txtRack.Size = new System.Drawing.Size(41, 22);
this.txtRack.TabIndex = 5;
this.txtRack.Text = "0";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(208, 27);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(40, 17);
this.label4.TabIndex = 4;
this.label4.Text = "Rack";
//
// TestMainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
@@ -250,7 +250,7 @@
this.Controls.Add(this.groupBox3);
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.groupBox1);
this.Name = "MainForm";
this.Name = "TestMainForm";
this.Text = "SIEMENS S7 TEST";
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
@@ -275,7 +275,7 @@
private System.Windows.Forms.TextBox txtMemSize;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.TextBox txtOut;
private System.Windows.Forms.GroupBox groupBox3;
private System.Windows.Forms.TextBox txtSlot;
private System.Windows.Forms.Label label5;
+11
View File
@@ -41,6 +41,17 @@ namespace Test_S7
using (var plc = new Plc(tipoCpu, txtIP.Text, rack, slot))
{
plc.Open();
// test lettura area indicata... SOLO 1 elemento ATTENZIONE legge tutti U (unsigned) e poi andrebbero convertiti ushort --> convertToShort, uint --> convertToDouble/ConvertToInt
var memRead= plc.Read(txtMemArea.Text);
txtOut.Text = string.Format("-------------------------------------------{0}", Environment.NewLine);
txtOut.Text+= string.Format("- READ FIRST BLOCK{0}", Environment.NewLine);
txtOut.Text += string.Format("-------------------------------------------{0}", Environment.NewLine);
txtOut.Text += memRead.ToString();
txtOut.Text += Environment.NewLine;
txtOut.Text += string.Format("-------------------------------------------{0}", Environment.NewLine);
txtOut.Text += string.Format("{0}{0}{0}",Environment.NewLine);
}
}
}