„DAQMX kártya példaprogram” változatai közötti eltérés
A Fizipedia wikiből
(Új oldal, tartalma: „<syntaxhighlight lang=csharp> public class MainForm : System.Windows.Forms.Form { //Global valtozok private Task OutTask; //kimeneti Task: Dev1/…”) |
|||
1. sor: | 1. sor: | ||
<syntaxhighlight lang=csharp> | <syntaxhighlight lang=csharp> | ||
− | + | using System; | |
+ | using System.Collections.Generic; | ||
+ | using System.ComponentModel; | ||
+ | using System.Data; | ||
+ | using System.Drawing; | ||
+ | using System.Text; | ||
+ | using System.Windows.Forms; | ||
+ | namespace DAQMX | ||
+ | { | ||
+ | public class Form1 : Form | ||
{ | { | ||
//Global valtozok | //Global valtozok | ||
42. sor: | 51. sor: | ||
InTask.Dispose(); | InTask.Dispose(); | ||
} | } | ||
− | + | } | |
+ | } | ||
</syntaxhighlight> | </syntaxhighlight> |
A lap 2011. március 20., 17:18-kori változata
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace DAQMX { public class Form1 : Form { //Global valtozok private Task OutTask; //kimeneti Task: Dev1/ao0 private AnalogSingleChannelWriter writer; private Task InTask; //bemeneti Task: Dev1/ai0 private AnalogSingleChannelReader reader; //Inicializalas a meres megkezdese elott //peldaul gombnyomasra private void startButton_Click(object sender, System.EventArgs e) { //Kimenet OutTask = new Task(); //Task konstruktora //Kimeneti csatorna letrehozasa: OutTask.AOChannels.CreateVoltageChannel("Dev1/ao0", "", MinimumValue, MaximumValue, AOVoltageUnits.Volts); writer = new AnalogSingleChannelWriter(OutTask.Stream); //Bemenet InTask = new Task(); //Task konstruktora //Bemeneti csatorna letrehozasa: InTask.AIChannels.CreateVoltageChannel("Dev1/ai0", "", AITerminalConfiguration.Rse, MinimumValue, MaximumValue, AIVoltageUnits.Volts); reader = new AnalogSingleChannelReader(InTask.Stream); } //data nagysagu feszultseg kiadasa //es a bemenet beolvasasa az input valtozoba private void write_And_Read() { Double data=0.2; writer.WriteSingleSample(true,data); Double input=reader.ReadSingleSample(); } //eroforrasok felszabaditasa //Form bezarasakor hivjuk meg! private void destroy() { OutTask.Dispose(); InTask.Dispose(); } } }