Download Measurement Studio LabWindows/CVI User Manual
Transcript
Chapter 3 Project Window function3 function4 instrumentA(3.2) function5 function6 function7 To successfully structure the functions for your instrument, you must determine who will use the instrument driver and how they will use the instrument. Define functions that stand alone to perform a useful action. For example, it might at first seem logical to use the functions SetDMMRange and SetDMMFunction for setting the range and function of a multimeter. However, a more useful function might be ConfigureMeasurement, for setting up multiple parameters. Defining the Hierarchy of Functions It is important to design the function hierarchy for the instrument driver carefully. When you do, the user can identify the functions required by the desired action without the burden of choosing from a long list of unrelated functions. The concept of function classes is only apparent to the user from within the LabWindows/CVI development environment. The application program calls all functions within an instrument driver the same way, regardless of which function class they are in. Defining the Function Parameters To design the code for an instrument driver function, you must first establish its parameters. Function parameters provide input information to the function and output variables where the function can store its results. Output parameters often contain values that the function reads from the instrument and formats for the user. Data Types You must define a data type for each parameter in each instrument driver function. All data types the instrument driver uses must be intrinsic C data types or data types that you define in the .h file and list in the .fp file. You specify the data type of a parameter when you create its corresponding control on a function panel. This data type must also be consistent with the function prototypes in the instrument driver header file. LabWindows/CVI uses the data type information to implement the variable declaration and run-time checking capabilities when users operate function panels. When you declare a variable from a function panel, LabWindows/CVI presents options based on the data type you © National Instruments Corporation 3-41 LabWindows/CVI User Manual