background image

Chapter 4

Getting Started with Measurement Studio

Measurement Studio for MCC User Manual

4-10

ni.com

functionality to a Windows Forms application by taking you through the 
following steps:

Setting up the project

—Using the Visual Studio New Project dialog 

box, you will create a new project that references the Measurement 
Studio Measurement Computing DAQ class library and Windows 
Forms controls.

Adding user interface controls to the project

—Using the Toolbox 

and the Properties window, you will add and configure user interface 
controls, including a button and meter.

Generating and displaying the data

—Using 

MccDaq.MccBoard.AIn

 and 

MccDaq.MccBoard.ToEngUnits

you will read a raw data point from a channel on an Measurement 
Computing device, convert the data point to volts, and show the value 
on a meter.

Before You Begin

The following components are required to complete this walkthrough:

Microsoft Visual Studio .NET 2003 or Microsoft Visual Studio 2005

Measurement Studio Measurement Computing Edition

Universal Library

Measurement Computing DAQ device

Note

For information about installing and configuring your Measurement Computing 

DAQ device, refer to the 

Quick Start Guide

 that ships with your device. You can also use 

the DEMO-BOARD simulated DAQ device to complete this walkthrough.

Setting up the project

1.

Select 

Start»All Programs»Microsoft Visual Studio .NET 2003»

Microsoft Visual Studio .NET 2003

.

2.

Select 

File»New»Project

. The New Project dialog box launches.

3.

In the Project Types pane, expand the 

Measurement Studio Projects

 

folder. Select 

Visual Basic Projects

 or 

Visual C# Projects

, depending 

on which language you want to create the project in.

4.

In the Templates pane, select 

Windows Application

. Specify 

MyMCCDAQProject

 for 

Name

 and specify a 

Location

 of your choice.

5.

Click 

OK

. The Measurement Studio Application Wizard launches.

6.

Select 

MCC Universal Library

 and 

Windows Forms User Interface 

Controls

. When you select these libraries, the Measurement Studio 

Summary of Contents for 374318A-01

Page 1: ...Measurement Studio TM Measurement Computing TM Edition User Manual Measurement Studio for MCC User Manual March 2006 374318A 01 ...

Page 2: ...orea 82 02 3451 3400 Lebanon 961 0 1 33 28 28 Malaysia 1800 887710 Mexico 01 800 010 0793 Netherlands 31 0 348 433 466 New Zealand 0800 553 322 Norway 47 0 66 90 76 60 Poland 48 22 3390150 Portugal 351 210 311 210 Russia 7 095 783 68 51 Singapore 1800 226 5886 Slovenia 386 3 425 4200 South Africa 27 0 11 805 8197 Spain 34 91 640 0085 Sweden 46 0 8 587 895 00 Switzerland 41 56 200 51 51 Taiwan 886 ...

Page 3: ...out the prior written consent of National Instruments Corporation National Instruments respects the intellectual property of others and we ask our users to do the same NI software is protected by copyright and other intellectual property laws Where NI software may be used to reproduce software or other materials belonging to others you may use NI software only to reproduce materials that you may r...

Page 4: ...MENT COMPUTING CORPORATION LIFE SUPPORT DEVICES SYSTEMS ARE DEVICES OR SYSTEMS WHICH A ARE INTENDED FOR SURGICAL IMPLANTATION INTO THE BODY OR B SUPPORT OR SUSTAIN LIFE AND WHOSE FAILURE TO PERFORM CAN BE REASONABLY EXPECTED TO RESULT IN INJURY MEASUREMENT COMPUTING CORPORATION PRODUCTS ARE NOT DESIGNED WITH THE COMPONENTS REQUIRED AND ARE NOT SUBJECT TO THE TESTING REQUIRED TO ENSURE A LEVEL OF R...

Page 5: ...t Studio Measurement Computing Edition NET Class Libraries Measurement Studio Support for Visual Studio NET 2003 Class Library Overview 2 1 Analysis 2 2 Measurements 2 2 Signal Generation 2 2 Windowing 2 3 Filters 2 3 Signal Processing 2 4 Linear Algebra 2 4 Array and Numeric Operations 2 5 Curve Fitting 2 5 Statistics 2 6 Common 2 6 MCC 488 2 2 7 Universal Library 2 7 MccDaq Scan Components 2 7 U...

Page 6: ... 2 Adding or Removing Measurement Studio Class Libraries 3 3 Chapter 4 Getting Started with Measurement Studio Measurement Studio Walkthroughs for Visual Studio NET 2003 4 1 Walkthrough Creating a Measurement Studio Application with Windows Forms Controls and Analysis in Visual Studio NET 2003 4 2 Walkthrough Creating a Measurement Studio Measurement Computing DAQ Application in Visual Studio NET ...

Page 7: ...Contents National Instruments Corporation vii Measurement Studio for MCC User Manual Appendix A Contacting Measurement Computing Corp Glossary Index ...

