資源簡(jiǎn)介
可以直接使用
代碼片段和文件信息
using?System;
using?System.Collections.Generic;
using?System.ComponentModel;
using?System.Data;
using?System.Drawing;
using?System.Linq;
using?System.Text;
using?System.Windows.Forms;
using?S7TCPDLL;
namespace?S71200_1500_300_400
{
????public?partial?class?Form1?:?Form
????{
????????public?Form1()
????????{
????????????InitializeComponent();
????????}
????????S7Client?client?=?new?S7Client();
????????string?TxtSlot?path;
????????string?TxtIP;
????????string?TxtRack;
????????public?void?connectIP()
????????{
????????????path?=?Application.StartupPath?+?@“\config.ini“;
????????????TxtIP?=?IniFile.ReadIniData(“PlcComTCP“?“IP“?““?path);
????????????TxtRack?=?IniFile.ReadIniData(“PlcComTCP“?“Rack“?““?path);
????????????TxtSlot?=?IniFile.ReadIniData(“PlcComTCP“?“Slot“?““?path);
????????????int?Rack?=?Convert.ToInt32(TxtRack);?int?Slot?=?Convert.ToInt32(TxtSlot);
????????????client.SetConnectionType(3);
????????????int?Result?=?client.ConnectTo(TxtIP?Rack?Slot);
????????????if?(Result?==?0)
????????????{
????????????????timer1.Enabled?=?true;
????????????????ovalShape2.BackColor?=?Color.Transparent;
????????????????ovalShape1.BackColor?=?Color.Lime;
????????????}
????????????else
????????????{
????????????????ovalShape2.BackColor?=?Color.Red;
????????????????ovalShape1.BackColor?=?Color.Transparent;
????????????}
????????}
????????
????????
????????
????????
????????
????????
????????
????????
????????
????????
????????private?void?groupBox5_Enter(object?sender?EventArgs?e)
????????{
????????}
????????private?void?Form1_Load(object?sender?EventArgs?e)
????????{
????????????connectIP();
????????}
????????private?void?Form1_FormClosed(object?sender?FormClosedEventArgs?e)
????????{
????????????this.Dispose();
????????}
????????private?void?timer1_Tick(object?sender?EventArgs?e)
????????{
????????????ovalShape1.Fillstyle?=?1?-?ovalShape1.Fillstyle;
????????????byte[]?EBBuffer?=?new?byte[1];
????????????int?result?=?client.EBRead(0?EBBuffer.Length?EBBuffer);
????????????if(result==0)
????????????{
????????????????////////////////狀態(tài)檢測(cè)/////////////////////
????????????????iO_INSTRUCTION1.AAValue?=?client.ReadBitIB(00);
????????????????iO_INSTRUCTION2.AAValue?=?client.ReadBitIB(10);
????????????????iO_INSTRUCTION3.AAValue?=?client.ReadBitQB(0?0);
????????????????iO_INSTRUCTION4.AAValue?=?client.ReadBitQB(1?0);
????????????????iO_INSTRUCTION5.AAValue?=?client.ReadBitMB(0?0);
????????????????iO_INSTRUCTION6.AAValue?=?client.ReadBitMB(100?6);
????????????????iO_INSTRUCTION7.AAValue?=?client.ReadBitDB(1?40?0?0);
????????????????iO_INSTRUCTION8.AAValue?=?client.ReadBitDB(1?40106);
????????????????////////////////報(bào)警監(jiān)控/////////////////////
????????????????iO_INSTRUCTION9.AAValue?=?client.ReadBitIB(0?3);
????????????????iO_INSTRUCTION10.AAValue?=?client.ReadBitIB(0?6);
????????????????iO_INSTRUCTION11.AAValue?=?client.ReadBit
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????文件??????68724??2019-09-27?17:07??S71200_1500(C#VS2013)\ReadMeFirst(軟件使用說(shuō)明).docx
?????文件????????533??2019-09-26?18:29??S71200_1500(C#VS2013)\ReadMeFirst.txt
?????文件?????????49??2019-09-26?22:28??S71200_1500(C#VS2013)\S71200_1500\S71200_1500_300_400\S71200_1500_300_400\bin\Debug\config.ini
?????文件??????57856??2019-09-27?14:00??S71200_1500(C#VS2013)\S71200_1500\S71200_1500_300_400\S71200_1500_300_400\bin\Debug\HID.exe
?????文件???????9728??2019-09-24?22:57??S71200_1500(C#VS2013)\S71200_1500\S71200_1500_300_400\S71200_1500_300_400\bin\Debug\IO_INSTRUCTIONS.dll
?????文件?????352256??2008-02-13?21:21??S71200_1500(C#VS2013)\S71200_1500\S71200_1500_300_400\S71200_1500_300_400\bin\Debug\Microsoft.VisualBasic.PowerPacks.dll
?????文件??????49664??2019-09-26?18:48??S71200_1500(C#VS2013)\S71200_1500\S71200_1500_300_400\S71200_1500_300_400\bin\Debug\S71200_1500_300_400.exe
?????文件??????36352??2019-09-26?18:48??S71200_1500(C#VS2013)\S71200_1500\S71200_1500_300_400\S71200_1500_300_400\bin\Debug\S71200_1500_300_400.pdb
?????文件??????22656??2019-09-26?18:49??S71200_1500(C#VS2013)\S71200_1500\S71200_1500_300_400\S71200_1500_300_400\bin\Debug\S71200_1500_300_400.vshost.exe
?????文件????????490??2016-07-16?19:44??S71200_1500(C#VS2013)\S71200_1500\S71200_1500_300_400\S71200_1500_300_400\bin\Debug\S71200_1500_300_400.vshost.exe.manifest
?????文件?????286720??2019-09-28?19:28??S71200_1500(C#VS2013)\S71200_1500\S71200_1500_300_400\S71200_1500_300_400\bin\Debug\S7TCPDLL.dll
?????文件?????286720??2019-09-28?19:28??S71200_1500(C#VS2013)\S71200_1500\S71200_1500_300_400\S71200_1500_300_400\DLL\S7TCPDLL.dll
?????文件???????7884??2019-09-26?18:48??S71200_1500(C#VS2013)\S71200_1500\S71200_1500_300_400\S71200_1500_300_400\Form1.cs
?????文件??????43384??2019-09-26?18:48??S71200_1500(C#VS2013)\S71200_1500\S71200_1500_300_400\S71200_1500_300_400\Form1.Designer.cs
?????文件??????23453??2019-09-26?18:48??S71200_1500(C#VS2013)\S71200_1500\S71200_1500_300_400\S71200_1500_300_400\Form1.resx
?????文件??????33421??2019-09-26?18:47??S71200_1500(C#VS2013)\S71200_1500\S71200_1500_300_400\S71200_1500_300_400\obj\Debug\DesignTimeResolveAssemblyReferences.cache
?????文件???????7460??2019-09-26?18:45??S71200_1500(C#VS2013)\S71200_1500\S71200_1500_300_400\S71200_1500_300_400\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache
?????文件???????2695??2019-09-26?18:49??S71200_1500(C#VS2013)\S71200_1500\S71200_1500_300_400\S71200_1500_300_400\obj\Debug\S71200_1500_300_400.csproj.FileListAbsolute.txt
?????文件????????977??2019-09-26?18:48??S71200_1500(C#VS2013)\S71200_1500\S71200_1500_300_400\S71200_1500_300_400\obj\Debug\S71200_1500_300_400.csproj.GenerateResource.Cache
?????文件??????16592??2019-09-26?18:48??S71200_1500(C#VS2013)\S71200_1500\S71200_1500_300_400\S71200_1500_300_400\obj\Debug\S71200_1500_300_400.csprojResolveAssemblyReference.cache
?????文件??????49664??2019-09-26?18:48??S71200_1500(C#VS2013)\S71200_1500\S71200_1500_300_400\S71200_1500_300_400\obj\Debug\S71200_1500_300_400.exe
?????文件??????11992??2019-09-26?18:48??S71200_1500(C#VS2013)\S71200_1500\S71200_1500_300_400\S71200_1500_300_400\obj\Debug\S71200_1500_300_400.Form1.resources
?????文件??????36352??2019-09-26?18:48??S71200_1500(C#VS2013)\S71200_1500\S71200_1500_300_400\S71200_1500_300_400\obj\Debug\S71200_1500_300_400.pdb
?????文件????????180??2019-09-26?18:48??S71200_1500(C#VS2013)\S71200_1500\S71200_1500_300_400\S71200_1500_300_400\obj\Debug\S71200_1500_300_400.Properties.Resources.resources
?????文件??????11426??2019-09-26?18:45??S71200_1500(C#VS2013)\S71200_1500\S71200_1500_300_400\S71200_1500_300_400\ooopic_1569657111.ico
?????文件????????500??2019-09-25?23:00??S71200_1500(C#VS2013)\S71200_1500\S71200_1500_300_400\S71200_1500_300_400\Program.cs
?????文件???????1362??2019-09-25?23:00??S71200_1500(C#VS2013)\S71200_1500\S71200_1500_300_400\S71200_1500_300_400\Properties\AssemblyInfo.cs
?????文件???????2890??2019-09-25?23:00??S71200_1500(C#VS2013)\S71200_1500\S71200_1500_300_400\S71200_1500_300_400\Properties\Resources.Designer.cs
?????文件???????5612??2019-09-25?23:00??S71200_1500(C#VS2013)\S71200_1500\S71200_1500_300_400\S71200_1500_300_400\Properties\Resources.resx
?????文件???????1106??2019-09-25?23:00??S71200_1500(C#VS2013)\S71200_1500\S71200_1500_300_400\S71200_1500_300_400\Properties\Settings.Designer.cs
............此處省略19個(gè)文件信息
評(píng)論
共有 條評(píng)論