diff --git a/IOB-WIN-NEXT/IobSiemensCosmap.cs b/IOB-WIN-NEXT/IobSiemensCosmap.cs index 9a237d8c..a16dd9a5 100644 --- a/IOB-WIN-NEXT/IobSiemensCosmap.cs +++ b/IOB-WIN-NEXT/IobSiemensCosmap.cs @@ -204,12 +204,6 @@ namespace IOB_WIN_NEXT MemBlock = new byte[1]; MemBlock[0] = (byte)1; memAddrWrite = "DB6.DBDW216"; - // scrivo subito - taskOk = S7WriteBB(ref MemBlock, memAddrWrite); - // pausa 1 sec - Thread.Sleep(1000); - // preparo altra scrittura - MemBlock[0] = (byte)0; break; case taskType.startSetup: diff --git a/Jenkinsfile b/Jenkinsfile index 215d0823..fb20a510 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -22,7 +22,7 @@ pipeline { } } /* CAMBIO numero versione in file sorgente!!! */ - bat "e:\\fart.exe VersGen\\VersGen.cs 1.0.0.0 ${env.versionNumber} || EXIT /B 0" + bat "e:\\fart.exe VersGen\\VersGen.cs 0.0.0.0 ${env.versionNumber} || EXIT /B 0" } } stage('Build') { @@ -31,7 +31,7 @@ pipeline { // fix vers numb + pacchetti nuget script { // CAMBIO numero versione in file sorgente!!! - bat "e:\\fart.exe VersGen\\VersGen.cs 1.0.0.0 ${env.versionNumber} || EXIT /B 0" + bat "e:\\fart.exe VersGen\\VersGen.cs 0.0.0.0 ${env.versionNumber} || EXIT /B 0" // checkout NuGet in file sorgente!!! fixNuget("${WORKSPACE}\\IOB-WIN.sln") fixNuget("${WORKSPACE}\\IOB-WIN-NEXT.sln") @@ -68,7 +68,7 @@ pipeline { // fix vers numb + pacchetti nuget script { // CAMBIO numero versione in file sorgente!!! - bat "e:\\fart.exe VersGen\\VersGen.cs 1.0.0.0 ${env.versionNumber} || EXIT /B 0" + bat "e:\\fart.exe VersGen\\VersGen.cs 0.0.0.0 ${env.versionNumber} || EXIT /B 0" // checkout NuGet in file sorgente!!! fixNuget("${WORKSPACE}\\IOB-WIN.sln") fixNuget("${WORKSPACE}\\IOB-WIN-NEXT.sln") @@ -214,7 +214,7 @@ def fixResources(basePath){ // elimino files conf personalizzata per ogni install... bat "RD /S /Q ${basePath}\\bin\\DATA || EXIT /B 0" // manifest.xml: aggiorno versNumber ed URL del branch di update... - bat "e:\\fart.exe ${basePath}\\Resources\\manifest.xml 1.0.0.0 ${env.versionNumber} || EXIT /B 0" + bat "e:\\fart.exe ${basePath}\\Resources\\manifest.xml 0.0.0.0 ${env.versionNumber} || EXIT /B 0" bat "e:\\fart.exe ${basePath}\\Resources\\manifest.xml {{BRANCHNAME}} ${env.BRANCH_NAME} || EXIT /B 0" bat "e:\\fart.exe ${basePath}\\Resources\\ChangeLog.html {{CURRENT-REL}} ${env.versionNumber} || EXIT /B 0" bat "e:\\fart.exe ${basePath}\\Resources\\ChangeLog.html {{CURR-YEAR}} ${anno} || EXIT /B 0" diff --git a/Test-S7/Test-S7.csproj b/Test-S7/Test-S7.csproj index 5d17eda3..ab04face 100644 --- a/Test-S7/Test-S7.csproj +++ b/Test-S7/Test-S7.csproj @@ -36,7 +36,7 @@ ..\packages\NLog.4.7.11\lib\net45\NLog.dll - ..\packages\S7netplus.0.1.7\lib\net45\S7.Net.dll + ..\packages\S7netplus.0.1.9\lib\net45\S7.Net.dll diff --git a/Test-S7/TestMainForm.Designer.cs b/Test-S7/TestMainForm.Designer.cs index f2c793cc..859798ff 100644 --- a/Test-S7/TestMainForm.Designer.cs +++ b/Test-S7/TestMainForm.Designer.cs @@ -58,6 +58,7 @@ this.toolStripProgressBar1 = new System.Windows.Forms.ToolStripProgressBar(); this.tslRTime = new System.Windows.Forms.ToolStripStatusLabel(); this.groupBox4 = new System.Windows.Forms.GroupBox(); + this.btnNumWriteReal = new System.Windows.Forms.Button(); this.btnStrWrite = new System.Windows.Forms.Button(); this.btnNumWriteB = new System.Windows.Forms.Button(); this.btnNumWriteDW = new System.Windows.Forms.Button(); @@ -70,7 +71,8 @@ this.label10 = new System.Windows.Forms.Label(); this.txtWriteAddr1 = new System.Windows.Forms.TextBox(); this.label7 = new System.Windows.Forms.Label(); - this.btnNumWriteReal = new System.Windows.Forms.Button(); + this.btnCharWrite = new System.Windows.Forms.Button(); + this.btnReadChar = new System.Windows.Forms.Button(); this.groupBox1.SuspendLayout(); this.groupBox2.SuspendLayout(); this.groupBox3.SuspendLayout(); @@ -81,7 +83,7 @@ // txtIP // this.txtIP.Location = new System.Drawing.Point(64, 19); - this.txtIP.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.txtIP.Margin = new System.Windows.Forms.Padding(2); this.txtIP.Name = "txtIP"; this.txtIP.Size = new System.Drawing.Size(83, 20); this.txtIP.TabIndex = 0; @@ -108,7 +110,7 @@ "S71200", "S71500"}); this.cbCpuType.Location = new System.Drawing.Point(64, 50); - this.cbCpuType.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.cbCpuType.Margin = new System.Windows.Forms.Padding(2); this.cbCpuType.Name = "cbCpuType"; this.cbCpuType.Size = new System.Drawing.Size(83, 21); this.cbCpuType.TabIndex = 2; @@ -138,7 +140,7 @@ // txtMemArea // this.txtMemArea.Location = new System.Drawing.Point(117, 16); - this.txtMemArea.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.txtMemArea.Margin = new System.Windows.Forms.Padding(2); this.txtMemArea.Name = "txtMemArea"; this.txtMemArea.Size = new System.Drawing.Size(89, 20); this.txtMemArea.TabIndex = 4; @@ -149,7 +151,7 @@ // label3 // this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(7, 65); + this.label3.Location = new System.Drawing.Point(7, 54); this.label3.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(90, 13); @@ -158,8 +160,8 @@ // // txtMemSize // - this.txtMemSize.Location = new System.Drawing.Point(117, 63); - this.txtMemSize.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.txtMemSize.Location = new System.Drawing.Point(117, 52); + this.txtMemSize.Margin = new System.Windows.Forms.Padding(2); this.txtMemSize.Name = "txtMemSize"; this.txtMemSize.Size = new System.Drawing.Size(89, 20); this.txtMemSize.TabIndex = 6; @@ -170,6 +172,7 @@ // groupBox1 // this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.groupBox1.Controls.Add(this.btnReadChar); this.groupBox1.Controls.Add(this.btnReadString); this.groupBox1.Controls.Add(this.btnReadDWord); this.groupBox1.Controls.Add(this.btnReadWord); @@ -181,67 +184,67 @@ this.groupBox1.Controls.Add(this.label3); this.groupBox1.Controls.Add(this.label2); this.groupBox1.Location = new System.Drawing.Point(351, 10); - this.groupBox1.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.groupBox1.Margin = new System.Windows.Forms.Padding(2); this.groupBox1.Name = "groupBox1"; - this.groupBox1.Padding = new System.Windows.Forms.Padding(2, 2, 2, 2); - this.groupBox1.Size = new System.Drawing.Size(290, 85); + this.groupBox1.Padding = new System.Windows.Forms.Padding(2); + this.groupBox1.Size = new System.Drawing.Size(290, 97); this.groupBox1.TabIndex = 8; this.groupBox1.TabStop = false; this.groupBox1.Text = "Memoria: READ param"; // // btnReadString // - this.btnReadString.Location = new System.Drawing.Point(209, 61); - this.btnReadString.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.btnReadString.Location = new System.Drawing.Point(10, 74); + this.btnReadString.Margin = new System.Windows.Forms.Padding(2); this.btnReadString.Name = "btnReadString"; this.btnReadString.Size = new System.Drawing.Size(76, 20); this.btnReadString.TabIndex = 11; - this.btnReadString.Text = "READ String"; + this.btnReadString.Text = "R String"; this.btnReadString.UseVisualStyleBackColor = true; this.btnReadString.Click += new System.EventHandler(this.btnReadString_Click); // // btnReadDWord // - this.btnReadDWord.Location = new System.Drawing.Point(209, 38); - this.btnReadDWord.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.btnReadDWord.Location = new System.Drawing.Point(209, 53); + this.btnReadDWord.Margin = new System.Windows.Forms.Padding(2); this.btnReadDWord.Name = "btnReadDWord"; this.btnReadDWord.Size = new System.Drawing.Size(76, 20); this.btnReadDWord.TabIndex = 10; - this.btnReadDWord.Text = "READ DW"; + this.btnReadDWord.Text = "R DWord"; this.btnReadDWord.TextImageRelation = System.Windows.Forms.TextImageRelation.TextAboveImage; this.btnReadDWord.UseVisualStyleBackColor = true; this.btnReadDWord.Click += new System.EventHandler(this.btnReadDWord_Click); // // btnReadWord // - this.btnReadWord.Location = new System.Drawing.Point(209, 15); - this.btnReadWord.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.btnReadWord.Location = new System.Drawing.Point(209, 32); + this.btnReadWord.Margin = new System.Windows.Forms.Padding(2); this.btnReadWord.Name = "btnReadWord"; this.btnReadWord.Size = new System.Drawing.Size(76, 20); this.btnReadWord.TabIndex = 10; - this.btnReadWord.Text = "READ W"; + this.btnReadWord.Text = "R Word"; this.btnReadWord.UseVisualStyleBackColor = true; this.btnReadWord.Click += new System.EventHandler(this.btnReadWord_Click); // // btnReadReal // - this.btnReadReal.Location = new System.Drawing.Point(176, 39); - this.btnReadReal.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.btnReadReal.Location = new System.Drawing.Point(209, 74); + this.btnReadReal.Margin = new System.Windows.Forms.Padding(2); this.btnReadReal.Name = "btnReadReal"; - this.btnReadReal.Size = new System.Drawing.Size(30, 20); + this.btnReadReal.Size = new System.Drawing.Size(75, 20); this.btnReadReal.TabIndex = 9; - this.btnReadReal.Text = "REAL"; + this.btnReadReal.Text = "R Real"; this.btnReadReal.UseVisualStyleBackColor = true; this.btnReadReal.Click += new System.EventHandler(this.btnReadReal_Click); // // btnReadByte // - this.btnReadByte.Location = new System.Drawing.Point(117, 38); - this.btnReadByte.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.btnReadByte.Location = new System.Drawing.Point(209, 11); + this.btnReadByte.Margin = new System.Windows.Forms.Padding(2); this.btnReadByte.Name = "btnReadByte"; - this.btnReadByte.Size = new System.Drawing.Size(55, 20); + this.btnReadByte.Size = new System.Drawing.Size(76, 20); this.btnReadByte.TabIndex = 9; - this.btnReadByte.Text = "READ B"; + this.btnReadByte.Text = "R Byte"; this.btnReadByte.UseVisualStyleBackColor = true; this.btnReadByte.Click += new System.EventHandler(this.btnReadByte_Click); // @@ -251,10 +254,10 @@ this.textBox1.BorderStyle = System.Windows.Forms.BorderStyle.None; this.textBox1.Font = new System.Drawing.Font("Microsoft Sans Serif", 7F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.textBox1.Location = new System.Drawing.Point(9, 36); - this.textBox1.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.textBox1.Margin = new System.Windows.Forms.Padding(2); this.textBox1.Multiline = true; this.textBox1.Name = "textBox1"; - this.textBox1.Size = new System.Drawing.Size(95, 27); + this.textBox1.Size = new System.Drawing.Size(197, 16); this.textBox1.TabIndex = 8; this.textBox1.Text = "Indicare tipo memoria e size del tipo"; // @@ -265,11 +268,11 @@ | System.Windows.Forms.AnchorStyles.Right))); this.groupBox2.AutoSize = true; this.groupBox2.Controls.Add(this.txtOut); - this.groupBox2.Location = new System.Drawing.Point(9, 154); - this.groupBox2.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.groupBox2.Location = new System.Drawing.Point(9, 165); + this.groupBox2.Margin = new System.Windows.Forms.Padding(2); this.groupBox2.Name = "groupBox2"; - this.groupBox2.Padding = new System.Windows.Forms.Padding(2, 2, 2, 2); - this.groupBox2.Size = new System.Drawing.Size(632, 327); + this.groupBox2.Padding = new System.Windows.Forms.Padding(2); + this.groupBox2.Size = new System.Drawing.Size(632, 371); this.groupBox2.TabIndex = 9; this.groupBox2.TabStop = false; this.groupBox2.Text = "Risultati"; @@ -281,11 +284,11 @@ this.txtOut.Font = new System.Drawing.Font("Microsoft Sans Serif", 7F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.txtOut.ForeColor = System.Drawing.Color.Yellow; this.txtOut.Location = new System.Drawing.Point(2, 15); - this.txtOut.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.txtOut.Margin = new System.Windows.Forms.Padding(2); this.txtOut.Multiline = true; this.txtOut.Name = "txtOut"; this.txtOut.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; - this.txtOut.Size = new System.Drawing.Size(628, 310); + this.txtOut.Size = new System.Drawing.Size(628, 354); this.txtOut.TabIndex = 0; this.txtOut.Text = "..."; // @@ -302,10 +305,10 @@ this.groupBox3.Controls.Add(this.lblIP); this.groupBox3.Controls.Add(this.label1); this.groupBox3.Location = new System.Drawing.Point(9, 10); - this.groupBox3.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.groupBox3.Margin = new System.Windows.Forms.Padding(2); this.groupBox3.Name = "groupBox3"; - this.groupBox3.Padding = new System.Windows.Forms.Padding(2, 2, 2, 2); - this.groupBox3.Size = new System.Drawing.Size(336, 85); + this.groupBox3.Padding = new System.Windows.Forms.Padding(2); + this.groupBox3.Size = new System.Drawing.Size(336, 97); this.groupBox3.TabIndex = 10; this.groupBox3.TabStop = false; this.groupBox3.Text = "Parametri PLC"; @@ -316,7 +319,7 @@ this.textBox2.BorderStyle = System.Windows.Forms.BorderStyle.None; this.textBox2.Font = new System.Drawing.Font("Microsoft Sans Serif", 7F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.textBox2.Location = new System.Drawing.Point(226, 31); - this.textBox2.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.textBox2.Margin = new System.Windows.Forms.Padding(2); this.textBox2.Multiline = true; this.textBox2.Name = "textBox2"; this.textBox2.Size = new System.Drawing.Size(105, 44); @@ -336,7 +339,7 @@ // txtSlot // this.txtSlot.Location = new System.Drawing.Point(190, 50); - this.txtSlot.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.txtSlot.Margin = new System.Windows.Forms.Padding(2); this.txtSlot.Name = "txtSlot"; this.txtSlot.Size = new System.Drawing.Size(32, 20); this.txtSlot.TabIndex = 5; @@ -356,7 +359,7 @@ // txtRack // this.txtRack.Location = new System.Drawing.Point(190, 19); - this.txtRack.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.txtRack.Margin = new System.Windows.Forms.Padding(2); this.txtRack.Name = "txtRack"; this.txtRack.Size = new System.Drawing.Size(32, 20); this.txtRack.TabIndex = 5; @@ -381,7 +384,7 @@ this.toolStripStatusLabel1, this.toolStripProgressBar1, this.tslRTime}); - this.statusStrip1.Location = new System.Drawing.Point(0, 485); + this.statusStrip1.Location = new System.Drawing.Point(0, 540); this.statusStrip1.Name = "statusStrip1"; this.statusStrip1.Padding = new System.Windows.Forms.Padding(1, 0, 10, 0); this.statusStrip1.Size = new System.Drawing.Size(652, 22); @@ -415,6 +418,7 @@ // this.groupBox4.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); + this.groupBox4.Controls.Add(this.btnCharWrite); this.groupBox4.Controls.Add(this.btnNumWriteReal); this.groupBox4.Controls.Add(this.btnStrWrite); this.groupBox4.Controls.Add(this.btnNumWriteB); @@ -428,63 +432,75 @@ this.groupBox4.Controls.Add(this.label10); this.groupBox4.Controls.Add(this.txtWriteAddr1); this.groupBox4.Controls.Add(this.label7); - this.groupBox4.Location = new System.Drawing.Point(9, 95); - this.groupBox4.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.groupBox4.Location = new System.Drawing.Point(9, 105); + this.groupBox4.Margin = new System.Windows.Forms.Padding(2); this.groupBox4.Name = "groupBox4"; - this.groupBox4.Padding = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.groupBox4.Padding = new System.Windows.Forms.Padding(2); this.groupBox4.Size = new System.Drawing.Size(632, 58); this.groupBox4.TabIndex = 12; this.groupBox4.TabStop = false; this.groupBox4.Text = "Memoria: WRITE param"; // + // btnNumWriteReal + // + this.btnNumWriteReal.Location = new System.Drawing.Point(258, 13); + this.btnNumWriteReal.Margin = new System.Windows.Forms.Padding(2); + this.btnNumWriteReal.Name = "btnNumWriteReal"; + this.btnNumWriteReal.RightToLeft = System.Windows.Forms.RightToLeft.No; + this.btnNumWriteReal.Size = new System.Drawing.Size(64, 19); + this.btnNumWriteReal.TabIndex = 11; + this.btnNumWriteReal.Text = "W Real"; + this.btnNumWriteReal.UseVisualStyleBackColor = true; + this.btnNumWriteReal.Click += new System.EventHandler(this.btnNumWriteReal_Click); + // // btnStrWrite // - this.btnStrWrite.Location = new System.Drawing.Point(599, 20); - this.btnStrWrite.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.btnStrWrite.Location = new System.Drawing.Point(548, 9); + this.btnStrWrite.Margin = new System.Windows.Forms.Padding(2); this.btnStrWrite.Name = "btnStrWrite"; - this.btnStrWrite.Size = new System.Drawing.Size(31, 19); + this.btnStrWrite.Size = new System.Drawing.Size(79, 24); this.btnStrWrite.TabIndex = 10; - this.btnStrWrite.Text = "SW"; + this.btnStrWrite.Text = "W String"; this.btnStrWrite.UseVisualStyleBackColor = true; this.btnStrWrite.Click += new System.EventHandler(this.btnStrWrite_Click); // // btnNumWriteB // - this.btnNumWriteB.Location = new System.Drawing.Point(244, 8); - this.btnNumWriteB.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.btnNumWriteB.Location = new System.Drawing.Point(193, 13); + this.btnNumWriteB.Margin = new System.Windows.Forms.Padding(2); this.btnNumWriteB.Name = "btnNumWriteB"; - this.btnNumWriteB.Size = new System.Drawing.Size(36, 19); + this.btnNumWriteB.Size = new System.Drawing.Size(64, 19); this.btnNumWriteB.TabIndex = 10; - this.btnNumWriteB.Text = "B"; + this.btnNumWriteB.Text = "W Byte"; this.btnNumWriteB.UseVisualStyleBackColor = true; this.btnNumWriteB.Click += new System.EventHandler(this.btnNumWriteB_Click); // // btnNumWriteDW // - this.btnNumWriteDW.Location = new System.Drawing.Point(280, 27); - this.btnNumWriteDW.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.btnNumWriteDW.Location = new System.Drawing.Point(258, 32); + this.btnNumWriteDW.Margin = new System.Windows.Forms.Padding(2); this.btnNumWriteDW.Name = "btnNumWriteDW"; - this.btnNumWriteDW.Size = new System.Drawing.Size(36, 19); + this.btnNumWriteDW.Size = new System.Drawing.Size(64, 19); this.btnNumWriteDW.TabIndex = 10; - this.btnNumWriteDW.Text = "DW"; + this.btnNumWriteDW.Text = "W DWord"; this.btnNumWriteDW.UseVisualStyleBackColor = true; this.btnNumWriteDW.Click += new System.EventHandler(this.btnNumWriteDW_Click); // // btnNumWriteW // - this.btnNumWriteW.Location = new System.Drawing.Point(244, 27); - this.btnNumWriteW.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.btnNumWriteW.Location = new System.Drawing.Point(193, 32); + this.btnNumWriteW.Margin = new System.Windows.Forms.Padding(2); this.btnNumWriteW.Name = "btnNumWriteW"; - this.btnNumWriteW.Size = new System.Drawing.Size(36, 19); + this.btnNumWriteW.Size = new System.Drawing.Size(64, 19); this.btnNumWriteW.TabIndex = 10; - this.btnNumWriteW.Text = "W"; + this.btnNumWriteW.Text = "W Word"; this.btnNumWriteW.UseVisualStyleBackColor = true; this.btnNumWriteW.Click += new System.EventHandler(this.btnNumWriteW_Click); // // txtWriteVal2 // - this.txtWriteVal2.Location = new System.Drawing.Point(492, 20); - this.txtWriteVal2.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.txtWriteVal2.Location = new System.Drawing.Point(430, 29); + this.txtWriteVal2.Margin = new System.Windows.Forms.Padding(2); this.txtWriteVal2.Name = "txtWriteVal2"; this.txtWriteVal2.Size = new System.Drawing.Size(108, 20); this.txtWriteVal2.TabIndex = 8; @@ -494,7 +510,7 @@ // label9 // this.label9.AutoSize = true; - this.label9.Location = new System.Drawing.Point(455, 22); + this.label9.Location = new System.Drawing.Point(427, 14); this.label9.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.label9.Name = "label9"; this.label9.Size = new System.Drawing.Size(29, 13); @@ -503,8 +519,8 @@ // // txtWriteVal1 // - this.txtWriteVal1.Location = new System.Drawing.Point(178, 20); - this.txtWriteVal1.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.txtWriteVal1.Location = new System.Drawing.Point(116, 29); + this.txtWriteVal1.Margin = new System.Windows.Forms.Padding(2); this.txtWriteVal1.Name = "txtWriteVal1"; this.txtWriteVal1.Size = new System.Drawing.Size(65, 20); this.txtWriteVal1.TabIndex = 8; @@ -514,7 +530,7 @@ // label8 // this.label8.AutoSize = true; - this.label8.Location = new System.Drawing.Point(148, 22); + this.label8.Location = new System.Drawing.Point(115, 14); this.label8.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.label8.Name = "label8"; this.label8.Size = new System.Drawing.Size(32, 13); @@ -523,8 +539,8 @@ // // txtWriteAddr2 // - this.txtWriteAddr2.Location = new System.Drawing.Point(361, 20); - this.txtWriteAddr2.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.txtWriteAddr2.Location = new System.Drawing.Point(329, 29); + this.txtWriteAddr2.Margin = new System.Windows.Forms.Padding(2); this.txtWriteAddr2.Name = "txtWriteAddr2"; this.txtWriteAddr2.Size = new System.Drawing.Size(88, 20); this.txtWriteAddr2.TabIndex = 6; @@ -534,7 +550,7 @@ // label10 // this.label10.AutoSize = true; - this.label10.Location = new System.Drawing.Point(317, 22); + this.label10.Location = new System.Drawing.Point(326, 13); this.label10.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.label10.Name = "label10"; this.label10.Size = new System.Drawing.Size(47, 13); @@ -543,8 +559,8 @@ // // txtWriteAddr1 // - this.txtWriteAddr1.Location = new System.Drawing.Point(53, 20); - this.txtWriteAddr1.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.txtWriteAddr1.Location = new System.Drawing.Point(4, 29); + this.txtWriteAddr1.Margin = new System.Windows.Forms.Padding(2); this.txtWriteAddr1.Name = "txtWriteAddr1"; this.txtWriteAddr1.Size = new System.Drawing.Size(93, 20); this.txtWriteAddr1.TabIndex = 6; @@ -554,36 +570,46 @@ // label7 // this.label7.AutoSize = true; - this.label7.Location = new System.Drawing.Point(4, 22); + this.label7.Location = new System.Drawing.Point(4, 14); this.label7.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.label7.Name = "label7"; this.label7.Size = new System.Drawing.Size(47, 13); this.label7.TabIndex = 7; this.label7.Text = "ADDR 1"; // - // btnNumWriteReal + // btnCharWrite // - this.btnNumWriteReal.Location = new System.Drawing.Point(280, 8); - this.btnNumWriteReal.Margin = new System.Windows.Forms.Padding(2); - this.btnNumWriteReal.Name = "btnNumWriteReal"; - this.btnNumWriteReal.RightToLeft = System.Windows.Forms.RightToLeft.No; - this.btnNumWriteReal.Size = new System.Drawing.Size(36, 19); - this.btnNumWriteReal.TabIndex = 11; - this.btnNumWriteReal.Text = "RE"; - this.btnNumWriteReal.UseVisualStyleBackColor = true; - this.btnNumWriteReal.Click += new System.EventHandler(this.btnNumWriteReal_Click); + this.btnCharWrite.Location = new System.Drawing.Point(548, 32); + this.btnCharWrite.Margin = new System.Windows.Forms.Padding(2); + this.btnCharWrite.Name = "btnCharWrite"; + this.btnCharWrite.Size = new System.Drawing.Size(79, 24); + this.btnCharWrite.TabIndex = 12; + this.btnCharWrite.Text = "W Char[]"; + this.btnCharWrite.UseVisualStyleBackColor = true; + this.btnCharWrite.Click += new System.EventHandler(this.btnCharWrite_Click); + // + // btnReadChar + // + this.btnReadChar.Location = new System.Drawing.Point(104, 74); + this.btnReadChar.Margin = new System.Windows.Forms.Padding(2); + this.btnReadChar.Name = "btnReadChar"; + this.btnReadChar.Size = new System.Drawing.Size(76, 20); + this.btnReadChar.TabIndex = 12; + this.btnReadChar.Text = "R Char[]"; + this.btnReadChar.UseVisualStyleBackColor = true; + this.btnReadChar.Click += new System.EventHandler(this.btnReadChar_Click); // // TestMainForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(652, 507); + this.ClientSize = new System.Drawing.Size(652, 562); this.Controls.Add(this.groupBox4); this.Controls.Add(this.statusStrip1); this.Controls.Add(this.groupBox3); this.Controls.Add(this.groupBox2); this.Controls.Add(this.groupBox1); - this.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.Margin = new System.Windows.Forms.Padding(2); this.Name = "TestMainForm"; this.Text = "SIEMENS S7 TEST"; this.groupBox1.ResumeLayout(false); @@ -646,6 +672,8 @@ private System.Windows.Forms.Button btnNumWriteB; private System.Windows.Forms.Button btnNumWriteDW; private System.Windows.Forms.Button btnNumWriteReal; + private System.Windows.Forms.Button btnCharWrite; + private System.Windows.Forms.Button btnReadChar; } } diff --git a/Test-S7/TestMainForm.cs b/Test-S7/TestMainForm.cs index 2f83283b..38c5bb4d 100644 --- a/Test-S7/TestMainForm.cs +++ b/Test-S7/TestMainForm.cs @@ -97,6 +97,12 @@ namespace Test_S7 #region Private Methods + private void btnCharWrite_Click(object sender, EventArgs e) + { + setParamPlc(); + eseguiScritturaCharArray(); + } + private void btnNumWriteB_Click(object sender, EventArgs e) { setParamPlc(); @@ -127,6 +133,12 @@ namespace Test_S7 eseguiLetturaByte(); } + private void btnReadChar_Click(object sender, EventArgs e) + { + setParamPlc(); + eseguiLetturaCharArray(); + } + private void btnReadDWord_Click(object sender, EventArgs e) { setParamPlc(); @@ -199,6 +211,34 @@ namespace Test_S7 tslRTime.Text = string.Format("{0}", sw.Elapsed); } + /// + /// Esecuzione lettura tipo Char Array! + /// + private void eseguiLetturaCharArray() + { + sw.Restart(); + if (testCncConn()) + { + // decodifico memoria... + memAddress memoria = new memAddress(txtMemArea.Text); + int numByte = 1; + int.TryParse(txtMemSize.Text, out numByte); + Byte[] memByteRead = currPLC.ReadBytes(DataType.DataBlock, memoria.DbNum, memoria.indiceMem, numByte); + titolo = string.Format("READ BLOCK MEM CHAR[]: {0} --> {1} byte", txtMemArea.Text, numByte); + contenuto = ""; + // poi prendo la stringa... + string outVal = ""; + for (int i = 0; i < numByte; i++) + { + outVal += Char.ConvertFromUtf32(memByteRead[i]); + } + contenuto += string.Format("{0}{1}", outVal, Environment.NewLine); + showOut(titolo, contenuto); + } + sw.Stop(); + tslRTime.Text = string.Format("{0}", sw.Elapsed); + } + /// /// Esecuzione lettura DWORD! /// @@ -368,6 +408,43 @@ namespace Test_S7 tslRTime.Text = string.Format("{0}", sw.Elapsed); } + /// + /// Esecuzione SCRITTURA Char Array! + /// + private void eseguiScritturaCharArray() + { + sw.Restart(); + if (testCncConn()) + { + // decodifico memoria... + memAddress memoria = new memAddress(txtWriteAddr2.Text); + int num2write = 0; + // verifico di no sforare con lunghezza + string val2write = txtWriteVal2.Text; + // se è maggiore di maxStrChar TRIMMA::: + if (val2write.Length > maxStrChar) + { + val2write = val2write.Substring(0, 20); + } + // scambio spazi con underscore... e MAIUSCOLO!!! + val2write = val2write.Replace(' ', '_').ToUpper(); + num2write = val2write.Length; + byte[] DB_Byte = new byte[maxStrChar]; + // converto 1-1 i char in byte... + for (int i = 0; i < num2write; i++) + { + DB_Byte[i] = (byte)(val2write[i]); + } + currPLC.WriteBytes(DataType.DataBlock, memoria.DbNum, memoria.indiceMem, DB_Byte); + titolo = string.Format("WRITE BLOCK MEM: {0}", txtWriteAddr1.Text); + contenuto = ""; + contenuto += string.Format("DT: {0} | DbNum: {1} | indiceMem: {2} | stringa: {3}{4}{4}", DataType.DataBlock, memoria.DbNum, memoria.indiceMem, num2write, Environment.NewLine); + showOut(titolo, contenuto); + } + sw.Stop(); + tslRTime.Text = string.Format("{0}", sw.Elapsed); + } + /// /// Esecuzione SCRITTURA DWORD! /// @@ -437,7 +514,7 @@ namespace Test_S7 // decodifico memoria... memAddress memoria = new memAddress(txtWriteAddr2.Text); int num2write = 0; - // verifico di no sforare con lunghezza + // verifico di non sforare con lunghezza string val2write = txtWriteVal2.Text; // se è maggiore di maxStrChar TRIMMA::: if (val2write.Length > maxStrChar) diff --git a/Test-S7/packages.config b/Test-S7/packages.config index f9eff257..4085c23c 100644 --- a/Test-S7/packages.config +++ b/Test-S7/packages.config @@ -3,5 +3,5 @@ - + \ No newline at end of file diff --git a/VersGen/VersGen.cs b/VersGen/VersGen.cs index 747e542a..a19fbc9d 100644 --- a/VersGen/VersGen.cs +++ b/VersGen/VersGen.cs @@ -3,7 +3,7 @@ // the next time this code is regenerated. // using System.Reflection; -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] -[assembly: AssemblyCopyright("Steamware © 2006-2020")] +[assembly: AssemblyVersion("0.0.0.0")] +[assembly: AssemblyFileVersion("0.0.0.0")] +[assembly: AssemblyCopyright("Steamware © 2006-2021")] [assembly: AssemblyCompany("Steamware")] \ No newline at end of file diff --git a/VersGen/VersGen.tt b/VersGen/VersGen.tt index d5ad750d..34cd7a30 100644 --- a/VersGen/VersGen.tt +++ b/VersGen/VersGen.tt @@ -4,7 +4,7 @@ // the next time this code is regenerated. // using System.Reflection; -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: AssemblyVersion("0.0.0.0")] +[assembly: AssemblyFileVersion("0.0.0.0")] [assembly: AssemblyCopyright("Steamware © 2006-<#= DateTime.Now.Year #>")] [assembly: AssemblyCompany("Steamware")] \ No newline at end of file