Page 8: ...ser Manual is organized into four chapters Chapter 1 Introduction to Measurement Studio Measurement Computing Edition is an overview of Measurement Studio Measurement Computing Edition This chapter includes installation and deployment requirements installation instructions and a list of Measurement Studio resources Chapter 2 Measurement Studio Measurement Computing Edition NET Class Libraries incl...

Page 9: ...isory information This icon denotes a note which alerts you to important information bold Bold text denotes items that you must select or click on in the software such as menu items and dialog box options Bold text also denotes class library member names or emphasis italic Italic text denotes parameters variables cross references or an introduction to a key concept Italic text also denotes text th...

Page 10: ...complete measurement and automation application that includes data acquisition analysis and presentation functionalities The Measurement Studio Measurement Computing Edition package includes two CDs one with Measurement Studio 8 0 1 and the other with Measurement Computing device drivers This manual documents the Measurement Studio Measurement Computing Edition CD which includes separate parallel ...

Page 11: ... Framework help topics to work you must install the Microsoft NET Framework SDK 1 1 for Visual Studio NET 2003 or Microsoft NET Framework SDK 2 0 for Visual Studio 2005 Deployment Requirements To deploy an application built with Measurement Studio NET class libraries the target computer must have a Windows 2000 XP operating system and the NET Framework version 1 1 for Visual Studio NET 2003 or the...

Page 12: ...nt and select I accept the License Agreement s Click Next 6 In the Installation Summary dialog box review the features you selected Click Next Note Step 8 starts the installation of Measurement Studio Be aware that when the installer indicates that it is removing backup files this is a normal operation The installer may take several minutes to complete this step 7 If prompted insert the Device Dri...

Page 13: ...ment Studio Help is fully integrated with the Visual Studio help You must have Visual Studio installed to view the online help and you must have the Microsoft NET Framework SDK 1 1 for Visual Studio NET 2003 or the Microsoft NET Framework SDK 2 0 for Visual Studio 2005 installed in order for links from Measurement Studio help topics to NET Framework help topics to work You can launch the NI Measur...

Page 14: ...ogram Files National Instruments MeasurementStudio DotNET Examples Measurement Computing Technical Support Refer to Appendix A Contacting Measurement Computing Corp for more information Measurement Studio Measurement Computing Edition Web site mccdaq com mstudio Contains Measurement Studio news support and downloads NI Developer Zone zone ni com Provides access to online example programs tutorials...

Page 15: ... Refer to the Using the Measurement Studio NET Class Libraries section of the NI Measurement Studio Help for detailed information about these libraries Refer to Chapter 4 Getting Started with Measurement Studio for step by step instructions on developing applications with these libraries Measurement Studio Support for Visual Studio NET 2003 Class Library Overview Analysis Common MCC 488 2 Universa...

Page 16: ... Elliptic Low High Bandpass and Bandstop filters Signal processing functions such as convolution deconvolution correlation decimation integration and differentiation FFT Inverse FFT Real FFT Fast Hartley Inverse Fast Hartley Fast Hilbert Inverse Fast Hilbert DST Inverse DST DCT and Inverse DCT transformations Linear algebra functions such as determinant check positive definiteness calculate dot pr...

Page 17: ...indowing Blackman Window Blackman Harris Window Blackman Nuttall Window Cosine Tapered window Dolph Chebyshev Window Exact Blackman Window Exponential Window Flat Top Window Force Window Gauss Window General Cosine Window Hamming Window Hanning Window Kaiser Window Scaled Time Domain Windows Symmetric Time Domain Windows Triangle Window Filters Bessel Butterworth Cascade Chebyshev Elliptic FIR FIR...

Page 18: ...tion Derivative x t Discrete Cosine Transform Discrete Sine Transform Fast Hartley Transform Fast Hilbert Transform Integral x t Inverse Fast Hartley Transform Inverse Fast Hilbert Transform Peak Detection Power Spectrum Pulse Parameters Real and Complex FFT Threshold Peak Detector Linear Algebra Complex Determinant Complex Dot Product Complex Matrix Condition Number Complex Matrix Norm Complex Ma...

Page 19: ...n Matrix Norm Matrix Rank Outer Product Pseudo Inverse Matrix Special Matrix Test Positive Definite Matrix Trace Transpose Array and Numeric Operations 1D and 2D Array Arithmetic 1D and 2D Linear Evaluation Evaluation 1D Polar to Rectangular 1D Rectangular to Polar Complex Number Arithmetic Find Polynomial Roots Scale 1D and 2D Curve Fitting Exponential Fit General Least Squares Linear Fit General...

Page 20: ...sition analysis and user interface portions of your application The Common class library includes the following features A ComplexDouble data type This data type represents a complex number of type Double that is composed of a real part and an imaginary part A DigitalWaveform data type This data type represents a set of digital states that are grouped by samples or signals An AnalogWaveform data t...

