Chapter 4 Getting Started with Measurement Studio
© National Instruments Corporation 4-13 Measurement Studio for MCC User Manual
private System.ComponentModel.Container components = null;
public Form1()
{
// Required for Windows Form Designer support
InitializeComponent();
daqBoard =new MccDaq.MccBoard(0);
3. Scroll down to move the cursor inside the click event handler of the
button control.
4. Add the following code to read a raw data point from a specified
channel on the Measurement Computing device, convert the data to
volts, and display the value on the meter.
[VB.NET]
'Set channel, range, raw value, and volt variables.
Dim Channel As Integer = 0
Dim Range As MccDaq.Range = MccDaq.Range.Bip10Volts
Dim RawValue As Integer = 0
Dim Volts As Double = 0.0F
' Perform analog input operation with Measurement Computing board,
' channel, and range, and return raw value.
DaqBoard.AIn(Channel, Range, RawValue)
' Convert raw value to engineering units.
DaqBoard.ToEngUnits(Range, RawValue, Volts)
' Display value on meter.
Meter1.Value = Volts
[C#]
// Set channel, range, raw value, and volt variables.
int channel = 0;
MccDaq.Range range =MccDaq.Range.Bip10Volts;
ushort rawValue =0;
float volts =0.0f;
// Perform analog input operation with Measurement Computing board,
/// channel, and range, and return raw value.
daqBoard.AIn(channel, range, out rawValue);
// Convert raw value to engineering units.
daqBoard.ToEngUnits(range, rawValue, out volts);
// Display value on meter.
meter1.Value =volts;
2003
5. Select File»Save Form1.cs to save your application.
6. Select Debug»Start Without Debugging to run the application.
7. After your program builds and runs, click Start. Notice each time you
click the Start button, the meter shows the acquired value.