Adept Scientific - English
The world's best software and hardware for research, science and engineering.
flag arrow
clearclear

 Adept Store | register Join My Adept | Flags  
Adept Scientific | Amor Way | Letchworth Garden City | Herts | SG6 1ZA | Tel: +44 (0)1462 480055  
UKdedksvnofi
Home
Products
Training
Events
 Buy Online
Downloads
Academic Discounts
Support
My Adept
International |  About Us |  Adept Scientific Blog |  Contact Us |  Press Room |  Jobs
Adept Scientific on Facebook Adept Scientific on Twitter Adept Scientific on YouBube Adept Scientific on LinkedIn
Knowledge Base  > Browse Categories  > Universal Library
Step-By-Step: Starting a VB.NET Data Acquisition solution using the Universal Library

Email This Article

To email this article enter and address below and click on the "Email" Article button.



Last Modified: 3rd Jan 2013
Category: Data Acquisition Hardware and Software > Universal Library
Platform: Windows
Version: All
Article Ref.: BF0A
»Return to previous search
»Print friendly version of this article.
4 out of 4 people have found this article useful.

Step-By-Step: Starting a VB.NET Data Acquisition solution using the Universal Library

Add a reference to MccDaq

    Go to your Solution Explorer window
    Expand the References folder (if it is not already expanded)
    Right mouse click on References folder, and select “Add Reference…”
    The Add Reference dialog box appears
    Scroll down to MccDaq, click on it, click on the Select button at the right
    Then click on the ‘OK’ button at the bottom of the dialog box
Add  a new instance of a board object
    Go to your Solution Explorer window
    click on Form1.vb then press F7 to activate the code window
    Locate the line “Inherits System.Windows.Forms.Form
    Just after that add  “Private DaqBoard As MccDaq.MccBoard” below it
Add the Initialization to Windows Form Designer
    Find the grayed out region of code labeled “Windows Form Designer generated code”
    Click on the + sign to the left to expand it
    Locate the following comment “'Add any initialization after the InitializeComponent() call
    Just after that add the following “InitUL()
Add Universal Library Initialization code
    Minimize the “Windows Form Designer generated code” region by clicking on the – sign next to #Region
    Place your cursor just below the end of that region
    Then paste in the following code:

#Region "Universal Library Initialization - Expand to change error handling, etc."

    Private Sub InitUL()

        Dim ULStat As MccDaq.ErrorInfo

        ' Initiate error handling
        '  activating error handling will trap errors like
        '  bad channel numbers and non-configured conditions.
        '  Parameters:
        '    MccDaq.ErrorReporting.PrintAll :all warnings and errors encountered will be printed
        '    MccDaq.ErrorHandling.StopAll   :if any error is encountered, the program will stop

        ULStat = MccDaq.MccService.ErrHandling(MccDaq.ErrorReporting.PrintAll, MccDaq.ErrorHandling.StopAll)

        If ULStat.Value <> MccDaq.ErrorInfo.ErrorCode.NoErrors Then
            Stop
        End If

    End Sub
    #End Region
Add the Form1_Load code
    Locate the line of code that starts with “Private Sub Form1_Load(ByVal sender…
    Paste in the following code in that procedure:
    Dim ULStat As MccDaq.ErrorInfo
   Dim BoardNum As Integer

   BoardNum = 0
    DaqBoard = New MccDaq.MccBoard(BoardNum)

That’s it.  From here you can add code and procedures to things such as:
Analog input:DaqBoard.AIn
Analog InScan:DaqBoard.AInScan
Digital In:DaqBoard.DIn
Digital Out:DaqBoard.DOut
Digital Bit In :DaqBoard.DBitIn
Digital Bit Out:DaqBoard.DBitOut
Analog Out:DaqBoard.AOut
Analog Out Scan:DaqBoardAOutScan
 

Please see the Universal Library function reference guide for more information.
 
 
Related Articles
adept

Top of the Page

Popular Links: ChemDraw | ChemOffice | Data Acquisition | Data Analysis | EndNote | Maple | MapleSim | Mathcad | MathType | Quality Analyst | Reference Manager | VisSim

EU ePrivacy Directive | Our Privacy and Terms and Conditions Statement
All Trademarks Recognised. Copyright © 2013, Adept Scientific plc.
Site designed and maintained by Lyndon Ash

Adept Scientific | Amor Way | Letchworth Garden City | Herts | SG6 1ZA | Tel: +44 (0)1462 480055