Page 21: ...ce and Board classes Universal Library The Measurement Studio Universal Library NET class library is in the MccDaq namespace This class library is included when you install the Universal Library driver Use the Universal Library class library to communicate with and control Measurement Computing data acquisition DAQ devices Use the Universal Library class library to perform the following types of t...

Page 22: ...ET class libraries Refer to Table 2 1 for the UI controls provided by Measurement Studio Table 2 1 Measurement Studio User Interface Controls User Interface Controls Visual Studio 2005 Visual Studio NET 2003 Windows Forms Web Forms Windows Forms Waveform graph Scatter graph Digital waveform graph Complex graph Legend Knob Gauge Meter Slide Thermometer Tank Numeric edit Switch LED Property editor A...

Page 23: ...r graph Digital waveform graph Complex graph Legend Knob Gauge Meter Slide Thermometer Tank Numeric edit Switch LED Property editor Use this class library to add measurement specific user interface controls to your application You can configure the controls programmatically at design time through the Properties window in the Windows Forms Designer or at run time with the property editor control Th...

Page 24: ... implicitly specify the values in the other dimension Use the scatter graph to display two dimensional linear or nonlinear data You explicitly specify each value in both dimensions Figure 2 1 Windows Forms Waveform Graph Control with Cursors and Windows Forms Scatter Graph Control with XY Point Annotation Both Graphs Have Corresponding Legends With the waveform graph and scatter graph controls and...

Page 25: ...rea Configure the axis modes to fixed exact autoscaling loose autoscaling strip chart or scope chart Use logarithmic axes with configurable bases Interactively change the range of an axis and invert the axis at run time by clicking on the axis end labels Cursor Operations Use cursors to identify key points in plots and the plot area Configure cursor snap modes to be fixed floating nearest point or...

Page 26: ...ment Studio Help Digital Waveform Graph Control Use the Measurement Studio digital waveform graph control as shown in Figure 2 2 to display DigitalWaveform data on a Windows Forms user interface Figure 2 2 Windows Forms Digital Graph Control With the digital waveform graph control and the classes that interface with the control you can perform the following operations Plot Operations Plot digital ...

Page 27: ...the range of an axis and invert the axis at run time by clicking on the axis end labels Additional Operations Display data in sample or time mode Pan with scroll bars Configure the style and mode of scroll bars Create custom scroll bars Pan and zoom interactively Configure major minor and custom divisions Copy the graph as a BMP GIF JPEG or PNG image to the clipboard or a file Tip For more informa...

Page 28: ... from a plot to an X value Y value or another plot Use the extensible plot and plot area drawing capabilities and events to customize the graph appearance Configure the plot to display arrows The arrows indicate the direction of the complex data Create custom point and line styles for plots Specify anti aliased plots for plot lines Axis Operations Configure a graph to include multiple axes or inde...

Page 29: ... the legend control with the plots of a graph any changes you make in the plots collection editor are automatically reflected in the legend Tip For more information about using the legend control refer to the Using the Measurement Studio Windows Forms Legend NET Control section in the NI Measurement Studio Help Numeric Controls Use the Measurement Studio numeric controls to display numerical infor...

Page 30: ... 2 4 to input and display numeric data on your user interface Figure 2 4 Windows Forms Knob Gauge and Meter Controls With the knob gauge and meter controls and the classes that interface with the controls you can perform the following operations Specify the start and sweep angle of the arc programmatically or from the Properties window Use automatic division spacing custom divisions and invert the...

Page 31: ...ers can edit numeric values Typically you use a numeric edit control to input or display double numerical data instead of using a Windows Forms TextBox or NumericUpDown control Figure 2 6 Windows Forms Numeric Edit Control With the numeric edit control and the classes that interface with the control you can perform the following operations Use up down buttons for easy incrementing and decrementing...

Page 32: ...rol as shown in Figure 2 8 to indicate a Boolean value on an application user interface Figure 2 8 Windows Forms LED Control in Square 3D Style With the switch and LED controls and the classes that interface with the controls you can perform the following operations Receive notification before or after the state of the control changes Configure how the control behaves when you click it with the mo...

Page 33: ...the property editor control and the classes that interface with the control you can perform the following operations Edit any NET type at run time including collections Edit expandable properties that represent nested properties of another object such as major divisions of an axis Create custom editors and type converters for properties Connect to a Windows Forms control so that if you change the ...

Page 34: ...unctionality described in the Measurement Studio Support for Visual Studio NET 2003 Class Library Overview section as well as the following additional user interface features and functionality Windows Forms array controls ASP NET Web Forms controls Windows Forms Array Controls You can create an array of Measurement Studio controls that behave as a single unit For example you can use these array co...

Page 35: ...e switch and LED array controls and the classes that interface with the controls you can perform the following operations Set values by passing an array of data Modify the number of controls displayed based on the length of the specified values Receive notification before or after the state of the control changes Configure how the control behaves when you click it with the mouse or press the space...

Page 36: ...orm range checking Set the minimum range value to negative infinity and the maximum range value to positive infinity Create custom formats or use built in numeric formats including generic engineering and simple double Connect to a numeric control so that if you change the value of one control it changes the value of the other control Set the coercion mode property to discrete or continuous values...

