-
大小: 106KB文件類型: .zip金幣: 2下載: 1 次發(fā)布日期: 2021-06-03
- 語言: 數(shù)據(jù)庫
- 標(biāo)簽: modbus??
資源簡介
接收MODBUS透傳回?cái)?shù)據(jù)中心,存入SQL。目前正在使用,前端為西門子300做主站,經(jīng)云透傳,數(shù)據(jù)中心接收。

代碼片段和文件信息
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?RtComm;
using?System.Threading;
namespace?RCM
{
????public?partial?class?Form1?:?Form
????{
????????public?static?RtComm.CRtComm?write?=?new?RtComm.CRtComm();
????????public?Form1()
????????{
????????????InitializeComponent();
????????}
????????private?void?button1_Click(object?sender?EventArgs?e)
????????{
????????????write.RTConnect();
????????????label1.Text?=?DateTime.Now.ToString();
????????????label2.BackColor?=?Color.Green;
????????????System.Timers.Timer?t?=?new?System.Timers.Timer(1000*15);???//實(shí)例化Timer類,設(shè)置間隔時(shí)間為10000毫秒;???
????????????t.Elapsed?+=?new?System.Timers.ElapsedEventHandler(theout);?//到達(dá)時(shí)間的時(shí)候執(zhí)行事件;???
????????????t.AutoReset?=?true;???//設(shè)置是執(zhí)行一次(false)還是一直執(zhí)行(true);???
????????????t.Enabled?=?true;
????????}
????????public?void?theout(object?source?System.Timers.ElapsedEventArgs?e)
????????{
????????????try
????????????{
????????????????WebReference.WebServiceTOmodubs?getvalue?=?new?WebReference.WebServiceTOmodubs();
????????????????string?a?=?getvalue.selectAllInfo().Substring(0?getvalue.selectAllInfo().Length?-?1);
????????????????string[]?d?=?a.Split(‘&‘);
????????????????foreach?(string?dd?in?d)
????????????????{
????????????????????string[]?bb?=?dd.Split(‘=‘);
????????????????????string?time?=?DateTime.Now.ToString();
????????????????????int?iread?=?-1;
????????????????????double?bbb?=?Convert.ToDouble(bb[1]);
????????????????????System.object?lockThis?=?new?System.object();
????????????????????if?(Monitor.TryEnter(lockThis))
????????????????????{
????????????????????????iread?=?write.RTWriteData(bb[0]?bbb);
????????????????????????Monitor.Exit(lockThis);
????????????????????}
????????????????}
????????????????
????????????}
????????????catch
????????????{
????????????}
????????}
????}
}
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2018-09-28?17:48??RCM\
?????目錄???????????0??2018-07-30?16:27??RCM\RCM\
?????文件?????????851??2018-07-23?16:58??RCM\RCM.sln
?????文件???????18432??2018-07-24?11:37??RCM\RCM.suo
?????文件???????36864??2018-09-28?18:27??RCM\RCM.v12.suo
?????文件?????????856??2018-07-23?18:05??RCM\RCM\app.config
?????目錄???????????0??2018-07-30?16:27??RCM\RCM\bin\
?????目錄???????????0??2018-07-30?16:27??RCM\RCM\bin\Debug\
?????文件???????15360??2018-07-30?16:27??RCM\RCM\bin\Debug\RCM.exe
?????文件?????????856??2018-07-23?18:05??RCM\RCM\bin\Debug\RCM.exe.config
?????文件???????30208??2018-07-30?16:27??RCM\RCM\bin\Debug\RCM.pdb
?????文件???????24224??2018-09-28?17:48??RCM\RCM\bin\Debug\RCM.vshost.exe
?????文件?????????856??2018-07-23?18:05??RCM\RCM\bin\Debug\RCM.vshost.exe.config
?????文件?????????490??2010-03-17?22:39??RCM\RCM\bin\Debug\RCM.vshost.exe.manifest
?????目錄???????????0??2018-07-23?18:05??RCM\RCM\bin\Release\
?????文件????????2091??2018-07-30?16:27??RCM\RCM\Form1.cs
?????文件????????3078??2018-07-23?22:05??RCM\RCM\Form1.Designer.cs
?????文件????????5817??2018-07-23?22:05??RCM\RCM\Form1.resx
?????目錄???????????0??2018-07-30?16:27??RCM\RCM\obj\
?????目錄???????????0??2018-07-30?16:27??RCM\RCM\obj\x86\
?????目錄???????????0??2018-09-28?17:48??RCM\RCM\obj\x86\Debug\
?????文件????????2861??2018-09-28?17:48??RCM\RCM\obj\x86\Debug\DesignTimeResolveAssemblyReferences.cache
?????文件????????7427??2018-09-28?17:48??RCM\RCM\obj\x86\Debug\DesignTimeResolveAssemblyReferencesInput.cache
?????文件?????????128??2018-07-30?16:27??RCM\RCM\obj\x86\Debug\GenerateResource.read.1.tlog
?????文件?????????338??2018-07-30?16:27??RCM\RCM\obj\x86\Debug\GenerateResource.write.1.tlog
?????文件????????6144??2018-09-28?17:48??RCM\RCM\obj\x86\Debug\Interop.RtComm.dll
?????文件?????????791??2018-09-28?17:49??RCM\RCM\obj\x86\Debug\RCM.csproj.FileListAbsolute.txt
?????文件?????????716??2018-09-28?17:48??RCM\RCM\obj\x86\Debug\RCM.csproj.ResolveComReference.cache
?????文件???????15360??2018-07-30?16:27??RCM\RCM\obj\x86\Debug\RCM.exe
?????文件?????????180??2018-07-30?16:27??RCM\RCM\obj\x86\Debug\RCM.Form1.resources
?????文件???????30208??2018-07-30?16:27??RCM\RCM\obj\x86\Debug\RCM.pdb
............此處省略19個(gè)文件信息
評論
共有 條評論