91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 118KB
    文件類(lèi)型: .rar
    金幣: 2
    下載: 1 次
    發(fā)布日期: 2021-06-12
  • 語(yǔ)言: C#
  • 標(biāo)簽: C#??電能表??DLT645??485模塊??

資源簡(jiǎn)介

本程序采用C#實(shí)現(xiàn)能夠讀取電能表電表數(shù)據(jù),電能表需具有485模塊,通過(guò)485轉(zhuǎn)232串口線和232轉(zhuǎn)usb串口線與電腦相鏈接,安裝相應(yīng)的驅(qū)動(dòng)程序,即可在電腦上讀出電能表的數(shù)據(jù)。對(duì)嵌入式程序的設(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?System.IO.Ports;
using?System.Collections;
using?System.IO;
using?System.Text.Regularexpressions;
using?System.Reflection;
using?System.Threading;

namespace?WindowsFormsApplication21
{
????public?partial?class?Form1?:?Form
????{
????????int?count?=?0;//發(fā)送的次數(shù)
????????int?sendcount?=?0;
????????int?getcount?=?0;
??????
????????public?Form1()
????????{
????????????InitializeComponent();
????????}
???????//串口界面初始化
????????private?void?Form1_Load(object?sender?EventArgs?e)
????????{
????????????//如果有配置?則讀取配置文件
????????????if?(File.Exists(Application.StartupPath?+?@“\SerConfig.wjs“))
????????????{
????????????????using?(StreamReader?sr?=?new?StreamReader(Application.StartupPath?+?@“\SerConfig.wjs“?Encoding.UTF8))
????????????????{
????????????????????comboBox1.SelectedItem?=?sr.ReadLine();
????????????????????comboBox2.SelectedItem?=?sr.ReadLine();
????????????????????comboBox3.SelectedItem?=?sr.ReadLine();
????????????????????comboBox4.SelectedItem?=?sr.ReadLine();
????????????????????comboBox5.SelectedItem?=?sr.ReadLine();
????????????????????textBox4.Text?=?sr.ReadLine();
????????????????}
????????????}
????????????else?
????????????{
????????????????//初始化
????????????????comboBox1.SelectedIndex?=?4;
????????????????comboBox2.SelectedIndex?=?5;
????????????????comboBox3.SelectedIndex?=?0;
????????????????comboBox4.SelectedIndex?=?2;
????????????????comboBox5.SelectedIndex?=?0;
????????????}
????????????Version?version?=?System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
??????????//??this.Text?=?this.Text?+?“V“?+?version.Major?+?“.“?+?version.Minor;

????????????//掃描串口函數(shù)
????????????SearchAndAddSerialToComboBox(serialPort1comboBox1);
????????}

????????//掃描端口函數(shù)
????????private?void?SearchAndAddSerialToComboBox(SerialPort?MyPort?ComboBox?MyBox)
????????{
????????????String?Buffer;
????????????MyBox.Items.Clear();//清空列表
????????????for?(int?i?=?1;?i?<=?10;?i++)//測(cè)試每一個(gè)串口
????????????{
????????????????try
????????????????{
????????????????????Buffer?=?“COM“?+?i.ToString();
????????????????????MyPort.PortName?=?Buffer;//對(duì)端口賦值
????????????????????MyPort.Open();
????????????????????MyBox.Items.Add(Buffer);//添加到下拉列表里
????????????????????MyPort.Close();
????????????????}
????????????????catch?(Exception)//不能打開(kāi)運(yùn)行這里進(jìn)入下個(gè)i
????????????????{

????????????????}
????????????}
????????}

????????//設(shè)置串口名函數(shù)(當(dāng)改變選中項(xiàng)時(shí)發(fā)生)
????????private?void?comboBox1_SelectedIndexChanged(object?sender?EventArgs?e)
????????{
????????????if?(serialPort1.IsOpen)
????????????{
????????????????CloseSet();
????????????????serialPort1.PortName?=?comboBox1.Text;
????????????????OpenSet();
????????????}
????????????else?
????????????{
????????????????serialPort1.PortName?=?comboBox1.Text;
?????

?屬性????????????大小?????日期????時(shí)間???名稱(chēng)
-----------?---------??----------?-----??----

?????文件?????????77??2016-04-12?10:09??讀電表(自編)\WindowsFormsApplication21\app.config

?????文件?????????70??2016-04-02?22:18??讀電表(自編)\WindowsFormsApplication21\bin\Debug\SerConfig.wjs

?????文件??????27648??2016-04-12?10:11??讀電表(自編)\WindowsFormsApplication21\bin\Debug\WindowsFormsApplication21.dll

?????文件?????????77??2016-04-12?10:09??讀電表(自編)\WindowsFormsApplication21\bin\Debug\WindowsFormsApplication21.dll.config

?????文件??????81408??2016-04-12?10:11??讀電表(自編)\WindowsFormsApplication21\bin\Debug\WindowsFormsApplication21.pdb

?????文件??????11600??2016-04-12?10:05??讀電表(自編)\WindowsFormsApplication21\bin\Debug\WindowsFormsApplication21.vshost.exe

?????文件????????490??2010-03-17?22:39??讀電表(自編)\WindowsFormsApplication21\bin\Debug\WindowsFormsApplication21.vshost.exe.manifest

?????文件??????16950??2016-01-16?12:27??讀電表(自編)\WindowsFormsApplication21\Form1.cs

?????文件??????31254??2016-01-06?17:22??讀電表(自編)\WindowsFormsApplication21\Form1.Designer.cs

?????文件???????6612??2016-01-06?17:22??讀電表(自編)\WindowsFormsApplication21\Form1.resx

?????文件????????645??2016-01-02?22:04??讀電表(自編)\WindowsFormsApplication21\Form2.cs

?????文件???????6847??2016-01-02?22:04??讀電表(自編)\WindowsFormsApplication21\Form2.Designer.cs

?????文件???????5817??2016-01-02?22:04??讀電表(自編)\WindowsFormsApplication21\Form2.resx

?????文件???????4440??2015-12-26?13:44??讀電表(自編)\WindowsFormsApplication21\obj\x86\Debug\DesignTimeResolveAssemblyReferences.cache

?????文件???????6753??2016-04-12?10:11??讀電表(自編)\WindowsFormsApplication21\obj\x86\Debug\DesignTimeResolveAssemblyReferencesInput.cache

?????文件???????2834??2016-04-12?10:11??讀電表(自編)\WindowsFormsApplication21\obj\x86\Debug\GenerateResource.read.1.tlog

?????文件???????7886??2016-04-12?10:11??讀電表(自編)\WindowsFormsApplication21\obj\x86\Debug\GenerateResource.write.1.tlog

?????文件???????7897??2015-12-30?09:06??讀電表(自編)\WindowsFormsApplication21\obj\x86\Debug\ResolveAssemblyReference.cache

?????文件???????7702??2016-04-12?10:11??讀電表(自編)\WindowsFormsApplication21\obj\x86\Debug\WindowsFormsApplication21.csproj.FileListAbsolute.txt

?????文件??????27648??2016-04-12?10:11??讀電表(自編)\WindowsFormsApplication21\obj\x86\Debug\WindowsFormsApplication21.dll

?????文件????????180??2016-04-12?10:11??讀電表(自編)\WindowsFormsApplication21\obj\x86\Debug\WindowsFormsApplication21.Form1.resources

?????文件????????180??2016-04-12?10:11??讀電表(自編)\WindowsFormsApplication21\obj\x86\Debug\WindowsFormsApplication21.Form2.resources

?????文件??????81408??2016-04-12?10:11??讀電表(自編)\WindowsFormsApplication21\obj\x86\Debug\WindowsFormsApplication21.pdb

?????文件????????180??2016-04-12?10:11??讀電表(自編)\WindowsFormsApplication21\obj\x86\Debug\WindowsFormsApplication21.Properties.Resources.resources

?????文件????????506??2015-12-24?10:11??讀電表(自編)\WindowsFormsApplication21\Program.cs

?????文件???????1398??2016-01-02?10:12??讀電表(自編)\WindowsFormsApplication21\Properties\AssemblyInfo.cs

?????文件???????2898??2015-12-24?10:11??讀電表(自編)\WindowsFormsApplication21\Properties\Resources.Designer.cs

?????文件???????5612??2015-12-24?10:11??讀電表(自編)\WindowsFormsApplication21\Properties\Resources.resx

?????文件???????1108??2015-12-24?10:11??讀電表(自編)\WindowsFormsApplication21\Properties\Settings.Designer.cs

?????文件????????249??2015-12-24?10:11??讀電表(自編)\WindowsFormsApplication21\Properties\Settings.settings

............此處省略17個(gè)文件信息

評(píng)論

共有 條評(píng)論