Page 37: ... Knob Gauge Meter Slide Thermometer Tank Numeric edit Switch LED AutoRefresh Use this class library to add measurement specific user interface controls to your Web application You can configure the controls programmatically at design time or through the Properties window in the Web Forms Designer The Measurement Studio ASP NET Web Forms controls are designed to provide a rich user interface experi...

Page 38: ... initial value and interval to implicitly specify the values in the other dimension Use the scatter graph to display two dimensional linear or nonlinear data You explicitly specify each value in both dimensions Figure 2 12 Web Forms Waveform Graph and Scatter Graph Controls Both Graphs Have Corresponding Legends With the waveform graph and scatter graph controls and the classes that interface with...

Page 39: ...trip chart or scope chart Use logarithmic axes with configurable bases Interactively change the range of an axis and invert the axis at run time by clicking on the axis end labels Cursor Operations Use cursors to identify key points in plots and the plot area Configure cursor snap modes to be floating nearest point or to plot Use cursor labels to display X and Y data coordinates that the cursor cr...

Page 40: ... and scatter graph controls refer to the Using the Measurement Studio Web Forms Scatter and Waveform Graph NET Controls section in the NI Measurement Studio Help Digital Waveform Graph Control Use the Measurement Studio digital waveform graph control as shown in Figure 2 13 to display DigitalWaveform data in an ASP NET Web application Figure 2 13 Web Forms Digital Graph Control ...

Page 41: ...lay waveforms and signals or display signals only Create custom waveform sample and signal state styles Configure waveform sample and signal state labels Create custom waveform sample and signal state labels Axis Operations Configure the axis modes to fixed exact autoscaling or loose autoscaling Interactively change the range of an axis and invert the axis at run time by clicking on the axis end l...

Page 42: ...lex graph control and the classes that interface with the control you can perform the following operations Plot Operations Plot and chart ComplexDouble data Configure a graph to contain multiple plots to show separate but related data on the same graph Draw lines or fills from a plot to an X value Y value or another plot Use the extensible plot and plot area drawing capabilities and events to cust...

Page 43: ...lp Legend Control Use the Measurement Studio legend control as shown in Figure 2 12 to display symbols and descriptions for a specific set of elements of another object such as the plots or cursors of a graph When you associate the legend control with another object any changes you make to that object are automatically reflected in the legend For example if you associate the legend control with th...

Page 44: ...t control so that if you change the value of one control it changes the value of the other control Customize the appearance of the control using 3D lab styles or classic 2D styles and change the color and length of ticks and labels Configure the format of value labels to engineering or date time Specify the image format of the control as BMP GIF JPEG or PNG Interactively change the range of an axi...

Page 45: ...io slide tank and thermometer controls as shown in Figure 2 16 to input and display numeric data on your interface Figure 2 16 Web Forms Slide Tank and Thermometer Controls With the slide tank and thermometer controls and the classes that interface with them you can perform the following operations Fill to the minimum or maximum value of the scale Position the scale horizontally with left right or...

Page 46: ...rform the following operations Perform range checking Set the minimum range value to negative infinity and the maximum range value to positive infinity Create custom formats or use built in numeric formats including generic engineering and simple double Connect to a Measurement Studio numeric control so that if you change the value of one control it changes the value of the other control Set the c...

Page 47: ...ou can perform the following operations Receive notification before or after the state of the control changes Specify the image format of the control as BMP GIF JPEG or PNG Tip For more information about using the switch and LED controls refer to the Using the Measurement Studio Web Forms Switch and LED NET Controls section in the NI Measurement Studio Help AutoRefresh Control Use the AutoRefresh ...

Page 48: ...nt Studio Class Libraries Refer to the Developing with Measurement Studio section in the NI Measurement Studio Help for more information about the functionality of these tools and features Measurement Studio Menu The Measurement Studio menu provides an easy way to access the following National Instruments resources and tools Add Remove Class Libraries Wizard Use the Measurement Studio Add Remove C...

Page 49: ...atents dialog box to view information about NI patents Licenses Use the Licenses dialog box to view information about NI licenses About NI Measurement Studio Use the NI Measurement Studio About box to view version information Tip For more information about the resources included in the Measurement Studio menu refer to the Measurement Studio Menu topic in the NI Measurement Studio Help Creating a M...

Page 50: ...nt Studio Help Adding or Removing Measurement Studio Class Libraries To add or remove Measurement Studio class libraries from a project use the Measurement Studio Add Remove Class Libraries wizard on the Measurement Studio menu This wizard provides an interface as shown in Figure 3 2 that you can use to select the Measurement Studio class libraries you want to add to or remove from a project When ...

Page 51: ... 3 2 Measurement Studio Add Remove Class Libraries Wizard for Visual Studio 2005 Tip For more information about using the Add Remove Class Libraries wizard to add or remove Measurement Studio class libraries refer to the Adding or Removing Measurement Studio Class Libraries section in the NI Measurement Studio Help ...

