MyDAQ
A Fizipedia wikiből
A lap korábbi változatát látod, amilyen Magyarkuti (vitalap | szerkesztései) 2017. szeptember 4., 10:40-kor történt szerkesztése után volt.
NI myDAQ mérőkártya kezelése C# programból. Példaprogram
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 NationalInstruments.DAQmx; namespace myDAQ { public partial class Form1 : Form { private Task InTask; private AnalogSingleChannelReader analogReader; private Task OutTask; private AnalogSingleChannelWriter analogWriter; public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { // Set up DAQ Card Input & Output InTask = new Task(); InTask.AIChannels.CreateVoltageChannel("myDAQ1/ai0", "", AITerminalConfiguration.Differential, -10, 10, AIVoltageUnits.Volts); analogReader = new AnalogSingleChannelReader(InTask.Stream); OutTask = new Task(); OutTask.AOChannels.CreateVoltageChannel("myDAQ1/ao0", "", -10, 10, AOVoltageUnits.Volts); analogWriter = new AnalogSingleChannelWriter(OutTask.Stream); } private void button1_Click(object sender, EventArgs e) { // Read from Input InputextBox.Text = Convert.ToString(analogReader.ReadSingleSample()); } private void button2_Click(object sender, EventArgs e) { // Write to Output analogWriter.WriteSingleSample(true, Convert.ToDouble(OutputtextBox.Text)); } private void Form1_FormClosing(object sender, FormClosingEventArgs e) { InTask.Dispose(); OutTask.Dispose(); } } }