資源簡介
用C#和measurementStudio,編寫的一個AD轉換的程序。MeasurementStudio做界面,比組態軟件要好,結合了labview和C#的長處

代碼片段和文件信息
using?NationalInstruments.Analysis;
using?NationalInstruments.Analysis.Conversion;
using?NationalInstruments.Analysis.Dsp;
using?NationalInstruments.Analysis.Dsp.Filters;
using?NationalInstruments.Analysis.Math;
using?NationalInstruments.Analysis.Monitoring;
using?NationalInstruments.Analysis.SignalGeneration;
using?NationalInstruments.Analysis.SpectralMeasurements;
using?NationalInstruments;
using?NationalInstruments.UI;
using?NationalInstruments.NetworkVariable;
using?NationalInstruments.NetworkVariable.WindowsForms;
using?NationalInstruments.Tdms;
using?NationalInstruments.UI.WindowsForms;
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;
namespace?ADCtest
{
????public?partial?class?Form1?:?Form
????{
????????int?j;
????????string?Dianya?=?““;
????????List?list?=?new?List();
????????private?bool?Listening?=?false;//是否沒有執行完invoke相關操作??
????????private?bool?Closing?=?false;//是否正在關閉串口,執行Application.DoEvents,并阻止再次invoke?
????????public?Form1()
????????{
????????????InitializeComponent();
????????}
????????private?void?Form1_Load(object?sender?EventArgs?e)
????????{
????????????serialPort1.PortName?=?“COM3“;
????????????serialPort1.BaudRate?=?9600;//波特率設置
????????????serialPort1.DataBits?=?8;
????????????serialPort1.StopBits?=?System.IO.Ports.StopBits.One;
????????????serialPort1.Parity?=?System.IO.Ports.Parity.None;
????????????serialPort1.Open();
????????????timer1.Start();
????????}
????????private?void?Form1_FormClosing(object?sender?FormClosingEventArgs?e)
????????{
????????????if?(serialPort1.IsOpen)
????????????{
????????????????Closing?=?true;
????????????????while?(Listening)?Application.DoEvents();
????????????????//打開時點擊,則關閉串口??
????????????????serialPort1.Close();
????????????????Closing?=?false;
????????????????Close();
????????????}
????????????else
????????????{
????????????????try
????????????????{
????????????????????serialPort1.Open();
????????????????}
????????????????catch?(Exception?ex)
????????????????{
????????????????????//捕獲到異常信息,創建一個新的comm對象,之前的不能用了。??
????????????????????serialPort1?=?new?SerialPort();
????????????????????//現實異常信息給客戶。??
????????????????????MessageBox.Show(ex.Message);
????????????????}
????????????}
????????}
????????private?void?timer1_Tick(object?sender?EventArgs?e)
????????{
????????????double?y?=?double.Parse(textBox1.Text);
????????????list.Add(y);
????????????double[]?yy?=?new?double[j];
????????????yy?=?list.ToArray();
????????????waveformPlot1.PlotY(yy);
????????}
????????private?void?DisplayText(object?sender?EventArgs?e)
????????{
????????????textBox1.Text?=?Dianya;
????????}
????????private?void?serialPort1_DataReceived(object?sender?SerialDataReceivedEventArgs?e)
????????{
????????????Dianya?=?serialPort1.ReadExisting().To
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????4768??2015-11-14?22:38??ADCtest\ADCtest\ADCtest.csproj
?????文件????????187??2015-11-14?22:38??ADCtest\ADCtest\App.config
?????文件??????18432??2015-11-24?14:19??ADCtest\ADCtest\bin\Debug\ADCtest.exe
?????文件????????187??2015-11-14?22:38??ADCtest\ADCtest\bin\Debug\ADCtest.exe.config
?????文件??????26112??2015-11-24?14:19??ADCtest\ADCtest\bin\Debug\ADCtest.pdb
?????文件??????22472??2016-01-10?09:35??ADCtest\ADCtest\bin\Debug\ADCtest.vshost.exe
?????文件????????187??2015-11-14?22:38??ADCtest\ADCtest\bin\Debug\ADCtest.vshost.exe.config
?????文件????????490??2010-03-17?22:39??ADCtest\ADCtest\bin\Debug\ADCtest.vshost.exe.manifest
?????文件?????256512??2015-06-12?08:48??ADCtest\ADCtest\bin\Debug\NationalInstruments.UI.st
?????文件???????3251??2015-11-24?14:19??ADCtest\ADCtest\Form1.cs
?????文件???????4473??2015-11-24?14:18??ADCtest\ADCtest\Form1.Designer.cs
?????文件???????6211??2015-11-27?10:49??ADCtest\ADCtest\Form1.resx
?????文件????????699??2016-01-10?09:35??ADCtest\ADCtest\obj\Debug\ADCtest.csproj.FileListAbsolute.txt
?????文件????????975??2015-11-24?14:18??ADCtest\ADCtest\obj\Debug\ADCtest.csproj.GenerateResource.Cache
?????文件??????44759??2015-11-14?22:38??ADCtest\ADCtest\obj\Debug\ADCtest.csprojResolveAssemblyReference.cache
?????文件??????18432??2015-11-24?14:19??ADCtest\ADCtest\obj\Debug\ADCtest.exe
?????文件???????7426??2015-11-14?22:38??ADCtest\ADCtest\obj\Debug\adctest.exe.licenses
?????文件????????180??2015-11-24?14:18??ADCtest\ADCtest\obj\Debug\ADCtest.Form1.resources
?????文件??????26112??2015-11-24?14:19??ADCtest\ADCtest\obj\Debug\ADCtest.pdb
?????文件????????180??2015-11-14?22:38??ADCtest\ADCtest\obj\Debug\ADCtest.Properties.Resources.resources
?????文件??????31265??2015-11-14?22:38??ADCtest\ADCtest\obj\Debug\DesignTimeResolveAssemblyReferences.cache
?????文件???????7570??2015-11-14?22:38??ADCtest\ADCtest\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache
?????文件??????????0??2015-11-14?22:38??ADCtest\ADCtest\obj\Debug\TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
?????文件??????????0??2015-11-14?22:38??ADCtest\ADCtest\obj\Debug\TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
?????文件??????????0??2015-11-14?22:38??ADCtest\ADCtest\obj\Debug\TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
?????文件????????499??2015-11-14?22:38??ADCtest\ADCtest\Program.cs
?????文件???????1426??2015-11-14?22:38??ADCtest\ADCtest\Properties\AssemblyInfo.cs
?????文件???????4631??2015-11-14?22:38??ADCtest\ADCtest\Properties\licenses.licx
?????文件???????2844??2015-11-14?22:38??ADCtest\ADCtest\Properties\Resources.Designer.cs
?????文件???????5612??2015-11-14?22:38??ADCtest\ADCtest\Properties\Resources.resx
............此處省略15個文件信息
評論
共有 條評論