Page 52: ...rmation about the functionality of these tools and features Measurement Studio Walkthroughs for Visual Studio NET 2003 Use the following walkthroughs to help you develop applications with Measurement Studio in Visual Studio NET 2003 Walkthrough Creating a Measurement Studio Application with Windows Forms Controls and Analysis in Visual Studio NET 2003 Walkthrough Creating a Measurement Studio Meas...

Page 53: ...e user interface controls including a button waveform graph legend gauge and numeric edit Generating plotting and analyzing the data Using NationalInstruments Analysis SignalGeneration White NoiseSignal and NationalInstruments Analysis Math Statistics Mean you will generate data plot the generated data on a waveform graph and calculate the mean of the data Customizing the user interface Using the ...

Page 54: ...ioProject for Name and specify a Location of your choice 5 Click OK The Measurement Studio Application Wizard launches 6 Select Analysis and Windows Forms User Interface Controls Tip If you are working with an existing project you can access the Add Class Libraries dialog box by selecting Measurement Studio Add Remove Class Libraries Wizard 7 Click Finish to display Form1 in the Windows Forms Desi...

Page 55: ...ed in the System Windows Forms namespace 3 Select the Button control and drag and drop it onto the form 4 Right click the button and select Properties to display the Properties window You configure the properties of the control in the Properties window 5 The Text property is highlighted Type Start for the button text 6 Select the Measurement Studio NET Tools tab on the Toolbox 7 Select the Wavefor...

Page 56: ...d to resize the form to accommodate them Select the form and use the double sided arrow to resize it 11 Select the Legend control and drag and drop it onto the form 12 Select the NumericEdit control and drag and drop it onto the form 13 Select the Gauge control and drag and drop it onto the form 14 Right click the gauge and select Properties to display the Properties window 15 Type gauge for the n...

Page 57: ...display the mean on the gauge VB NET Declare and initialize an instance of WhiteNoiseSignal Dim whiteNoise As New WhiteNoiseSignal Store the generated data in a double array named data Dim data As Double whiteNoise Generate 1000 0 256 Use the PlotY method to plot the data Plot PlotY data Use the Mean method to calculate the mean of the data Dim mean As Double Statistics Mean data Display the mean ...

Page 58: ...lect Edit Items to display the LegendItem Collection Editor dialog box You use the LegendItem Collection Editor to add or remove legend items and to configure legend item properties 2 Select Plot in the Source drop down list and enter Signal in the Text box Click OK Now that you have specified a legend item for the plot changes you make to the plot will be reflected on the legend 3 Right click the...

Page 59: ...uge and select Properties to display the Properties Window 8 Set the Range property for the gauge with the drop down Range type editor Type 0 2 for the minimum value and type 0 2 for the maximum value 9 Right click the numeric edit and select Properties to display the Properties window 10 Select Gauge in the Source drop down list Setting the Source property to the gauge allows two way binding betw...

Page 60: ... Creating a Measurement Studio Measurement Computing DAQ Application in Visual Studio NET 2003 Measurement Studio includes class library and application templates that you can use to quickly create Measurement Computing DAQ applications with Visual Basic NET and Visual C Refer to the following section Walkthrough Creating a Measurement Studio Measurement Computing DAQ Application in Visual Studio ...

Page 61: ...ough Microsoft Visual Studio NET 2003 or Microsoft Visual Studio 2005 Measurement Studio Measurement Computing Edition Universal Library Measurement Computing DAQ device Note For information about installing and configuring your Measurement Computing DAQ device refer to the Quick Start Guide that ships with your device You can also use the DEMO BOARD simulated DAQ device to complete this walkthrou...

Page 62: ...ing user interface controls to the project 1 Select View Toolbox to display the Toolbox The Toolbox contains components and controls that you can add to your project 2 Select the Windows Forms tab The Windows Forms tab contains controls and components included in the System Windows Forms namespace 3 Select the Button control and drag and drop it onto the form 4 Right click the button and select Pr...

Page 63: ...he minimum value Leave the default of 10 for the maximum value The following screenshot shows Form1 with the user controls Generating and displaying the data 1 Double click on Form1 to display the Form1 code 2 Add the following code to declare a new Measurement Computing board object VB NET Declare a new Measurement Computing board object that uses board 0 Public DaqBoard As MccDaq MccBoard New Mc...

Page 64: ... 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 vol...

Page 65: ...face controls such as a waveform graph control and MccDaq scan components that perform analog input scans and analog output scans This walkthrough is designed to help you learn how to add analog scan and presentation functionality to a Windows Forms application by taking you through the following steps Setting up the project Using the Visual Studio New Project dialog box you will create a new proj...

Page 66: ...lete this walkthrough Microsoft Visual Studio NET 2003 or Microsoft Visual Studio 2005 Measurement Studio Measurement Computing Edition MccDaq Scan Components Measurement Computing DAQ device Note For information about installing and configuring your Measurement Computing DAQ device refer to the Quick Start Guide that ships with your device You can also use the DEMO BOARD simulated DAQ device to c...

Page 67: ...pecify MyMCCScanProject for Name and specify a Location of your choice 5 Click OK The Measurement Studio Application Wizard launches 6 Select Windows Forms User Interface Controls When you select this library the Measurement Studio Application Wizard automatically adds references to the appropriate class libraries Tip If you are working with an existing project you can access the Add Class Librari...

Page 68: ... the button and select Properties to display the Properties window You configure the properties of the control in the Properties window 5 The Text property is highlighted Type Start Scan for the button text 6 Select another button control and drag and drop it onto the form Type Stop Scan for the button text 7 Select the Measurement Studio NET Tools tab on the Toolbox 8 Select the Waveform graph co...

Page 69: ...ying the data 1 Double click the Start button to display the Form1 code 2 Add the following line of code to start an analog in scan VB NET This starts the scan AIScan1 Start C This starts the scan private void button1_Click object sender System EventArgs e aiScan1 Start 3 Double click on the Stop Scan button to open the code window 4 Add the following line of code that stops the analog in scan VB ...

Page 70: ...aveformGraph1 PlotY AiScan GetSingleChannelValues 0 1 0 AiScan1 ActualRate C private void aiScan1_DataReady object sender System EventArgs e waveformGraph1 PlotY AiScan GetSingleChannelValues 0 1 0 aiScan1 ActualRate 7 Add the following lines of code to the ErrorOccurred event of the aiScan1 component to display a message box if an error occurs VB NET Private Sub AiScan1_ErrorOccurred ByVal sender...

Page 71: ...tudio New Project dialog box you will create a new project that references the Measurement Studio MCC 488 2 class library and Windows Forms controls Adding user interface controls to the project Using the Toolbox and the Properties window you will add and configure user interface controls including a button and waveform graph Generating and displaying data Using MCC 488 2 Device and MCC 488 2 Addr...

Page 72: ...ding on which language you want to create the project in This walkthrough refers to Visual C but Visual Basic NET users can follow the same process 4 In the Templates pane select Windows Application Specify MyMCCGPIBProject for Name and select a Location of your choice 5 Click OK The Measurement Studio Application Wizard launches Tip If you are working with an existing project you can access the A...

Page 73: ...elect the Windows Forms tab The Windows Forms tab contains controls and components included in the System Windows Forms namespace 3 Select the Button control and drag and drop it onto the form 4 Right click the button and select Properties to display the Properties window You configure the properties of the control in the Properties window 5 The Text property is highlighted Type Run for the button...

Page 74: ...nd display the value on the graph VB NET Dim I As Integer Dim WrtString As String val Dim RdBufSize As Integer 100 Dim NlChar As Char n Dim NullChar As Char 0 Dim PrimaryAddress As New Address 2 Dim BoardNum As Integer 0 Open a gpib device Dim Device As New Device BoardNum PrimaryAddress Allocate a buffer to hold the data Dim Buffer As IntPtr System Runtime InteropServices Marshal AllocHGlobal RdB...

Page 75: ... IntPtr buffer System Runtime InteropServices Marshal AllocHGlobal rdBufSize read and plot 100 samples for int i 0 i 100 i write the string val to the Fluke45 device Write wrtString read the response from the Fluke45 string s device ReadString rdBufSize replace the newline character with a null and convert the string to a double double d Convert ToDouble s Replace nlChar nullChar plot the point wa...

Page 76: ...ating a Measurement Studio Application with Windows Forms Controls and Analysis in Visual Studio 2005 Walkthrough Creating a Measurement Studio Application with Web Forms Controls and Analysis in Visual Studio 2005 Note Refer to Walkthrough Creating a Measurement Studio MCCDaq Scan Components Application in Visual Studio NET 2003 Walkthrough Creating a Measurement Studio MCC 488 2 Application in V...

Page 77: ...trols to the project Using the Toolbox smart tags and the Properties window you will add and configure a button waveform graph legend gauge and numeric edit user interface control Generating plotting and analyzing the data Using NationalInstruments Analysis SignalGeneration White NoiseSignal and NationalInstruments Analysis Math Statistics Mean you will generate data plot the generated data on a w...

Page 78: ...surement Studio under Visual C or Visual Basic depending on which language you want to create the project in 4 In the Templates pane select NI Windows Application Specify MyMeasurementStudioProject for Name and specify a Location of your choice 5 Click OK The Measurement Studio Application Wizard launches 6 Select Analysis and Windows Forms User Interface Controls ...

Page 79: ...udio for MCC User Manual 4 28 ni com Tip IIf you are working with an existing project you can access the Add Remove Class Libraries dialog box by selecting Measurement Studio View NET Class Library Wizard 7 Click Finish to display Form1 in the Windows Forms Designer ...

Page 80: ...ns components and controls that you can add to your project 2 Expand the All Windows Forms group The All Windows Forms group contains controls and components included in the System Windows Forms namespace 3 Select the Button control and drag and drop it onto the form 4 Right click the button and select Properties to display the Properties window You configure the properties of the control in the P...

Page 81: ... 30 ni com 7 Select the WaveformGraph control and drag and drop it onto the form 8 Right click the waveform graph and select Edit Plots to display the WaveformPlot Collection Editor dialog box You use the WaveformPlot Collection Editor to add or remove plots and to configure plot properties ...

Page 82: ... Before you add the Measurement Studio legend numeric edit and gauge controls you need to resize the form to accommodate them Select the form and use the double sided arrow to resize it 11 Select the Legend control and drag and drop it onto the form 12 Select the NumericEdit control and drag and drop it onto the form 13 Select the Gauge control and drag and drop it onto the form 14 Click the gauge...

Page 83: ...Chapter 4 Getting Started with Measurement Studio Measurement Studio for MCC User Manual 4 32 ni com The following screenshot shows Form1 with the user controls ...

Page 84: ...ew WhiteNoiseSignal Store the generated data in a double array named data Dim data As Double whiteNoise Generate 1000 0 256 Use the PlotY method to plot the data Plot PlotY data Use the Mean method to calculate the mean of the data Dim mean As Double Statistics Mean data Display the mean on the gauge gauge Value mean C Declare and initialize an instance of WhiteNoiseSignal WhiteNoiseSignal whiteNo...

Page 85: ...rop down list and enter Signal in the Text box Click OK Now that you have specified a legend item for the plot changes you make to the plot are reflected on the legend 3 Right click the graph and select Auto Format to display the Auto Format dialog box The Auto Format dialog box provides a set of pre configured control styles When you select a style and click OK the Auto Format feature configures ...

Page 86: ...ck the numeric edit smart tag to display the Numeric Edit Tasks 11 Select Gauge in the Source drop down list Setting the Source property to the gauge allows two way binding between the controls 12 Deselect ArrowKeys Buttons and Text for the InteractionMode property of the numeric edit control Deselecting these interaction modes makes the numeric edit an indicator The numeric edit control only disp...

Page 87: ...ignal generation and mathematical functions This walkthrough is designed to help you learn how to add analysis and presentation functionality to a Web Forms application by taking you through the following steps Setting up the project Using the Measurement Studio Application Wizard you will create a new project that references the Measurement Studio Analysis class library and Web Forms controls Add...

Page 88: ...ng components are required to complete this walkthrough Microsoft Visual Studio 2005 Measurement Studio Measurement Computing Edition Setting up the project 1 Select Start All Programs Microsoft Visual Studio 2005 Microsoft Visual Studio 2005 2 Select File New Web Site The New Web Site dialog box launches 3 In the Templates pane select Measurement Studio ASP NET Web Site Select File System and spe...

Page 89: ...ASP NET Web Site Wizard launches 6 Select Analysis and Web Forms User Interface Controls Tip If you are working with an existing project you can access the Measurement Studio ASP NET Web Site Wizard dialog box by selecting Measurement Studio View NET Class Library Wizard 7 Click Finish to display Default aspx in the Web Forms Designer ...

Page 90: ...lbox The toolbox contains components and controls that you can add to your project 4 Expand the HTML group on the Toolbox Select the Table control in the toolbox and drag and drop it onto the form You use the table cells to arrange the user interface controls on your Web page as shown in the previous screenshot 5 Expand the Standard group on the Toolbox The Standard group contains ASP NET server c...

Page 91: ...ab on the Toolbox 10 Select the WaveformGraph control and drag and drop it into a table cell 11 On the waveform graph smart tag type graph for the name of the waveform graph ID Tip You access the smart tag by right clicking the arrow button in the upper right corner of the control 12 Select the Legend control and drag and drop it into a table cell 13 Select the NumericEdit control and drag and dro...

Page 92: ...o for MCC User Manual 14 On the numeric edit smart tag type numericedit for the Name of the numeric edit ID 15 Select the Gauge control and drag and drop it into a table cell 16 On the gauge smart tag type gauge for the Name of the gauge ID The following screenshot shows the Web page with the user controls ...

Page 93: ...ode to generate random data plot the data calculate the mean of the data and display the mean on the gauge VB NET Declare and initialize an instance of WhiteNoiseSignal Dim whiteNoise As New WhiteNoiseSignal Store the generated data in a double array named data Dim data As Double whiteNoise Generate 1000 0 256 Use the PlotY method to plot the data Plot PlotY data Use the Mean method to calculate t...

Page 94: ...erate 1000 0 256 Use the PlotY method to plot the data Plot PlotY data Use the Mean method to calculate the mean of the data double mean Statistics Mean data Display the mean on the gauge gauge Value mean Customizing your user interface 1 Select the Default aspx tab to return to the Web Forms Designer 2 Right click the legend and select Edit Items to display the LegendItem Collection Editor dialog...

Page 95: ...legend 4 Right click the graph and select Auto Format to display the Auto Format dialog box The Auto Format dialog box provides a set of pre configured control styles When you select a style and click OK the Auto Format feature configures the appropriate control properties to reflect the style you chose 5 Select Points Only Click OK Notice that the legend changed automatically to match the formatt...

Page 96: ...Gauge in the Source drop down list Setting the Source property to the gauge allows two way binding between the controls 12 Deselect ArrowKeys Buttons and Text for the InteractionMode property of the numeric edit control Deselecting these interaction modes makes the numeric edit an indicator 13 Select the Format Mode property and in the Numeric Edit Format Mode Editor dialog box change the Precisio...

Page 97: ...Chapter 4 Getting Started with Measurement Studio Measurement Studio for MCC User Manual 4 46 ni com The following screenshot shows the Web page with customization ...

Page 98: ...Computing Corp through the following ways Mail Measurement Computing Corp 16 Commerce Blvd Middleboro MA 02346 Telephone 508 946 5100 FAX 508 946 9500 Technical Support techsupport MeasurementComputing com Sales sales measurementcomputing com Other correspondence info measurementcomputing com Visit our Web site at www measurementcomputing com ...

Page 99: ...of a NET Framework application All managed types and resources are contained within an assembly and are marked either as accessible only within the assembly or as accessible from code in other assemblies asynchronous Function that begins an operation and returns control to the program prior to the completion or termination of the operation B button A control used to input or display Boolean inform...

Page 100: ...nd generating complex square waves cursor Flashing rectangle that shows where you may enter text on the screen If you have a mouse installed there is a rectangular mouse cursor or pointer cursor label Text object used to display X and Y coordinates that a cursor crosshair points to on a graph D DAQ Data acquisition Process of acquiring data typically from A D or digital input plug in boards DAQ de...

Page 101: ...s a data acquisition board or GPIB interface board See also instrument driver E Ethernet Standard connection type for networks where computers are connected by coaxial or twisted pair cable event Object generated response to some action or change in state such as a mouse click or a completed acquisition The event calls an event procedure that processes the event executable Program file with a exe ...

Page 102: ...ad Web pages from an HTTP server to a Web browser I IEEE 488 Shortened notation for ANSI IEEE Standards 488 1978 488 1 1987 and 488 2 1987 See also GPIB indicator A control in read only mode installer Software program that copies program system and other necessary files to computers instrument driver Library of functions to control and use one specific physical instrument Also a set of functions t...

Page 103: ... Megabytes of memory MCC 488 2 Driver level software to control and communicate with Measurement Computing GPIB hardware Measurement Studio National Instruments software that includes tools to build measurement applications in Visual Basic NET and Visual C meter A control used to input or display numerical data method Function that performs a specific action on or with an object The operation of t...

Page 104: ...hods For example a value property is the color property of a plot object while an object property is a specific Y axis property on a graph object The Y axis itself is another object with properties such as minimum and maximum values property editor A control used to configure properties for Windows Forms controls at run time property pages Window or dialog box that displays current configuration i...

Page 105: ...d tasks switch A control used to receive and control Boolean input in an application user interface synchronous Property or operation that begins and returns control to the program only when the operation is complete T tank A control used to input or display numerical data TCP IP Transmission Control Protocol Internet Protocol A standard format for transferring data in packets from one computer to...

Page 106: ...ension for Instrumentation Instrumentation architecture and bus based on the VME standard Used in high end test applications W waveform graph A control that displays two dimensional data on a Windows Forms or Web Forms user interface displays data that is uniformly spaced in one dimension ...

Page 107: ... Measurement Studio Application with Windows Forms Controls and Analysis walkthrough 4 2 Measurement Studio Application with Windows Forms Controls and Analysis in Visual Studio 2005 walkthrough 4 29 Measurement Studio MCC 488 2 Application walkthrough 4 23 Measurement Studio MCC DAQ Application walkthrough 4 10 Measurement Studio MCC Scan Components Application walkthrough 4 16 new Measurement St...

Page 108: ...mon 2 6 MCC 488 2 2 7 overview 2 1 2 20 User Interface 2 8 2 23 deployment requirements 1 2 NET class libraries Scan Components 2 7 Universal Library 2 7 NI Instrument Driver Network 3 2 numeric controls 2 15 2 29 numeric edit NET control 2 17 2 32 O overview Measurement Studio 1 1 NET class libraries 2 1 2 20 P project templates 3 2 property editor control 2 19 R requirements distribution 1 2 ins...

Page 109: ... Studio Application with Webs Forms Controls and Analysis in Visual Studio 2005 4 39 Creating a Measurement Studio Application with Windows Forms Controls and Analysis 4 2 Creating a Measurement Studio Application with Windows Forms Controls and Analysis in Visual Studio 2005 4 29 Creating a Measurement Studio MCC 488 2 Application 4 23 Creating a Measurement Studio MCC DAQ Application 4 10 Creati...

Reviews: