Tektronix Visual Test Extensions Users Guide

Visual Test Extensions
USER’S GUIDE
TM
Visual Test Extensions
Revision C - June 1996
Part Number: 81580
New Contact Information
Keithley Instruments, Inc.
28775 Aurora Road
Cleveland, OH 44139
Technical Support: 1-888-KEITHLEY
Monday – Friday 8:00 a.m. to 5:00 p.m (EST)
Fax: (440) 248-6168
Visit our website at http://www.keithley.com
The information contained in this manual is believed to be accurate and reliable. However, Keithley Instruments, Inc., assumes no responsibility for its use or for any infringements of patents or other rights of third parties that may result from its use. No license is granted by implication or otherwise under any patent rights of Keithley Instruments, Inc.
KEITHLEY INSTRUMENTS, INC., SHALL NO T BE LIABLE FOR ANY SPECIAL, INCIDENT AL, OR CONSEQUENTIAL DAMAGES RELATED TO THE USE OF THIS PRODUCT. THIS PRODUCT IS NOT DESIGNED WITH COMPONENTS OF A LEVEL OF RELIABILITY SUITABLE FOR USE IN LIFE SUPPORT OR CRITICAL APPLICATIONS.
Refer to your Keithley Instruments license agreement for specific warranty and liability information.
MetraByte, Visual Test Extensions, and VTX are trademarks of Keithley Instruments, Inc. All other brand and product names are trademarks or registered trademarks of their respective companies.
© Copyright Keithley Instruments, Inc., 1995, 1996.
All rights reserved. Reproduction or adaptation of any part of this documentation beyond that permitted by Section 117 of the 1976 United States Copyright Act without permission of the Copyright owner is unlawful.
Keithley MetraByte Division
Keithley Instruments, Inc.
440 Myles Standish Blvd. Taunton, MA 02780
FAX: (508) 880-0179
Telephone: (508) 880-3000
Introducing VTX
Visual Test Extensions that enable you to create high-performance data acquisition, analysis, and graphing applications within the Microsoft programming environment. VTX software tools include an integrated set of custom controls. By using VTX software with Visual Basic, you can
Build high-performance Windows measurement systems quickly and
easily .
Integrate data acquisition, counter/timer, analysis, data display, logic, and graphing functions in the same application.
Incorporate any third-party products designed for the Visual Basic
environment in your application.
Create simple applications using graphical programming or complex applications using graphical and code-based programming.
Overview of this Guide
The Visual Test Extensions User’s Guide introduces the VTX system of custom controls. The online help that accompanies the VTX software provides detailed information about the VTX system.
(VTX
) is a powerful system of software tools
®
Visual Basic
for Windo ws
Before using the VTX system, it is strongly recommended that you have an understanding of
Microsoft Windows, version 3.1 or higher (including Windows 95) Visual Basic for W indo ws, v ersion 3.0 or the 16-bit versions of Visual
Basic, version 4.0 (Professional and Enterprise Editions). (Note that the Standard Edition of Visual Basic 4.0 does not support 16-bit controls.)
Data acquisition principles Data acquisition hardware for which you are writing applications
Overview of this Guide ix
This guide and the online help for the VTX system are written with the assumption that you understand the fundamental programming techniques of Visual Basic, especially the concept of event-driven programming. In addition, it is assumed that you know the capabilities of your data acquisition boards and the options available. Refer to the documentation for Visual Basic, Windows, and your data acquisition boards for basic information about these products.
This guide contains the following chapters:
Chapter 1, Installing VTX Software , lists the system requirements
and explains how to install the VTX software.
Chapter 2, Creating Your First VTX Application, provides a
tutorial for quickly creating a simple application using the VTX DAS and T e xt controls. This chapter also provides information on using the example programs that accompany your VTX software .
Conventions
Chapter 3, Understanding the VTX System , explains the
fundamental concepts of the VTX system.
Chapter 4, Building Complex A pplications, describes in detail how
to create a complex data acquisition application with V isual Basic and the VTX system.
The VTX system provides two controls that communicate directly with the Keithley MetraByte boards that the controls support, the DAS control and the Counter/Timer (CTM) control. Throughout this user’s guide, references to DAS boards or DAS hardware include all Keithley MetraByte data acquisition hardware that the VTX DAS control currently supports. Similarly, references to CTM boards include all Keithley MetraByte counter/timer boards that the VTX CTM control currently supports. Contact your Keithley MetraByte sales representative for a list of currently supported boards.
References to Windows 3.x in this guide include Windows 3.1 and Windows 3.11 for Workgroups only.
x Introducing VTX
F1
}
The illustrations in this guide were created using Visual Basic 3.0 running under Windows 3.1. As appropriate, the accompanying text describes items that differ in Visual Basic 4.0 and in Windows 95.
The following table shows the typographic conventions used in this guide.
Example of Convention Description
This bold font indicates a key name.
CTRL+C
DASCtrl1.ClockSrc
numericexpression
[form.]
{
|
0
1
SampleIndex Initial capital letters indicate the name of a language
When key names are connected by a plus (+) sign, you press the keys simultaneously. For example,
CTRL+C means hold down the CONTROL key
while pressing the C key. The Courier font indicates program code or system
messages. In syntax, italic letters indicate placeholders for values
you supply. In syntax, square brackets around an item indicate that
the item is optional. In syntax, curly brackets and a vertical line indicate a
choice between two or more items. Unless the set of items also falls within square brackets, you must choose one of the items.
element, such as a property.
Conventions xi
Using Online Help
The online help system for the VTX software includes
Overview information on the VTX system and on each VTX control Generalized procedures for setting up processes for each VTX control
Brief descriptions of the VTX example programs
Programming tips Definitions of VTX properties, functions, and events
Valid ranges or values for properties
Code examples that you can cut and paste into your application
Error information
The VTX help system has a general overview help file from which you can access information on all VTX controls and the e xample programs. In addition, the help system contains a separate help file for each VTX control. All of these help files are installed by default.
To provide specific information for the different Keithley MetraByte boards supported by the VTX software, the VTX help system also contains board-specific help files. When installing the board-specific software, the VTX installation program copies the associated board-specific help file to your hard drive.
The VTX installation program copies VTX help files and their supporting executable files into the same directory. To be able to access the help files from one another, you must keep all of these files in the same directory.
xii Introducing VTX
Accessing VTX Online Help
You can access VTX online help from within Visual Basic and from the Keithley VTX program group created at installation. The methods to access help from Visual Basic are the same under Visual Basic 3.0 and
4.0. In addition, accessing help from either version of Visual Basic is essentially the same under Windows 3.x and Windows 95. The following sections describe ways to access VTX help from Visual Basic, the Keithley VTX program group in Windows 3.x, and the Windows 95 desktop.
From Visual Basic
Use one of the following methods to access VTX online help from within Visual Basic:
From the Visual Basic Toolbox, double-click the icon for a VTX
control to place the control on a Visual Basic form. With the control still selected on the form, press F1 . Under Windows 3.x, the main menu (contents) for the control help is displayed. Under W indo ws 95, the Help Topics dialog box appears with the Contents tab displayed.
Display the Properties window or More Properties window of a VTX control. Highlight a property and then press topic for that property.
Note that the Properties window for each VTX control contains properties that are standard Visual Basic properties, such as Caption and Name. When you press
F1
on these properties, the standard
Visual Basic online help appears.
From the Keithley VTX Program Group in Windows 3.x
The Keithley VTX program group is created when you install VTX software. It includes two help icons (yellow question marks), one captioned VTX Help, and the other captioned Examples. The VTX Help icon lets you access the VTX overview help file. From the main menu (Windows 3.x) of the overview help file, you can access the entire VTX help system, including the Examples help file. The Examples icon provides direct access to the descriptions of the example programs provided with the VTX software.
F1
to display the help
Using Online Help xiii
To access general information about the VTX system or specific information about the controls, follow these steps:
1. Double-click the VTX Help icon to display the main menu (Windows
3.x) for the VTX overview help file.
2. From the main menu, double-click the icon or text for the topic you are interested in. Alternatively, click the Search button in the button bar to use the Search keyword list to locate a topic.
From the Windows 95 Desktop
One way to access VTX help from the Windows 95 desktop is to begin with the task bar, as follows:
1. From the Windows 95 task bar, use the left mouse button to click the Start button.
2. From the Start menu, move the mouse pointer over the Programs item.
3. From the Programs menu, move the mouse pointer over the Keithley VTX item.
4. From the Keithley VTX menu, click VTX Help. The Contents tab for the VTX overview help file appears.
If you are accustomed to the W indows 3.x Program Manager and program groups, you may want to use the Windows 95 equivalent, as follows:
1. From the W indows 95 task bar , use the right mouse button to click the Start button.
2. When the popup menu appears, click Open.
3. From the Start window, double-click the Programs icon to display the Programs window.
4. Double-click the Keithley VTX icon.
5. From the Keithley VTX program window, double-click the yellow question mark icon for the help file you want to read (VTX Help or Examples).
To access VTX help from the My Computer folder, follow these steps:
1. From the W indo ws 95 desktop, double-click the My Computer folder to open it.
xiv Introducing VTX
2. From the My Computer window , double-click the icon of the dri v e on which you installed VTX softw are. For example, if you installed VTX software on the C drive, click the C drive icon.
3. From the drive window, double-click the Keithley VTX folder to display the program group window. (If you installed VTX software in the default directory, the folder appears at the root level of the drive. Howev er , if you installed the VTX software elsewhere, you may need to open another folder.)
4. T o access the VTX help from the K eithley VTX windo w, double-click the yellow question mark icon for the help file you want to read (VTX Help or Examples).
Once within the VTX help system, you can access general information about the VTX system or specific information about the controls by following these steps:
1. If necessary, click the Contents button in the button bar near the top of the help window to display the Contents tab of the Help Topics dialog box.
2. From the Contents tab, double-click a book icon to display the topics available.
3. As needed, double-click other book icons until you see the topic you want to read (a page icon).
4. Double-click the page icon to display the topic you want to read.
Alternatively, you can click the Index button in button bar near the top of the help window and use the Index tab of the Help Topics dialog box to search for topics associated with a particular keyword. Note that each tab of the Help Topics dialog box provides a system-wide view of VTX help.
Accessing Board-Specific Information
Windows help provides a button bar near the top of the window that contains standard buttons such as Contents. To let you access information specific to the DAS-Demo Device and to supported Keithley MetraByte board families (for example, the D AS-1800 Series family), the VTX DAS control help file provides two additional buttons:
Select Board — Displays a dialog box in which you select the
DAS-Demo Device or the Keithley MetraByte board family for
Using Online Help xv
which you want additional information. After selecting the family, you must click the Board Specifics button to display the parallel topic in the board-specific help file.
Board Specifics — Displays a corresponding topic for the selected
board family. For example, from the DAS control topic OpMode Property, you can display the same topic for the DAS-1800 Series family, which shows which operation modes are available for all boards in the DAS-1800 Series family.
To return to the DAS control help topics, the board-specific help files provide two buttons:
Back to DAS — Returns to the topic from which you jumped in the
VTX DAS control help. For example, from the OpMode Property topic in the DAS control help, you accessed the same topic for the DAS-1600 Series family. From that topic, you browsed forward to the topic, Samples Property. To return to the OpMode Property topic in the DAS control help, click the Back to DAS button.
Up to DAS — Displays a corresponding topic in the DAS control help. This button performs the same function as the Board Specifics button, in reverse. F or e xample, you ha v e been browsing in the topics for the DAS-Demo Device and are reading the Samples Property topic. To view the Samples Property topic in the DAS control help, click the Up to DAS button.
The online help system for VTX controls is always available at design time. By default, the help system is also available from the VTX dialog boxes that present warnings and errors at run time. You can use the VTX Options window of the VTX Configuration utility to disable the dialog boxes and/or to disable access to the help system. See “Enabling and Disabling VTX Options” on page 4-41 for details.
If your application will be used by others, you may want to add your own help system and a Help button using the Windows applications programming interface (API) function WINHELP. See your Visual Basic documentation for information on using the WINHELP function.
xvi Introducing VTX
Getting Additional Help
For additional assistance, you can call the Keithley MetraByte Applications Engineering department at
(508) 880-3000 Monday - Friday, 8:00
An applications engineer will help you diagnose and resolve your problem over the telephone.
Please make sure that you have the follo wing information av ailable before you call:
A.M.
- 6:00
, Eastern Time
P.M.
Visual Test Extensions
Version ____________________ Module(s) Base Analysis Graph Invoice/Order # ____________________ VTX Driver Disk Version ____________________
Visual Basic Version 3.0 4.0 (16-bit) for Windows
Edition Standard Professional
Enterprise
Operating system DOS Version ____________________
Windows Version 3.1 3.11 95
Computer
Manufacturer ____________________ CPU type 386 486 Pentium___ Clock Speed (MHz) ____________________ Math Coprocessor Yes No Amount of RAM ____________________ Video System VGA SVGA Other: ____________________ BIOS type ____________________
Boards
Series/Name ____________________ Model ____________________ Serial # ____________________ Base Address Setting ____________________ DMA Level Setting ____________________ Interrupt Level Setting ____________________
Getting Additional Help xvii
Input Configuration Single-ended Differential Input Range Type Unipolar Bipolar
Series/Name ____________________ Model ____________________ Serial # ____________________ Base Address Setting ____________________ DMA Level Setting ____________________ Interrupt Level Setting ____________________ Input Configuration Single-ended Differential Input Range Type Unipolar Bipolar
Series/Name ____________________ Model ____________________ Serial # ____________________ Base Address Setting ____________________ DMA Level Setting ____________________ Interrupt Level Setting ____________________ Input Configuration Single-ended Differential Input Range Type Unipolar Bipolar
Expansion accessories
Series/Name ____________________ Model ____________________ Serial # ____________________ Base Address Setting ____________________ DMA Level Setting ____________________ Interrupt Level Setting ____________________ Input Configuration Single-ended Differential Input Range Type Unipolar Bipolar
Type ____________________ Type ____________________ Type ____________________ Type ____________________ Type ____________________ Type ____________________ Type ____________________
xviii Introducing VTX
Table of Contents
Introducing VTX
Overview of this Guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .ix
Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .xi
Using Online Help . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xii
Accessing VTX Online Help. . . . . . . . . . . . . . . . . . . . . . . . . .xiii
From Visual Basic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .xiii
From the Keithley VTX Program Group in
Windows 3.x. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .xiii
From the Windows 95 Desktop . . . . . . . . . . . . . . . . . . . . . xiv
Accessing Board-Specific Information . . . . . . . . . . . . . . . . . . xv
Getting Additional Help. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvii
1
Installing VTX Software
Preparing to Install VTX Software. . . . . . . . . . . . . . . . . . . . . . . .1-1
Checking System Requirements . . . . . . . . . . . . . . . . . . . . . . .1-2
Checking the Package . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-3
Backing Up the Master Disks . . . . . . . . . . . . . . . . . . . . . . . . .1-4
Installing VTX Software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-4
Preparing to Use Boards with VTX Software . . . . . . . . . . . . . . .1-6
Registering and Configuring Boards. . . . . . . . . . . . . . . . . . . .1-7
Changing the Configuration of a Registered Board. . . . .1-10
Deleting a Registered Board. . . . . . . . . . . . . . . . . . . . . . .1-10
Changing an Alias . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-11
Specifying Engineering Units . . . . . . . . . . . . . . . . . . . . .1-12
Reserving Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-15
Installing Hardware. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-17
Loading VTX Controls. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-18
Adding a Control to an Application Manually . . . . . . . . . . .1-19
Visual Basic 3.0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-20
Visual Basic 4.0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-20
Loading VTX Controls Automatically . . . . . . . . . . . . . . . . .1-21
Visual Basic 3.0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-22
Visual Basic 4.0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-23
Creating Your First VTX Application . . . . . . . . . . . . . . . . . . . .1-24
iii
iv
Creating Your First VTX Application
2
Assumptions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-1
Overview of the Application . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-2
Design the User Interface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-3
Set the Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-9
Set the Form Properties. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-9
Set the DAS Control Properties. . . . . . . . . . . . . . . . . . . . . . .2-11
Set the Text Control Properties . . . . . . . . . . . . . . . . . . . . . . .2-14
Set the Command Button Properties. . . . . . . . . . . . . . . . . . .2-16
Connect the VTX Controls. . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-22
Write the Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-24
Write Code for the Start Button . . . . . . . . . . . . . . . . . . . . . .2-25
Write Code for the Stop Button . . . . . . . . . . . . . . . . . . . . . .2-27
Write Code for the Exit Button. . . . . . . . . . . . . . . . . . . . . . .2-28
Run the Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-30
What’s Next . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-31
3
Understanding the VTX System
The VTX Environment. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-1
Processes and Process Sources . . . . . . . . . . . . . . . . . . . . . . . . . .3-3
Overview of VTX Tools. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-5
Properties of VTX Controls. . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-8
Control Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-8
Operation-Specific Properties . . . . . . . . . . . . . . . . . . . . . . . .3-11
Source and Destination Controls . . . . . . . . . . . . . . . . . . . . . . . .3-14
Program Control in the VTX Environment. . . . . . . . . . . . . .3-16
Data in the VTX Environment . . . . . . . . . . . . . . . . . . . . . . .3-16
Defining the Structure of Data in the
VTX Environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-17
Moving Data between VTX Controls. . . . . . . . . . . . . . . .3-18
Moving Data to and from the VTX Environment . . . . . .3-19
Connections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-20
Connection Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-21
Connection Points . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-22
Multiple Connections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-25
Interform Connections . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-26
Concept Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-30
v
Building Complex Applications
4
Planning the Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-2
Designing the User Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-3
Setting Properties. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-5
Connecting VTX Controls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-6
Displaying the Order of Multiple Connections. . . . . . . . . . . .4-7
Changing the Order of Multiple Connections. . . . . . . . . . . . .4-8
Drawing Interform Connections . . . . . . . . . . . . . . . . . . . . . . .4-9
Deleting Connections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-11
Writing Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-12
VTX Events. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-13
ProcessDone Event. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-14
ProcessError Event. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-15
ProcessCTMDone Event . . . . . . . . . . . . . . . . . . . . . . . . .4-15
NDataDone Event. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-16
Text Control Events . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-16
VTX Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-17
Integration of the User Interface and Supporting Tasks . . . .4-19
Accepting User Input . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-21
Starting/Stopping Operations. . . . . . . . . . . . . . . . . . . . . .4-24
Click Event Procedure - Starting VTX Controls. . . . .4-25
Click Event Procedure - Stopping VTX Controls . . . .4-25
Displaying Status . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-27
Displaying Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-27
Displaying a Scalar . . . . . . . . . . . . . . . . . . . . . . . . . . .4-28
Displaying Data in a VTX Grid. . . . . . . . . . . . . . . . . .4-29
Graphing Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-33
Displaying Data in a List Box. . . . . . . . . . . . . . . . . . .4-34
Displaying Data in a Windows Spreadsheet . . . . . . . .4-35
Error Handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-36
Execution Errors. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-37
Process Warnings and Errors . . . . . . . . . . . . . . . . . . . . . .4-38
Testing, Debugging, and Preparing for Distribution . . . . . . . . .4-39
Using Visual Basic Debugging Tools with
VTX Controls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-40
Enabling and Disabling VTX Options . . . . . . . . . . . . . . . . .4-41
Selecting Files for Distribution. . . . . . . . . . . . . . . . . . . . . . .4-42
Board-Specific Files. . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-43
INI Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-44
VDMAD.386 File (Windows 3.x) . . . . . . . . . . . . . . . . . .4-45
VTX Software Already Installed. . . . . . . . . . . . . . . . .4-45
VTX Software Not Installed . . . . . . . . . . . . . . . . . . . .4-46
VDMAD.VXD File (Windows 95) . . . . . . . . . . . . . . . . .4-47
VTX Software Already Installed. . . . . . . . . . . . . . . . .4-47
VTX Software Not Installed . . . . . . . . . . . . . . . . . . . .4-47
Index
List of Figures
Figure 1-1. DAS Hardware Configuration Window . . . . . . . .1-8
Figure 1-2. List of Aliases . . . . . . . . . . . . . . . . . . . . . . . . . . .1-11
Figure 1-3. Engineering Units Window . . . . . . . . . . . . . . . . .1-13
Figure 1-4. Keithley Memory Manager Window
(Windows 3.x Version). . . . . . . . . . . . . . . . . . . .1-16
Figure 2-1. Displaying a Single Data Point -
Design-Time View. . . . . . . . . . . . . . . . . . . . . . . . .2-2
Figure 2-2. Displaying a Single Data Point -
Run-Time View . . . . . . . . . . . . . . . . . . . . . . . . . . .2-3
Figure 3-1. Properties Window for the DAS Control
(Visual Basic 3.0) . . . . . . . . . . . . . . . . . . . . . . . . .3-9
Figure 3-2. More Properties Window for the DAS Control. .3-11 Figure 3-3. Effects of Changing the Process Source
on the More Properties Window . . . . . . . . . . . . .3-12
Figure 3-4. Effects of Changing Property Values
in the More Properties Window. . . . . . . . . . . . . .3-13
Figure 3-5. Source and Destination Controls . . . . . . . . . . . . .3-14
Figure 3-6. Multiple Source Controls to a Single
Destination Control . . . . . . . . . . . . . . . . . . . . . . .3-15
Figure 3-7. Example of a Data Group in the
VTX Environment . . . . . . . . . . . . . . . . . . . . . . . .3-17
Figure 3-8. Example of Moving Data to and from the
VTX Environment . . . . . . . . . . . . . . . . . . . . . . . .3-19
Figure 3-9. Types of Connections . . . . . . . . . . . . . . . . . . . . .3-21
Figure 3-10. Examples of Connection Points. . . . . . . . . . . . . .3-23
Figure 3-11. VTX Logic Control Connection Points. . . . . . . .3-24
Figure 3-12. Data, CTM, and Computation Control
Output Connection Points . . . . . . . . . . . . . . . . . .3-25
Figure 3-13. Multiple Connections to the Same
Connection Point . . . . . . . . . . . . . . . . . . . . . . . . .3-26
Figure 3-14. Example of Interform Connections . . . . . . . . . . .3-27
Figure 3-15. Using Separate Forms and Interform
Connections . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-28
vi
Figure 3-16. Example of the Interform Connection
Dialog Box. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-29
Figure 4-1. Using Separate Forms for a Complex
VTX Application . . . . . . . . . . . . . . . . . . . . . . . . . .4-3
Figure 4-2. Multiple Connections to the Same
Input Connection Point . . . . . . . . . . . . . . . . . . . . .4-7
Figure 4-3. Changing the Order of Connections . . . . . . . . . . .4-8
Figure 4-4. Interform Connection Example . . . . . . . . . . . . . .4-10
Figure 4-5. Selecting Connections for Deletion. . . . . . . . . . .4-12
Figure 4-6. VTX DAS Example 3 . . . . . . . . . . . . . . . . . . . . .4-20
Figure 4-7. Displaying a Single Data Point -
Design-Time View. . . . . . . . . . . . . . . . . . . . . . . .4-28
Figure 4-8. Displaying a Single Data Point -
Run-Time View . . . . . . . . . . . . . . . . . . . . . . . . . .4-29
Figure 4-9. Displaying Data in a Grid -
Design-Time View. . . . . . . . . . . . . . . . . . . . . . . .4-30
Figure 4-10. Displaying Data in a Grid - Run-Time View. . . .4-31
Figure 4-11. Graphing Data . . . . . . . . . . . . . . . . . . . . . . . . . . .4-33
Figure 4-12. Displaying Data in a Visual Basic List Box . . . .4-34
Figure 4-13. Transferring Data to a Spreadsheet . . . . . . . . . . .4-36
List of Tables
Table 1-1. Backup Commands . . . . . . . . . . . . . . . . . . . . . . . .1-4
Table 1-2. VTX Control Filenames. . . . . . . . . . . . . . . . . . . .1-18
Table 3-1. VTX Controls, Processes, and Process
Sources. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-4
Table 3-2. Properties Common to all VTX Controls . . . . . .3-10
Table 4-1. Visual Basic Events for Text Control
Processes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-17
Table 4-2. Files Required for Distributing VTX
Applications. . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-42
vii
1
Installing VTX Software
To get started quickly with the V isual Test Extensions (VTX) system, this chapter explains the steps necessary to install the VTX software. These steps include
1. Preparing for installation.
2. Installing VTX software.
3. Preparing to use boards with VTX software.
4. Loading the VTX controls into the Visual Basic Toolbox (if you have not chosen to load them during installation).
5. Creating your first VTX application.
Note:
uncompressed text file (INSTALL.TXT) that also explains how to install the VTX software. If you are upgrading your VTX software, check this file for pertinent information before installing the upgrade software. You can read INSTALL.TXT with any text editor.
The master disk #1 of the VTX DAS Base Module provides an
Preparing to Install VTX Software
Before you install the VTX software, you need to
1. Check that the system on which you are installing the VTX software meets the system requirements.
2. Check the contents of your VTX package.
3. Make backup copies of the master disks.
Preparing to Install VTX Software 1-1
Note:
The VTX software provides a board simulation tool, called the DAS-Demo Device. You can use the DAS-Demo Device to develop applications without installing your Keithley MetraByte board and related software.
The following subsections describe each of these steps in more detail.
Checking System Requirements
To use the VTX system, ensure that the computer on which you are installing the software meets the following hardware and software requirements:
®
IBM
-compatible computer with an 80386DX or higher processor Data acquisition boards available or installed A 3 1/2-inch floppy drive VGA, SVGA, or compatible monitor A mouse and supporting software MS-DOS
®
, version 5.0 or higher
Windows, version 3.1 or higher, in standard or enhanced mode, or Windows 95
Visual Basic for Windows, version 3.0 (Standard or Professional Editions) or Visual Basic for W indows, v ersion 4.0 (16-bit versions of the Professional and Enterprise Editions only). The Standard Edition of Visual Basic 4.0 does not support 16-bit controls.
Ensure that the computer has memory and hard disk space that are sufficient to support the data acquisition boards, your version of Windows, and Visual Basic for Windows in addition to the VTX system files.
1-2 Installing VTX Software
Checking the Package
The basic VTX package contains
VTX DAS Base Module master disks (3)
VTX Driver master disk (1)
This guide, Visual Test Extensions User’s Guide
The VTX DAS Base Module master disks contain the basic VTX software, including the CTM, DAS, Data, Logic, Text, and Transfer control software and VTX system software. The VTX Driver master disk contains the board-specific software (drivers) required to use the VTX software with Keithley MetraByte hardware. See “Installing VTX Software,” on page 1-4 for details on installing the appropriate drivers for your board.
Note:
If you purchase a Keithley MetraByte board that became available after the current version of the VTX software, use the VTX Driver disk that accompanies the board to install the VTX driver for that board.
The optional VTX modules contain
VTX Analysis Module master disk (1)
VTX Graph Module master disk (1)
If any disk is missing, call the Keithley MetraByte Applications Engineering department. See “Getting Additional Help,” on page xvii.
Preparing to Install VTX Software 1-3
Backing Up the Master Disks
Before you install the VTX software, back up the master disks. Use one of the commands shown in Table 1-1.
Table 1-1. Backup Commands
From Use
Windows 3.x File menu in File Manager Copy command
Disk menu in File Manager Copy Disk command DOS prompt COPY or DISKCOPY command
Windows 95 Edit menu of Explorer Copy and Paste commands
Edit menu of Keithley VTX program group window, which is accessible from My Computer or Start button in the task bar
Installing VTX Software
Use the following steps to install VTX software from either Windo ws 3.x or Windo ws 95:
1. Insert master disk #1 of the VTX DAS Base Module in the
appropriate disk drive.
2. With Windows 3.x running, click Run on the File menu.
With Windows 95 running, click the Start button in the task bar and then click Run on the Start menu.
3. In the Run dialog box, enter the appropriate drive letter and the setup
command. For example, if the disk is in drive A, enter
Copy and Paste commands
a:\setup
4. Follow the prompts to complete the installation process.
1-4 Installing VTX Software
The installation program checks for the board-specific software required to use the VTX software with your Keithley MetraByte hardware. If the board-specific software requires an upgrade or is not installed on your computer, the installation program provides the option of upgrading or installing the board-specific software.
If you choose not to upgrade or install the board-specific software at this time, you can run the VTX installation program again at your convenience. When you run the program again, choose the option to customize the installation. At the Custom Installation dialog box, choose only the board-specific software option (deselect all other options). Follow the prompts to upgrade or install the board-specific software.
5. If it successfully locates Visual Basic, the installation program gives
you the option of automatically adding the VTX controls to your Visual Basic Toolbox through the AUTOLOAD.MAK (Visual Basic
3.0) or AUTO16LD.VBP (V isual Basic 4.0) project. If you plan to use the VTX controls in most of your Visual Basic applications, you may want to take advantage of this option. If not, you can add the VTX controls manually to each application as needed. See the section “Adding a Control to an Application Manually,” on page 1-19 for instructions.
When software installation is complete, check the README file for information that was not available before this guide was printed. You can read this file at any time by clicking the README icon in the Keithley VTX program group of the Windows 3.x Program Manager or by choosing in succession Start, Programs, Keithley VTX, and README from the Windows 95 task bar.
After checking the README file, you can start using the VTX controls with Visual Basic as long as you chose to add them automatically during installation. (If you chose not to add them automatically to the Toolbox, see “Loading VTX Controls,” on page 1-18 for instructions.)
You can use the DAS-Demo Device that accompanies VTX software to simulate data acquisition operations. Before you can set up and run applications using a Keithley MetraByte board, you must use the VTX Configuration utility to register and configure your board. See the next section for details.
Installing VTX Software 1-5
Notes:
Even if you installed and configured a Keithley MetraByte board prior to receiving the VTX software, you must register and configure the board for use with the VTX software.
If you should need to remove the VTX software from the computer, you may want to use the Uninstall VTX program. The program is accessible through the Uninstall VTX icon in the Keithley VTX program group.
If you have not already installed it, do not install the board until after you have installed all the software and prepared the board for use with the VTX software.
Preparing to Use Boards with VTX Software
VTX software includes a special utility, the VTX Configuration utility, that provides the following configuration windows:
DAS Hardware - For registering and configuring your Keithley
MetraByte data acquisition boards for use with VTX software. Before you can use your boards with the VTX software and Visual Basic, you must register and configure the boards with the DAS Hardware configuration window.
The DAS Hardware configuration window also provides access to an Engineering Units window, where you can specify the type of sensor or equation to use in converting analog input data into engineering units. Converting data is optional. You can do this at the time you register and configure the board or later when you are setting up the analog input operation.
Keithley Memory Manager - For allocating system memory for VTX
data acquisition applications. You may want to increase the amount of system memory allocated for VTX data acquisition applications by the Keithley Memory Manager (KMM). By default the KMM allocates 128K bytes of memory. See “Reserving Memory,” on page 1-15 for details.
1-6 Installing VTX Software
VTX Options - For specifying options for the VTX programming
environment. The default values for the VTX Options should suffice while you are developing applications. You may want to change the options if you release an application to other users. See “Enabling and Disabling VTX Options,” on page 4-41 for details.
The following subsections explain how to use the DAS Hardware configuration window to register and configure boards for use with VTX software.
Registering and Configuring Boards
To register and configure your Keithley MetraByte boards for use with VTX software, perform the following steps:
1. From the Keithley VTX group window in the Windows 3.x Program
Manager, double-click the VTX Configuration icon. From the Windows 95 task bar, click Start, then slide the cursor over
Programs, then Keithley VTX, and click VTX Configuration.
Preparing to Use Boards with VTX Software 1-7
When the VTX Configuration utility window opens, the DAS Hardware configuration window is on top, as shown in Figure 1-1.
Figure 1-1. DAS Hardware Configuration Window
2. From the DAS Hardware configuration windo w, choose the Add Ne w
button to register a board for use with the VTX software. The Add New Board dialog box appears, with a list of the board families whose VTX-compatible software is currently installed.
1-8 Installing VTX Software
The following example of the dialog box sho ws many of the currently supported Keithley MetraByte board families; a typical VTX installation would not show as many board families:
Note:
For a board family to appear in the Add New Board dialog box, you must have properly installed the VTX-compatible software for the board.
3. From the Add New Board dialog box, select the family name of the board series that is appropriate to the board you are registering. For example, if you are using a DAS-1801ST board, select DAS-1800 Series.
4. Choose the OK button. The DAS Hardware configuration window displays the appropriate board configuration utility . F or some boards, a DOS session of the configuration utility starts; for other boards, a Windows utility starts.
5. When the board configuration appears, set the parameters for the board as appropriate. See the user’s guide for the board if you need assistance configuring the board.
6. Save the configuration and exit the board configuration utility. If the utility is running in a DOS session, press
. Then, when
ESC
prompted, enter Y to save any changes or N to discard the changes and exit.
Preparing to Use Boards with VTX Software 1-9
7. Repeat steps 2 through 6 to register and configure any additional boards.
From the DAS Hardware configuration window, you can access online help by pressing
F1
or by choosing the Help button.
Changing the Configuration of a Registered Board
To change the configuration of a registered board, follow these steps:
1. Select the board from the list in the DAS Hardware configuration window.
2. Choose the Configure button.
3. When the DAS Hardware configuration window displays the appropriate board configuration utility, change the parameters as appropriate to your application.
4. Save your changes and exit to the DAS Hardware configuration window.
Deleting a Registered Board
To delete a board from the list of registered boards, follow these steps:
1. Select the board name from the list in the DAS Hardware configuration window.
2. Choose the Remove button.
3. When prompted, choose the Yes button to confirm the deletion or the No button to cancel the deletion.
1-10 Installing VTX Software
Changing an Alias
When you add and configure a board, the VTX software automatically assigns a unique identifier to the board, called an alias . An alias is a name that identifies a board for the VTX D AS or CTM control; the alias appears in the list of process sources for the appropriate control. In Figure 1-2, the default alias for the DAS-Demo Device appears in the list (Pseudo DAS Device) along with default aliases for three PIO-12 boards and a DAS-1801ST board.
Figure 1-2. List of Aliases
When you keep the default aliases, new boards are always assigned the lowest board number av ailable; when you remov e a board, the numbers of other boards in the same family are updated automatically. Using the example in Figure 1-2, the default aliases for the PIO-12 boards are PIO-12 Board 1, PIO-12 Board 2, and PIO-12 Board 3. Suppose you remove the second PIO-12 board (default alias PIO-12 Board 2). The alias for the third PIO-12 board (default alias PIO Board 3) automatically changes to PIO-12 Board 2.
You can change the alias to a name that is more meaningful to your application. When choosing an alias, keep in mind that VTX software does not automatically update the aliases that you assign and that you must assign a unique alias.
To change an alias, perform the following steps:
1. From the list in the DAS Hardware configuration window, select the board name and alias.
2. Choose the Change Alias button.
Preparing to Use Boards with VTX Software 1-11
3. From the Change Board Alias Name dialog box, enter a new alias for the board.
4. Choose the OK button to save the change and close the dialog box. The new alias appears in the list.
Note:
Once you change an alias, the VTX software no longer handles the
alias as a default alias. Even if you supply a name that is identical to the
default alias, the name you supply is effectiv ely frozen and not updated if
another board in the same family is removed from the list.
In general, do not change the alias of a board that you have already included in a VTX application.
Specifying Engineering Units
The VTX DAS control can convert analog input data into engineering units that are useful to your application. For example, if you connect thermocouples to your analog input channels, you can use the DAS control to acquire data from the thermocouples and then convert the raw analog input data to the temperature units you require. To enable the DAS control to perform the conversion, you must perform the following tasks:
1. Specify the sensors or equations to use for the conversion in the Engineering Units window of the VTX Configuration utility.
2. Set the properties for the analog input operation. See the topics, "Setting Up DAS Processes" and "Setting Up Analog In Processes," in the online help for detailed instructions.
In particular, ensure that you set the DataConvType property of the DAS control to Eng Units.
Note:
The Eng Units setting for the DataConvType property automatically sets the DataType property to Single. If your application requires a different data type, set the DataType property accordingly.
1-12 Installing VTX Software
To specify the type of sensor or equation to use in converting acquired data automatically during an analog input operation, perform these steps:
1. From the Keithley VTX group window in the Windows 3.x Program Manager, click the VTX Configuration icon.
From the Windows 95 task bar, click Start, then slide the cursor over Programs, then Keithley VTX, and click VTX Configuration.
2. From the list in the DAS Hardware configuration window, select the board name and alias.
3. Choose the Engineering Units button. The Engineering Units window, similar to the one in Figure 1-3, appears, with the name of the selected board in the title bar.
Figure 1-3. Engineering Units Window
4. From the list of channels in the Engineering Units window, select the number of the channel to define. You can select multiple, consecutive channels by pressing
SHIFT
and clicking or by holding the left mouse button down and dragging the highlight across the channel numbers. You can select multiple, non-consecutive channels by pressing
CTRL
and clicking each channel number.
Preparing to Use Boards with VTX Software 1-13
By default, the conversion type is voltage and calibration is disabled.
5. From the pull-down list in the Conversion Type option, select a conversion type. In Figure 1-3, the Thermocouple conversion type is selected for channel 0.
6. Depending on the conversion type you select, you may need to set additional parameters. In Figure 1-3, the additional parameters include the thermocouple type, temperature units, CJC type, and CJC parameters.
7. If you want to apply calibration, click the radio button next to Yes and then set the calibration slope and offset.
When you enable calibration here, the DAS control converts raw data to voltages, applies the calibration, and then converts the calibrated voltages to engineering units. You can send the converted data to the Conversion process of the Computation control if you want to apply another calibration after the initial conversion.
For example, suppose raw data is converted to 4.50 V. After calibration, the DAS control converts the calibrated data of 4.51 V to
36.20
°
C. If you then use the Computation control to calibrate the
temperature, the calibrated temperature might change to 36.24
Note:
The default settings for the calibration slope and offset disable
°
C.
calibration. To enable calibration, you must change the calibration slope and offset.
8. Repeat steps 4 through 7 for each channel whose data you want to convert.
9. To save your changes and return to the main DAS Hardware configuration window, choose the OK button. To cancel your changes and exit to the main window, choose the Cancel button.
The Engineering Units window provides a Help button that you can use to display additional information.
1-14 Installing VTX Software
Reserving Memory
When you install VTX software, the Keithley Memory Manager (KMM) is automatically installed so that your VTX applications can use the KMM instead of the appropriate Windows memory manager. If you installed VTX software on a Windows 3.x system, the KMM reserved 128K bytes of memory for VTX data acquisition applications at installation. If you installed VTX software on a Windows 95 system, you need to use the KMM tab of the VTX Configuration utility to specify the amount of memory and then restart Windows 95 to activate the KMM.
For Windows 3.x systems the VTX installation program copies a file called VDMAD.386, which is a customized v ersion of Microsoft's Virtual DMA Driver (VDMAD). VDMAD.386 contains a copy of Microsoft's Virtual DMA Dri v er and a group of functions added to perform the KMM functions. The VTX installation program replaces Microsoft's Virtual DMA Driver with the VDMAD.386 file and modifies your SYSTEM.INI file accordingly.
For Windows 95 systems the VTX installation program copies a file called VDMAD.VXD, which is a customized version of Microsoft's Virtual DMA Driver (VDMAD). VDMAD.VXD contains a copy of Microsoft's Virtual DMA Driver and a group of functions added to perform the KMM functions. When you run the KMM tab of the VTX Configuration utility and then restart Windows 95, the VTX software replaces Microsoft's Virtual DMA Driver with the VDMAD.VXD file and modifies the Windows 95 Registry and your SYSTEM.INI file accordingly.
For any Windows system, you can change the amount of memory reserved for your VTX applications using the following steps:
1. From the Keithley VTX group window in the Windows 3.x Program Manager, double-click the VTX Configuration icon.
From the Windows 95 task bar, click the Start button, then move the cursor over Programs, followed by Keithley VTX, and then click VTX Configuration once.
2. When the DAS Hardware configuration window appears, click the Keithley Memory Manager tab to display the KMM component of the VTX Configuration utility.
Preparing to Use Boards with VTX Software 1-15
Figure 1-4 shows an example of the KMM windo w for Windows 3.x, Enhanced Mode. The window for Windows 95 systems is very similar; it differs only in the extension of the filename (VDMAD.VXD instead of VDMAD.386). The VTX Configuration utility detects the version of Windows software you are using and presents the appropriate KMM window.
Figure 1-4. Keithley Memory Manager Window (Windows 3.x Version)
3. In the KMM window, you can see the current reserved memory in the Current Setting field. Enter the amount of memory that your VTX applications require in the Desired Setting field.
1-16 Installing VTX Software
The amount of memory you can reserve depends on the total available memory and on the memory requirements of Windows and other Windows applications. See the online help for the KMM and the user’s guide for your board for details on reserving memory.
4. Choose the Update button.
5. When prompted, you can put the changes into effect immediately by clicking the Restart Windows button. Note that, for Windows 3.x, the KMM component of the VTX Configuration utility updates the SYSTEM.INI file automatically. Similarly, for Windows 95, the KMM component updates the Registry and the SYSTEM.INI file automatically. In addition, for all supported Windows versions, the KMM component shuts down Windows, then brings it back up.
To return to the VTX Configuration utility without implementing the changes immediately, choose the Return to Utility button. The changes will take effect the next time you start Windows.
After you register and configure your board and allocate memory for your applications, the next step depends on whether your board is already installed:
If your board is already installed and you chose to load the VTX controls automatically into your Visual Basic Toolbox, you can start using the VTX controls. If you chose not to load the VTX controls at installation, see “Loading VTX Controls,” on page 1-18 for instructions.
If your board is not already installed, continue to the next section.
Installing Hardware
After you register and configure a Keithley MetraByte board for use with VTX software, perform the following tasks to install your board:
1. Power down the computer.
2. Set the appropriate hardware switches on the board.
3. Install the board in the computer.
4. Power up the computer.
For assistance with these tasks, see the user’s guide for the board.
Preparing to Use Boards with VTX Software 1-17
Once you have completed these tasks, you can start using the VTX controls as long as you loaded them automatically at installation. If you chose not to load them automatically, load the VTX controls into your Visual Basic Toolbox; the next section explains how.
Loading VTX Controls
VTX custom controls are extensions to your Visual Basic Toolbox. Use the VTX controls in the same way you use the standard Visual Basic Toolbox controls. The VTX custom controls are 16-bit controls and are compatible with Visual Basic 3.0 and the 16-bit versions of Visual Basic
4.0, Professional and Enterprise Editions.
To remain compatible with Visual Basic 3.0, the VTX control files are VBX files. The VTX installation program stores the VBX files in your WINDOWS\SYSTEM directory by default. Table 1-2 lists the VTX controls by module and their corresponding filenames.
Table 1-2. VTX Control Filenames
Module Control Filename
DAS Base Counter/Timer (CTM) K_CTM.VBX
DAS K_DAS.VBX Data K_DATA.VBX Logic K_LOGIC.VBX Text K_TEXT.VBX Transfer K_XFER.VBX
Analysis Computation K_COMP.VBX
Frequency K_FREQ.VBX Statistics K_STAT.VBX
Graph Graph K_GRAPH.VBX
1-18 Installing VTX Software
If you chose not to load the VTX custom controls automatically into your Visual Basic Toolbox at installation, you can load them now in either of two ways:
Manually — Add the control files as needed for each project. Use the
manual option if you use Visual Basic for several different types of applications.
Automatically — Add the control files to the AUTOLOAD.MAK
project (Visual Basic 3.0) or the AUTO16LD.VBP project (Visual Basic 4.0) so that the controls are loaded into the Toolbox every time you start Visual Basic. Use the automatic option if you use Visual Basic exclusively for data acquisition applications. If you selected the option to load the VTX custom controls at installation, the installation program added them to the AUTOLOAD.MAK or AUTO16LD.VBP project for you.
Adding a Control to an Application Manually
Before you can use a VTX custom control in an application, you need to add the control’s VBX file to your project. The steps for adding custom controls to an application differ between Visual Basic 3.0 and Visual Basic 4.0. Follow the instructions in the section appropriate to your version of Visual Basic.
The main difference between loading the controls into the Visual Basic Toolbox on Windows 3.x and Windows 95 is the way in which you start Visual Basic:
From the Windows 3.x Program Manager, double-click the Visual Basic icon in the appropriate program group.
From the Windows 95 task bar, click Start, then slide the cursor over Programs, followed by Visual Basic, and then click the appropriate Visual Basic icon in the Visual Basic menu.
Loading VTX Controls 1-19
Visual Basic 3.0
To add the VTX controls to your Visual Basic 3.0 Toolbox, perform the following steps:
1. With Visual Basic 3.0 running, open your project file ( projectname .MAK). If you are starting a new project, select New Project from the File menu.
2. From the Visual Basic File menu, select Add File.
3. From the Add File dialog box, locate the WINDOWS\SYSTEM directory.
4. From the list of files in the WINDO WS\SYSTEM directory , select the filename for the VTX control ( control .VBX) that you want to load. For example, K_D ATA.VBX is the filename of the VTX Data control. See Table 1-2 on page 1-18 for the complete list of VTX control filenames.
Visual Basic 4.0
5. Choose the OK button. The name of the control file appears in the Project window. In addition, the control icon appears in the Toolbox.
6. Repeat steps 2 through 4 for each VTX control that you want to use in your application.
7. From the File menu, select Save Project.
To add the VTX controls to your Visual Basic 4.0 Toolbox, perform the following steps:
1. With Visual Basic 4.0 running, open your project file ( projectname .VBP). If you are starting a new project, select New Project from the File menu.
2. From the Tools menu, select Custom Controls or press When the Custom Controls dialog box appears, you can make viewing easier by using the Show option to specify that only selected items are displayed in the Available Controls list box.
3. Choose the Browse button to display the Add Custom Controls dialog box.
4. From the Add Custom Controls dialog box, locate the WINDOWS\SYSTEM directory.
CTRL+T
.
5. From the list of files in the WINDO WS\SYSTEM directory , select the filename for the VTX control ( control .VBX) that you want to load. For example, K_D ATA.VBX is the filename of the VTX Data control. See Table 1-2 on page 1-18 for the complete list of VTX control filenames.
After you select the filename, the Custom Controls dialog box appears with the selected control listed and checked in the Available Controls list box.
6. Repeat steps 3 through 5 for each additional VTX control that you want to use in your application.
7. When ready, choose the OK button in the Custom Controls dialog box. The name of each selected control file appears in the Project window. In addition, the control icon appears in the Toolbox.
8. From the File menu, select Save Project.
Loading VTX Controls Automatically
If you want the VTX custom controls to be available in the Toolbox each time you start Visual Basic and you did not select the option to load the controls at installation, you can load the controls into the AUT OLOAD.MAK (Visual Basic 3.0) or A UT O16LD.VBP (V isual Basic
4.0) project now. The steps for adding custom controls differ between
Visual Basic 3.0 and Visual Basic 4.0. Follow the instructions in the section appropriate to your version of Visual Basic.
The main difference between loading the controls into the Visual Basic Toolbox on Windows 3.x and Windows 95 is the way in which you start Visual Basic:
From the Windows 3.x Program Manager, double-click the Visual
Basic icon in the Visual Basic program group.
From the Windows 95 task bar, click Start, then slide the cursor over
Programs, followed by Visual Basic, and then click the appropriate Visual Basic icon in the Visual Basic menu.
Loading VTX Controls 1-21
Visual Basic 3.0
To add the VTX controls to your AUTOLOAD.MAK project so that the controls load automatically each time you run Visual Basic, perform the following steps:
1. From the Visual Basic File menu, select Open Project.
2. From the Open Project dialog box, select AUTOLOAD.MAK from your Visual Basic root directory (for example, C:\VB).
3. Choose the OK button. The project window for AUTOLOAD.MAK appears. This window
lists the files that are automatically added to each new application. In addition, the list contains the names of the VBX files for the controls that automatically appear in the Toolbox each time you start Visual Basic.
4. From the File menu, select Add File.
5. From the Add File dialog box, locate the WINDOWS\SYSTEM directory.
6. From the list of files in the WINDO WS\SYSTEM directory , select the filename for the VTX control (control.VBX) that you want to load automatically. For example, K_DATA.VBX is the filename of the VTX Data control. See T able 1-2 on page 1-18 for the complete list of VTX control filenames.
7. Choose the OK button. The name of the control file appears in the AUTOLOAD.MAK project window.
8. Repeat steps 4 through 7 for each VTX control that you want to load automatically.
9. From the File menu, select Save Project to save the modified AUTOLOAD.MAK file.
Each time you start Visual Basic, the VTX controls appear in the Toolbox automatically .
1-22 Installing VTX Software
Visual Basic 4.0
To add the VTX controls to your AUTO16LD.VBP project so that the controls load automatically each time you run Visual Basic, perform the following steps:
1. With Visual Basic 4.0 running, select Open Project from the File menu.
2. From the Open Project dialog box, select AUTO16LD.VBP from your Visual Basic root directory (for example, C:\VB).
3. Choose the OK button.
4. From the Tools menu, select Custom Controls or press
CTRL+T.
When the Custom Controls dialog box appears, you can make viewing easier by using the Show option to specify that only selected items are displayed in the Available Controls list box.
5. Choose the Browse button to display the Add Custom Controls dialog box.
6. From the Add Custom Controls dialog box, locate the WINDOWS\SYSTEM directory.
7. From the list of files in the WINDO WS\SYSTEM directory , select the filename for the VTX control (control.VBX) that you want to load. For example, K_D ATA.VBX is the filename of the VTX Data control. See Table 1-2 on page 1-18 for the complete list of VTX control filenames.
After you select the filename, the Custom Controls dialog box appears with the selected control listed and checked in the Available Controls list box.
8. Repeat steps 5 through 7 for each additional VTX control that you want to load automatically.
9. When ready, choose the OK button in the Custom Controls dialog box. The name of each selected control file appears in the Project window. In addition, the control icon appears in the Toolbox.
10. From the File menu, select Save Project to save the modified AUTO16LD.VBP file.
Loading VTX Controls 1-23
Creating Your First VTX Application
After installing the VTX software and loading the controls into Visual Basic, follow the tutorial presented in Chapter 2 to create your first VTX application.
1-24 Installing VTX Software
2
Creating Y our First VTX
Application
In this chapter, you will build a simple application that reads and displays a single data point by
1. Designing the user interface
2. Setting the properties
3. Connecting the VTX controls
4. Writing code
5. Running the program
Assumptions
This tutorial assumes
You have loaded the VTX controls into your Visual Basic Toolbox. If you did not load the VTX controls at installation, see “Loading VTX Controls” on page 1-18 for instructions.
You are familiar with the W indo ws en vironment and kno w how to use a mouse.
You are familiar with the basic elements of the Visual Basic interface. If this is your first exposure to Visual Basic, take the time to read through the first three chapters of the Visual Basic Programmer’s
Guide before you begin.
Assumptions 2-1
Overview of the Application
When run, the application you will build performs a single-point digital input operation and then displays the data point. This application simulates the digital input operation using the VTX DAS-Demo Device, which is a data acquisition simulation tool supplied with VTX software. You do not need a DAS board installed in your computer to create and run this application.
Figure 2-1 shows a design-time view of the application. The VTX DAS control (DASCtrl1) performs the digital input operation; the VTX Text control (the white rectangle connected to DASCtrl1) displays the data point. The line connecting the DAS control to the Text control (called a
connection ) enables the data point to be passed to the Text control for
display. The Start and Stop buttons let users of the application decide when the operation runs. The Exit button exits the application gracefully.
Figure 2-1. Displaying a Single Data Point - Design-Time View
2-2 Creating Your First VTX Application
Figure 2-2 shows a run-time view of this application, with a data point displayed. The DAS control and its connection to the Text control are invisible; all other controls are visible.
1
Figure 2-2. Displaying a Single Data Point - Run-Time View
The following sections explain how to create this application.
Design the User Interface
The Visual Basic environment lets you quickly and easily design user interfaces for applications. The Visual Basic form is the window in which you build the user interface. To design the user interface, you place controls on the form. You can select from a number of standard Visual Basic controls, including the command button, label, text box, and combo box controls. The VTX Graph and Text controls are also av ailable for user interface design.
The user interface you will design in this section uses the standard Visual Basic command button controls to let users of the application decide when to start operations and exit the application. It uses the VTX Text control to display the data point. You will also place the VTX DAS control on the user interface form, even though the control is not visible when the application runs.
Design the User Interface 2-3
To design the user interface, follow these steps:
1. Double-click the Microsoft Visual Basic icon in the Keithley VTX window to start Visual Basic. A new form appears. If Visual Basic is already running with another project displayed, select New Project from the File menu to display a new form.
Visual Basic Toolbox
Visual Basic menu bar
Indicates that you are in design mode. This is also referred to as "design time".
Visual Basic Toolbar
Form1 is the default title for a new form. To change the title for a form, you will use a property called Caption.
VTX Controls in Toolbox: CTM Logic Text Graph Statistics Computation Frequency Transfer Data DAS
2. Move the cursor over the lower right corner of the form until the arrow changes to a double arrow.
3. When the cursor changes to a double arrow, press and hold down the left mouse button, and then move the mouse such that the form is
2-4 Creating Your First VTX Application
approximately four inches wide and two inches high. When you set the properties later, you will specify the form size with more exact dimensions.
4. Double-click the VTX DAS control icon in the Visual Basic Toolbox to place the control in the middle of the Visual Basic form.
When you use this method to place a control on a form, the control always appears in the middle of the form. The text on the DAS control represents the default control name (Name property) and the default process (Process property). Most VTX controls display this information when you place them on a form.
The black squares spaced evenly around the control are sizing handles. Sizing handles in Visual Basic indicate that a control is selected.
Sizing handles surrounding the control indicate that the control is still selected.
control name
default process
Because the DAS control is in visible at run time and because you will later need to draw a line from its right side, you are now going to move the DAS control off to the left side of the form.
5. With the DAS control still selected, position the cursor over the control on the form.
Design the User Interface 2-5
6. While pressing and holding down the left mouse button, move the mouse to reposition the DAS control on the left side of the form, as shown below. Moving an object this way is called "dragging."
7. Double-click the VTX Text control icon to place the control on the form. Note that, unlike other VTX controls, the Text control does not display its name and default process. While it is still selected, drag the Text control to the right of the DAS control, as shown below:
8. Double-click the Visual Basic command button icon three times to place the three buttons for this application on the form.
2-6 Creating Your First VTX Application
The buttons appear on top of one another in the center of the form. Command3 is on top, as shown below:
9. While it is still selected, drag Command3 to the position shown below. Then, select and drag Command 2 and Command1 to the positions shown below:
You have completed designing the user interface for this application.
Design the User Interface 2-7
Before continuing, save your work by following these steps:
1. From the Visual Basic File menu, select Save Project. The Save File As dialog box appears.
2. Use the Drives and Directories boxes to locate the dri v e and directory in which you want to store the application. Then, in the File Name field, enter a unique name for the form file. For this example, use VTXEX1.FRM.
3. Click OK to save the form.
4. When the Save File As dialog box prompts you to save the project file, use the same prefix as you used for the form file, VTXEX1. The three-letter extension supplied by Visual Basic depends on your version of Visual Basic. Visual Basic 3.0 supplies the extension MAK; the Visual Basic 4.0 extension is VBP.
5. The Save File As dialog box lets you choose to save the files as text. Leave this box unchecked so that the files are saved as binary. For more information on storing files as binary or as text, refer to your Visual Basic documentation.
Now you are ready to set the properties.
2-8 Creating Your First VTX Application
Set the Properties
In Visual Basic, properties can represent physical attributes of an object. For example, the Caption property lets you specify the title for a form or command button. Similarly, the BackColor property lets you specify the background color for a form or for the VTX Text control. For VTX controls, properties also represent parameters for the process that you want the control to perform. For example, the Samples property of the VTX DAS control lets you specify the number of data points to read from each channel during an analog input or digital input operation.
After designing the user interface, your next task is to set the properties for the form and the controls.
Set the Form Properties
You can use many different properties to set up forms in Visual Basic. For purposes of this tutorial, you will specify the form title (Caption), dimensions (Height and Width), background color (BackColor), and the name you will use to reference the form in code (Name).
To set the properties for the form, follow these steps:
1. Click the form to select it and then press window. The illustration below shows a form Properties windo w as it appears in Visual Basic 3.0:
F4
to display its Properties
Set the Properties 2-9
2. From the Properties window, double-click the Caption property. When the default text is highlighted, enter the following text:
Displaying a Single Data Point
3. Locate and double-click the Height property. In Visual Basic, the default dimensions for a form are expressed in a special unit called
twips ; there are 1440 twips in an inch.
4. When the default Height setting is highlighted, enter the following dimension:
3000
This changes the height of the form.
5. Locate and double-click the Width property.
6. When the default setting is highlighted, enter the following dimension (twips):
6000
This changes the width of the form.
7. Locate and double-click the BackColor property.
8. When the color dialog box appears, click any color you want to use. The hexadecimal code for the color appears as the current setting and the background color of the form changes to reflect your choice.
9. Finally , locate and double-click the Name property. When the default text is highlighted, enter the following text:
frmMain
In Visual Basic, every object has a Name property. You use the text entered for the Name property to reference an object in code.
Each VTX control has a default Name that includes the control name (or an abbreviation for the name), the abbreviation "Ctrl", and a number that represents the instance of the control on the form. For example, DASCtrl1 is the first DAS control placed on a form.
10. From the File menu, select Save Project. Because you have already specified filenames, no dialog box appears; Visual Basic saves the changes.
Now that you have set the form properties, you can begin setting up the digital input operation and the display of the data point by setting properties for the VTX controls.
2-10 Creating Your First VTX Application
Set the DAS Control Properties
The DAS control properties let you specify parameters for a data acquisition operation. For purposes of this tutorial, you will specify the device to use for the operation (ProcessSrc property), the operation to perform (Process property), when the control can start the process (ArmState property), and the mode in which the operation runs (OpMode property).
To set the properties for the DAS control, follow these steps:
1. Click the DAS control once to select it and then click the Properties window to view the properties and their default settings for the DAS control. (If you previously closed the Properties window, click the control and press
to display the Properties window.)
F4
The arrows point to VTX-specific properties and their default settings for the DAS control. All other properties are standard Visual Basic
3.0 properties.
Set the Properties 2-11
2. From the Properties window, check the setting of the ProcessSrc property to ensure that it is Pseudo DAS De vice, which is the alias for the DAS-Demo Device.
If the setting is not Pseudo DAS Device, double-click the ProcessSrc property until the Pseudo DAS Device setting appears.
Alternatively, click the down arrow next to the highlighted setting to display the list of available process sources, and then click the Pseudo DAS Device setting. If you have already registered and configured boards, the aliases you assigned to the boards appear in this list.
3. From the Properties window, double-click the Process property twice to change its value from Analog In to Digital In (digital input operation). Alternatively, double-click the property once and then click the down arrow ne xt to the highlighted setting to display the list of available processes.
4. From the Properties window, double-click the ArmState property until the setting changes to 2 - Hold. This setting prevents the DAS control from starting until the Start command button is clicked.
5. From the Properties window, click the ellipsis (...) for the (More) property to display the More Properties window.
Each VTX control has a More Properties window that lets you set up the selected operation (Process property) based on the selected process source (ProcessSrc property). For information on the properties in this window, click a property and press
F1
; the VTX
help for the property appears. The default property settings for a Digital In process with the
DAS-Demo Device are shown below:
2-12 Creating Your First VTX Application
For purposes of this tutorial, you will change only the operation mode (OpMode).
6. From the More Properties window, double-click the OpMode property to change the value from Synchronous to Single-Point.
Single-Point mode is faster than Synchronous mode when you want to read a single data point because the operation does not require any special setup, such as clocking. The changes in the list of properties available in the More Properties window reflect the smaller number of parameters to be set for a Single-Point operation, as follows:
When you select Single-Point mode, the ConvRate and Samples properties no longer apply , so they disappear from the More Properties window.
7. This example uses digital input channel 0 of the DAS-Demo Device, which is the default setting of the Channel property. Digital input channel 0 reads in a ramp of values from 0 to 255. Keep the default channel setting (0).
8. This example uses the Auto setting of the DataType property, which is the default setting. In general, the Auto setting means that the VTX control determines the data type of the incoming data and uses that data type when sending the data to another VTX control. For this example, the Auto setting means that the data type of the data point sent to the Text control is Integer. Keep the default data type setting.
9. The Mask property lets you specify the bits of the digital input (or digital output) channel that you are interested in for the operation. This example uses the default setting of the Mask property , All, which means that you are interested in all the bits of the digital input channel. Keep the default setting.
10. From the File menu, select Save Project.
Set the Properties 2-13
Set the Text Control Properties
The Text control displays the data point in a scalar text box. For this tutorial, most default property settings for the Text control suffice.
To set up the Text control to display the data point, follow these steps:
1. Click the Text control once to select it and then click the Properties window to view the default property settings for the Text control. (If you previously closed the Properties window, press Properties window.)
to display the
F4
The arrows point to VTX-specific properties and their default settings for the Text control. All other properties are standard Visual Basic
3.0 properties.
2. From the Properties window, check the Process property setting to ensure that it is Scalar. If the setting is not Scalar, double-click the Process property once to change the setting from Grid to Scalar.
2-14 Creating Your First VTX Application
3. Similarly, check the ProcessSrc property setting to ensure that it is KM_Text. If the setting is not KM_Text, double-click the property until KM_Text appears.
4. The Text control must wait until it receives the data point from the DAS control before it can run the Scalar process. Therefore, keep the default setting of the ArmState property, 0 - Wait For Control Connection, for the Text control.
5. From the Properties window, click the ellipsis (...) for the (More) property to display the More Properties window. For information on these properties, click the property and press
F1
. The VTX help for
the property appears.
6. For this example, the data point will be centered in the display. However, the property that specifies the horizontal alignment of text (HAlignment) is ignored unless the MultiLine property setting is True. Double-click the MultiLine property to change its setting from False to True.
7. To center the data point value in the Text control display, double­click the HAlignment property twice, which changes the setting from 0 - Left to 2 - Center.
8. From the File menu, select Save Project.
Set the Properties 2-15
Set the Command Button Properties
In Visual Basic, a command button lets users of an application start, interrupt, or end a process. The button actually appears to be pushed in when clicked at run time. As with a form, you can use many different properties to set up command buttons. For purposes of this tutorial, you will set properties to specify a caption (Caption) and a name to use in code (Name) for each button; you will disable one of the buttons to prevent user clicks when the application first starts (Enabled). Follow these steps to set the properties for the command buttons:
1. Click the first command button (Command1) once to select it and then click the Properties window to view the properties for a Visual Basic command button. (If you previously closed the Properties window, press
to display the Properties window.)
F4
2-16 Creating Your First VTX Application
2. From the Properties window, double-click the Caption property.
3. When the default text is highlighted, enter the following text:
Start
The Caption property now reads as follows:
4. Double-click the Name property.
5. When the default text appears in the Settings box, highlight the text and enter
cmdStart
The Name property now reads as follows:
The Name property change affects the name shown in the Object box for the command button.
Set the Properties 2-17
6. Click the second command button (Command2) once to select it and then click the Properties window (or press
to display the
F4
Properties window).
7. From the Properties window, double-click the Caption property.
8. When the default text is highlighted, enter the following text:
Stop
2-18 Creating Your First VTX Application
The Caption property now reads as follows:
9. Double-click the Name property.
10. When the default text is highlighted, enter the following text:
cmdStop
The Name property now reads as follows:
The Name property change affects the name shown in the Object box for the command button.
Set the Properties 2-19
11. Double-click the Enabled property to change its setting from True to False; the False setting prevents the command button from responding when a user of the application clicks on the Stop button:
Disabling the button grays it out when the application first starts.
12. Click the third command button (Command3) once to select it, and then click the Properties window to display its properties. (If you previously closed the Properties window, press
to open it.)
F4
13. From the Properties window, double-click the Caption property.
14. When the default text is highlighted, enter the following text:
Exit
2-20 Creating Your First VTX Application
The Caption property now reads as follows:
15. Double-click the Name property, and when the default text is highlighted, enter the following text:
cmdExit
The Name property now reads as follows:
The Name property change affects the name shown in the Object box for the command button.
16. From the File menu, select Save Project.
You have now set all the properties required for the form and the controls. Next, connect the VTX controls to enable them to pass the data point, as described in the next section.
Set the Properties 2-21
Connect the VTX Controls
Your form now shows the command buttons with their new captions, as follows:
In this section, you will enable the DAS control to pass the data point to the Text control for display by drawing a line, or connection , from the DAS control to the Text control. Connections between VTX controls enable the controls to pass data and/or program control, eliminating the need for code to perform these actions. The control sending the data and/or program control is the source control; the control receiving data and/or program control is the destination control. In the VTX environment, you always draw a connection from a source control to a destination control.
In this example, the DAS control is the source control and the Text control is the destination control. Draw the connection by performing these steps:
1. Position the cursor over the small, dark rectangle on the right side of the DAS control. This rectangle is called the data output connection
point of the DAS control.
data output connection point
2-22 Creating Your First VTX Application
2. When the cursor changes to an arrow with a soldering iron, press and hold down the left mouse button.
3. When the arrow disappears, drag the soldering iron to the small, dark rectangle on the left side of the Text control. This rectangle is called the data input connection point .
data input connection point
4. When the arrow reappears with the soldering iron, release the left mouse button. The connection appears as follows:
The connection
5. From the File menu, select Save Project.
That’s all it takes to connect VTX controls. Now, you can write the code, as described in the next section.
Connect the VTX Controls 2-23
Write the Code
While you could create and run this application without the command buttons, the buttons and writing simple code for them is included here to show you how to integrate tasks performed by VTX controls with the Visual Basic components of a user interf ace. The VTX T ext control is part of the user interface; howev er, only a connection is required to integrate it with the DAS control. The DAS control passes the data point to the Text control, which displays the data point, without the need for code. However, to start the DAS control and allow the users of the application to decide when to start it, this example includes Visual Basic command buttons.
When a user clicks a command button, the button performs one or more actions, such as starting the DAS control, by executing code in its Click event procedure. Code can include assignment statements that set properties based on user input and/or functions that perform specific actions for a control. For purposes of this tutorial, you will use assignment statements. “VTX Functions” on page 4-17 explains the functions available for VTX controls. The online help for the functions provides detailed examples of using them.
In any assignment statement you must use the name of the VTX control and the name of the property. Depending on how many forms you are using, you may also need to include the name of the form on which you placed the VTX control. For example, to set the ArmState property of a DAS control to Ignore Control Connection, use the follo wing assignment statement:
[VTXForm.]DASCtrl1.ArmState = 1’Ignore Control Connection
In this assignment statement, the text following the apostrophe ( comment that explains the meaning of the property setting (1).
To enable the users of this example application to start the digital input operation, you will add code to the Click event procedure of the Start command button. Similarly, to enable users to prevent the VTX controls from starting again, you will add code to the Click event procedure of the Stop command button. Finally, to let users exit the application gracefully, you will add code to the Click event procedure of the Exit command button.
2-24 Creating Your First VTX Application
) is a
Write Code for the Start Button
The Start button lets users of this application decide when to run the Digital In process of the DAS control. To write the code for this button, follow these steps:
1. Double-click the command button captioned Start to display the code window for its Click event procedure.
The title bar of the code window shows
The Object field shows the Name of the selected control.
the filename for the form on which the control resides.
The Procedure field shows the name of the event procedure.
You will enter code between the Sub and End Sub statements. Note that if you are using Visual Basic 4.0, "Sub" is preceded b y "Priv ate’.
2. Click the blank line between Sub and End Sub.
3. Enter the following code between the Sub and End Sub statements:
x = frmMain.TextCtrl1.ClearInputs 'Clear data from Text control frmMain.TextCtrl1.ArmState = 0 'Wait For Control Connection frmMain.DASCtrl1.ArmState = 1 'Ignore Control Connection frmMain.cmdStart.Enabled = False 'Prevent additional mouse clicks frmMain.cmdStop.Enabled = True 'Enable Stop button frmMain.cmdStop.SetFocus 'Make the Stop button the default
As you enter the code, note that Visual Basic automatically adds color coding for comments (green) and reserved words such as SetFocus, True, or False (blue).
Write the Code 2-25
The first line of code clears any existing data from the data input connection point of the Text control by reading the ClearInputs property of the Text control.
The second line prepares the T e xt control to run once the D AS control has sent the data and control. The reason this line is needed will become clear when you enter the code for the Stop command button.
The third line starts the DAS control by setting its ArmState property to 1 - Ignore Control Connection. This setting lets the DAS control start immediately because the control has no data input connections.
The fourth line prevents the user of the application from clicking the Start button again while the VTX controls are running. If you omit this line of code, it is possible for multiple mouse clicks to generate an error.
The fifth line enables the Stop button, which you disabled when setting the properties for the command buttons.
The last line of the code uses the Visual Basic SetFocus method to make the Stop button the default button. In Visual Basic, this means that the button is highlighted (a dark border) and can receive a mouse click.
4. Check the lines of code in your window against the lines of code shown below to ensure that the line breaks are correct.
5. From the File menu in Visual Basic, select Save Project.
2-26 Creating Your First VTX Application
Write Code for the Stop Button
The Stop button lets users of this application prevent the DAS and Text control processes from starting again until the Start button is clicked. To add the code for the Stop button, follow these steps:
1. From the code window in Visual Basic, click the down arrow next to the Object field. Click cmdStop to display the Click event procedure for the Stop command button. If you previously closed the code window, double-click the Stop command button on the form to display the code window.
1. Click this down arrow to display the list of objects on the form.
2. Click cmdStop to select it and display its Click event procedure.
2. Click the blank line between Sub and End Sub.
3. Enter the following code between the Sub and End Sub statements:
frmMain.TextCtrl1.ArmState = 2 'Put Text control on hold frmMain.DASCtrl1.ArmState = 2 'Put DAS control on hold frmMain.cmdStop.Enabled = False 'Disable the Stop button frmMain.cmdStart.Enabled = True 'Enable the Start button frmMain.cmdStart.SetFocus 'Make the Start button the default
The first two lines of code put the Text and DAS controls on hold (ArmState set to 2 - Hold), which prevents them from running again until the Start button is clicked.
Write the Code 2-27
4. Check the lines of code against the lines shown below to ensure that the line breaks are correct.
5. From the File menu in Visual Basic, select Save Project.
Next, you will enter the code for the Exit button (only one line).
Write Code for the Exit Button
The Exit button lets users of this application exit the program with all processes stopped. The standard Visual Basic End statement is used for this purpose.
To add the code for the Exit button, follow these steps:
1. From the Visual Basic code window, click the down arrow next to the Object field to display the list of objects on the form.
2. Click cmdExit to select the button and display its Click event procedure.
If you previously closed the code window, double-click the command button captioned Exit on the form to display the code window.
2-28 Creating Your First VTX Application
1. Click this down arrow to display the list of objects on the form.
2. Click cmdExit to select it and display its Click event procedure
3. In the code window, click the line between the Sub and End Sub statements.
4. Enter the following statement:
End 'Stop all processes and exit the program
5. From the File menu in Visual Basic, select Save Project.
6. Double-click the icon in the top left corner of the code window to close it.
Double-click here to close the code window.
That’s all the code required for this application. Now you can run the application, as described in the next section.
Write the Code 2-29
Run the Application
To run this application, follow these steps:
1. Select Start from the Run menu.
The run-time view of the form appears.
1
2. To read the data point, click the Start button on the form. After the DAS control reads the data point, the Text control displays the value.
3. To re-activate the Start button, click the Stop button.
4. Repeat steps 2 and 3 to see the different data points that the DAS-Demo Device generates for the Digital In process.
5. To exit the program, click the Exit button.
That’s all that’s required to build a simple application with Visual Basic and VTX software.
2-30 Creating Your First VTX Application
What’s Next
Now that you’ve experimented with a simple VTX application, refer to Chapter 3, "VTX System Overview," for more details on how the VTX software works.
Chapter 4, "Building an Application with VTX," provides additional detail on creating applications with VTX controls and Visual Basic. You may want to refer to the chapter as you build your own, more complex applications.
For assistance while you work in Visual Basic, you can select a VTX control and press
to display the VTX help for the VTX control. You
F1
can also select a VTX property in the Properties window or More Properties window and press
F1 to display help for the property
(context-sensitive help). For properties that you can use in code, each property help topic provides a code example. Context-sensitive help is also available for VTX events; to access the help, select the event in the code window and press
F1. For VTX functions, use the Search button in
the button bar at the top of the help window.
You may also want to refer to the example programs that accompany your VTX software. The example programs fall into two categories:
Building blocks — These simple applications use two or three VTX
controls to perform simple tasks, such as graphing analog input data in a line chart. These examples use Visual Basic command buttons to let users of the application decide when to run the tasks.
Complex examples — The more complex examples use a
combination of three or more VTX controls with standard Visual Basic controls to illustrate how to design a user interface that lets users of the application set the parameters for operations that the VTX controls perform, such as an analog input operation.
The complex example programs hav e corresponding icons in the Keithle y VTX program window; you can double-click the icons to open the projects and Visual Basic. The building block applications do not have icons in the window. You can access all VTX example programs by using the Open Project option in the File menu of Visual Basic. By default, the project files for the example programs are located in the
What’s Next 2-31
VTX\EXAMPLES directory. You can copy and paste code from these programs if the code suits your needs.
For brief descriptions of the building block example programs, click the Examples help icon (yellow question mark) in the Keithle y VTX program window . This help file and the example topics are also accessible from the main menu of the VTX system overview help.
You can find more code examples in the online help. The help topic for each VTX control property or function pro vides a code example. You can copy the code from the Examples window and paste it into your Visual Basic application.
2-32 Creating Your First VTX Application
3
Understanding the VTX System
This chapter presents the basic concepts of the VTX system and describes the software tools that the system provides. You have already seen some of these concepts at work in the tutorial in Chapter 2. Before building complex applications, ensure that you understand all of the concepts presented here.
Note:
the Computation, Frequency , Statistics, and Graph controls may not apply to your VTX system.
Depending on the VTX modules you purchased, the references to
The VTX Environment
VTX is a system of software tools that enables you to build complete data acquisition applications through Visual Basic for Windows. These tools include an integrated set of custom controls; when placed on a Visual Basic form, VTX controls can pass data and program control among one another without requiring any code. To enable the controls to communicate in this way, the VTX software tools also include the ability to draw connections (or wires ) between VTX controls.
The integration of the VTX controls creates the VTX environment , where you can develop applications according to your data acquisition needs. You can quickly put together simple applications using VTX controls and connections only . For e xample, you can acquire temperature and pressure data, and display or graph that data immediately; your development can remain entirely within the VTX environment.
The VTX Environment 3-1
For complex applications, the VTX environment is open and completely compatible with Visual Basic. You can easily transfer data and program control to and from VTX, using standard Visual Basic programming techniques. Complex applications sometimes require a custom user interface that is supported by data acquisition, error checking, analysis, and graphing tasks.
You can develop the supporting tasks (data acquisition, error checking, analysis) for a complex application within the VTX en vironment and then use a combination of the following controls to develop the user interface:
VTX Graph control
VTX T e xt control
Standard Visual Basic controls, such as the command button
Third-party custom controls developed for use with Visual Basic
T o integrate the tasks in the VTX environment with the user interface, you can set properties and pass program control in the appropriate code modules of the standard Visual Basic and VTX controls. As illustrated in the tutorial in Chapter 2, you can use the Click event procedure of a command button to start an operation that you have configured with a VTX control.
To pass data between the VTX environment and your instruments, you can use the VTX DAS and CTM controls with your Keithley MetraByte data acquisition hardware. The DAS and CTM controls open the VTX environment to your test and measurement hardware by communicating with your data acquisition hardware. See the online help for details on using the DAS and CTM controls.
To pass data between the VTX environment and the Visual Basic environment, you can use the VTX Transfer control. The Transfer control opens the VTX environment for passing data between VTX and Visual Basic arrays, binary DOS files, and W indo ws spreadsheets. See the online help for details on using the Transfer control.
3-2 Understanding the VTX System
Processes and Process Sources
VTX controls can perform a variety of operations, including data acquisition, line chart, strip chart, data display, computation, conversion, statistical, Boolean logic, filtering, and Fast Fourier Transform operations. In the VTX environment, these operations are called
processes . The hardware and software resources installed in your
computer that perform these operations are called process sources .
For example, the DAS control provides four processes that correspond to the following types of data acquisition operations:
Analog input operations (Analog In process)
Analog output operations (Analog Out process) Digital input operations (Digital In process)
Digital output operations (Digital Out process)
Similarly, the CTM control provides three processes that correspond to the types of operations that counter/timer boards can perform:
Counter/Timer process, for running event counting, frequency
measurement, and pulse generation operations Digital In and Digital Out processes for running single-point digital
input and single-point digital output operations
The process sources for the DAS and CTM controls include the Keithley MetraByte hardware and software installed in your computer, such as a DAS-1802HC board and its related software dri v er or a CTM-05/A board and its related software driver.
Processes and Process Sources 3-3
Table 3-1 summarizes by module the VTX controls, their processes, and process sources.
Table 3-1. VTX Controls, Processes, and Process Sources
VTX Module VTX Control Processes Process Sources
1
DAS Base
Counter/Timer (CTM)
Counter/Timer Digital In Digital Out
DAS Analog In
Analog Out Digital In Digital Out
Data Selection
Switch Transpose
Logic AND
OR
Text Grid
Scalar
Transfer DDE
Disk VB Array
Counter/Timer hardware from Keithley MetraByte
Pseudo DAS Device (alias for the DAS-Demo Device, useful for simulating data acquisition operations)
DAS hardware
2
and
related software drivers KM_Data
KM_Logic
KM_Text
KM_Xfer
2
Analysis
Computation Arithmetic
KM_Comp Comparison Conversion Curve Fit Trig Wave Gen
Frequency FFT
KM_Freq Filtering Inverse FFT Windowing
3-4 Understanding the VTX System
Table 3-1. VTX Controls, Processes, and Process Sources (cont.)
VTX Module VTX Control Processes Process Sources
1
Analysis
(continued)
Graph
Notes
1
The KM_xxx process sources are the software modules provided by Keithley MetraByte with
the VTX system.
2
Consult Keithley MetraByte for a list of supported hardware.
Statistics Max
Mean Min Std Deviation Variance
Graph Bar Chart
Line Chart Strip Chart
KM_Stat
KM_Graph
While the Computation control provides a Conversion process that can convert analog input data into engineering units that are useful to your application, the DAS control can also convert analog input data into engineering units. The Engineering Units window of the VTX Configuration utility lets you set up conversions that you want the DAS control to perform. See “Specifying Engineering Units” on page 1-12 for details on using this window.
The next section describes the controls and other VTX software tools in more detail. For complete details on the VTX controls, see the online help.
Overview of VTX Tools
VTX software tools consist of the VTX Configuration utility, a set of integrated custom controls, and the ability to draw connections (wires) between controls. This section describes these tools based on the module in which the tools are packaged. For complete details on these tools, see the online help.
Overview of VTX Tools 3-5
The DAS Base Module provides the following software tools:
CTM Control — Lets you set up and run counter/timer operations
such as event counting, frequency measurement, and pulse generation with counter/timer hardware such as the Keithley MetraByte CTM-05/A and CTM-10 boards. The CTM control lets you synchronize the start of one to five counter/timer operations. In addition, the CTM control supports single-point digital input and digital output operations.
DAS Control — Lets you set up and run data acquisition operations (analog input, analog output, digital input, and digital output). For analog input operations, the DAS control can also convert analog input data into engineering units that are useful to your application. For digital I/O operations, the DAS control also provides a bit mask that lets you control the valid numerical range and interpretation of digital input data and the interpretation of digital output data.
Data Control — Lets you manipulate data within the VTX environment. You can select subsets of data or transpose data sets and data elements. The Switch process lets you route data within the VTX environment from one source to multiple destinations or from multiple sources to one destination.
Logic Control — Lets you conduct Boolean AND and OR operations based on program control events in the VTX environment. The OR process sends out the number of the input connection point that caused the Logic control to run; you can use that information with other VTX controls.
Text Control — Lets you display, create, and modify data within the
VTX environment. As you have seen in Chapter 2, the Text control Scalar process provides a text-box-like display for single data points. The Grid process provides a spreadsheet-like display for data sets with one or more data elements.
Transfer Control— Lets you move data between the VTX environment and Visual Basic arrays, binary DOS files, or Windows spreadsheets.
Connections— Enable VTX controls to pass program control and data among one another. See the section “Program Control in the VTX Environment” on page 3-16 and the online help for more information.
3-6 Understanding the VTX System
VTX Configuration Utility — Provides the following configuration
windows: – DAS Hardware - Lets you register and configure the Keithley
MetraByte hardware you want to use with the DAS and CTM controls. Also for specifying the equations or sensors (engineering units) to use in converting data during analog input operations. See “Preparing to Use Boards with VTX Software” on page 1-6 or the online help for instructions on using this utility.
Keithley Memory Manager - Lets you allocate system memory
when using the VTX system to build data acquisition applications. See “Reserving Memory” on page 1-15 or the online help for details.
VTX Options - Lets you specify options for the VTX
programming environment. See “Enabling and Disabling VTX Options” on page 4-41 or the online help for instructions.
DAS-Demo Device— Lets you simulate data acquisition operations
for the DAS control. You can build an application without installing a DAS board and simulate the data acquisition part of the application with the DAS-Demo Device. In the Properties window, the DAS-Demo Device is listed by its alias, Pseudo DAS Device.
The Analysis Module provides the following additional custom controls:
Computation control - For generating waveforms and performing a
variety of mathematical operations on data passed from other VTX controls, including arithmetic, comparison, conversion, curve fitting, trigonometry, and waveform generation.
Frequency control - For performing Fast Fourier Transform (FFT),
Inverse FFT, filtering, and windowing operations on data passed from other VTX controls.
Statistics control - For calculating maximum, minimum, mean,
standard deviation, and variance values on data passed from other VTX controls.
The Graph Module provides the Graph control. The Graph control lets you create line or scatter charts, strip charts, and bar charts using data passed from other VTX controls.
Overview of VTX Tools 3-7
Properties of VTX Controls
In using the tutorial in Chapter 2, you saw that VTX controls have two sets of properties: those in the Properties window and those in the More Properties window. The properties available in the Properties windo w are common to all VTX controls and include some standard Visual Basic properties; these properties are referred to as control properties. The properties available in the More Properties window are specific to the operation as specified with the VTX ProcessSrc (process source) and Process properties in the Properties window; these properties are referred to as operation-specific properties. The following subsections describe these two sets of properties in more detail.
Control Properties
Every VTX control has the same set of control properties that appear in the Properties window. Control properties include standard Visual Basic properties such as BackColor, Caption, ForeColor, Name, TabIndex, T abStop, Tag, and T op, as well as properties specific to the VTX controls. VTX controls have some additional control properties that are available only at run time.
Figure 3-1 shows an example of the Properties window for the DAS control as it appears in Visual Basic 3.0; in Visual Basic 4.0, the window does not have the Settings Box at the top. In Figure 3-1, the arrows point to properties that are specific to VTX controls. All other properties are standard Visual Basic properties that appear for the VTX controls.
Note:
ForeColor, T abInde x, and TabStop, determine the appearance or operation of a control at run time. The VTX Text control uses these properties at run time. However, all other VTX controls ignore these properties.
Certain standard Visual Basic properties, such as BackColor,
3-8 Understanding the VTX System
Object box
Settings box
The arrows point to VTX-specific properties and their default settings. All other properties are standard Visual Basic properties.
Figure 3-1. Properties Window for the DAS Control (Visual Basic 3.0)
Properties of VTX Controls 3-9
Table 3-2 briefly describes the control properties that are common to all VTX controls, including those that are available only at run time (and therefore do not appear in the Properties window). For complete details on these properties, see the online help.
Table 3-2. Properties Common to all VTX Controls
Availability
1
Property Description
Design
TIme
Run
Time
(More) Displays the More Properties window. R N/A About Displays a dialog box containing information about the
R N/A
VTX control. ArmState Specifies when a control runs its configured process. R/W R/W ClearInputs Clears any control and data input connections to the
N/A R control. Returns a True if connections were cleared or False if no connections were cleared.
CtlConnection Specifies what happens when the VTX control receives
R/W R
control at the top control input connection point.
CtlVersion Returns the current revision level of the control. R R Halt Stops a VTX control. Returns the status of the control
N/A R immediately before the Halt (active or inactive).
hCtl Returns the instance of the control. Use this property with
N/A R VTX functions.
Process Specifies the operation that the control performs. R/W R ProcessSrc Specifies the hardware or software resource installed in
R/W R
the computer that performs the selected process.
Status Returns the current status of the control (active or
N/A R inactive).
Notes
1
R = The property is read-only.
R/W = The property is read and write. N/A = The property is not available.
3-10 Understanding the VTX System
Operation-Specific Properties
Operation-specific properties of VTX controls appear in the More Properties window. When you first access the More Properties window, the set of properties available is based on the choices you made for the ProcessSrc and Process properties.
Figure 3-2 shows the More Properties window for the DAS control as it appears when a DAS-1801ST board is the selected process source and an Analog In process is the selected process. Note that the More Properties window resembles the Visual Basic 3.0 Properties window in appearance whether you are using Visual Basic 3.0 or Visual 4.0. In addition, you use the More Properties window in the same ways you use the Visual Basic
3.0 Properties window.
Settings Box
List of VTX operation-specific properties and their default settings
Figure 3-2. More Properties Window for the DAS Control
The list of properties and the settings available for the properties in the More Properties window change based on the process source and process selected in the Properties window. To see how changes to the ProcessSrc property affects the More Properties window, compare Figure 3-2 with Figure 3-3 on page 3-12.
Properties of VTX Controls 3-11
The list of properties available for the same process is significantly shorter for the new process source.
The default setting for the OpMode property has changed for the new process source.
Figure 3-3. Effects of Changing the Process Source on the More Properties Window
In Figure 3-2, the properties listed and their available settings are based on the selection of the DAS-1801ST board as the process source and Analog In as the process. In Figure 3-4, the ProcessSrc property has been changed to Pseudo DAS De vice (the D AS-Demo Device) and the Process property remains set to Analog In. The change in the process source reduces the set of properties available for the Analog In process because not all properties are available for all process sources or for all processes. For example, the AboutTrig property is no longer available. In addition, the OpMode property default setting is Synchronous instead of DMA.
Similarly , suppose you change the Process property setting to Digital Out for either process source. The DataConvType and DataType properties would disappear from the More Properties window because they do not apply to a Digital Out process.
The choices you make for the properties in the More Properties window can also affect the av ailability of properties. In Figure 3-2, the list of More Properties for an Analog In process on a DAS-1801ST board includes the TrigSrc property. However, the TrigChan, TrigHyst, TrigLevel, and TrigPol properties are not available because the default value for TrigSrc is Internal.
3-12 Understanding the VTX System
When you change the setting of TrigSrc to Analog, the TrigChan, TrigHyst, TrigLevel, and TrigPol properties become available, as shown in Figure 3-4. Note that because the DAS-1800 Series boards support edge sensitivity only, the TrigSensitivity property is not available; edge sensitivity is assumed.
These four properties become available when TrigSrc is set to Analog
Figure 3-4. Effects of Changing Property Values in the More Properties Window
Notes:
If a property does not appear in the More Properties window, that property may not be supported by the process source or process. Use the Select Board and Board Specifics buttons in the online help for the DAS control to determine which properties are available for your board.
At design time, the settings selected for properties in the More Properties window of the DAS control are retained when you change the process source, as long as the settings are valid for the new process source . If the settings are not valid for the new process source, the DAS control resets the properties to their default settings.
You cannot change a process source at run time for any VTX control.
Properties of VTX Controls 3-13
Source and Destination Controls
Each VTX control can perform different types of processes. However, a VTX control can perform only one process at a time. When its process completes, the control can pass the resulting data and/or program control to another VTX control.
Because the VTX controls pass data and/or program control, the VTX controls serve as source and destination controls in the VTX en vironment. The control that sends data and/or program control is the source control. The control that receives data and/or program control is the destination control. For example, in Figure 3-5, DASCtrl1 is the source control and XferCtrl1 is the destination control.
Source control Destination control
Figure 3-5. Source and Destination Controls
A source control can send program control and data to one or more destination controls. Similarly, a destination control can receive program control and data from one or more source controls. Each VTX control can serve as both source and destination.
3-14 Understanding the VTX System
For example, in Figure 3-6, three DAS controls are source controls for DataCtrl1. DataCtrl1 is both a destination control (for the DAS controls) and a source control for XferCtrl1. XferCtrl1 is a destination control for DataCtrl1.
Destination for DAS controls and source for Transfer control
Source controls
Destination control
Figure 3-6. Multiple Source Controls to a Single Destination Control
The following subsections describe how program control and data are handled in the VTX environment.
Source and Destination Controls 3-15
Program Control in the VTX Environment
Setting up program control for an application generally refers to specifying the order in which the tasks in an application are performed. In the VTX environment, each VTX process is a task that the application performs, and program control is referred to as simply control . T o specify the order in which tasks are performed in your VTX application, you set up the VTX controls to pass control from a source control to a destination control.
In the VTX environment, control tells the destination control to start its configured process. Depending on the requirements of the application, VTX controls can pass control only or they can pass control with data. Note that VTX controls always pass control when passing data. Control passes from a source control to a destination control through a control
connection . In the VTX environment, a connection is a line (or wire ) that
you draw between the controls. See “Connections” on page 3-20 for more information.
The VTX Logic control pro vides an additional way to specify the order of tasks of an application. With the Logic control, you can perform Boolean operations (OR and AND) based on control passed from source controls to the Logic control. For example, based on the completion of one of three DAS processes (OR), you can send data to a VTX Graph control for plotting or to a VTX Text control for display in a grid. The Logic control can determine which of the three DAS processes completed; you might want to use that information to display a title for the graph or grid.
The VTX Data control provides an additional way to specify the flow of data in an application. Using the Switch process of the Data control, you can route data from one source control to multiple destination controls or from multiple source controls to one destination control.
Data in the VTX Environment
In the VTX environment, you can specify the flow of data between VTX controls. Certain VTX processes let you pass data into and out from the VTX environment. This section describes the structure of data in the VTX environment as well as moving data within, to, and from the VTX environment.
3-16 Understanding the VTX System
Defining the Structure of Data in the VTX Environment
The following terms describe data as it exists in the VTX environment:
Data element - a single unit of data, such as a voltage value or a pH
value
Data set - a collection of data elements, such as a set of voltages read at one-second intervals
Data or data group - a collection of data sets, such as a data set of
voltages and another data set of pH values
A data group represented as a Visual Basic array takes the form (number
of data elements , number of data sets) . The data group can consist of
single data set with a single element. For example, a single sample
(data point) read from a specified channel during a single-point analog input operation creates a single data set (channel) that contains a single element (the sample read).
A
A single data set containing multiple elements. For example, the samples from one analog input channel form a single data set (channel) with multiple elements (samples).
Multiple data sets, where each data set contains one element. For
example, you use the Maximum process of the Statistics control to determine the highest reading for each of four analog input channels. The result of the process consists of four data sets (channels), each containing one element (the highest reading).
Multiple data sets, where each data set contains multiple elements and
all have the same number of elements. For example, 1000 samples read from four analog input channels result in four data sets (channels), each containing 1000 elements (samples).
Figure 3-7 shows an example of a data group that contains four data sets; each data set contains two data elements.
Data Group
Data Set 1 Data Set 2 Data Set 3 Data Set 4
Data Element 1 Data Element 1 Data Element 1 Data Element 1 Data Element 2 Data Element 2 Data Element 2 Data Element 2
Figure 3-7. Example of a Data Group in the VTX Environment
Source and Destination Controls 3-17
Moving Data between VTX Controls
VTX controls send and receive data within the VTX environment in the combinations of data sets and data elements (single set, single element; single set, multiple elements, and multiple sets, multiple elements). VTX source controls can send only one data group at a time. However, source controls can send the same data group to multiple destination controls; similarly , VTX destination controls can recei ve data groups from multiple source controls.
When a VTX control receives data groups from multiple sources, that control merges the data sets from all the data groups into a single data group. This operation is called data set appending. Because the VTX control appends data sets, each data set in all the incoming data groups must have the same number of data elements.
Note, howev er, that the Line Chart process of the VTX Graph control can accept data groups whose data sets contain different numbers of elements. For example, suppose you want to acquire analog input data from two different instruments and graph the data from both instruments in the same line chart. This application requires two D AS controls (one for each analog input operation) and one Graph control. At run time, one analog input operation acquires 100 samples from two channels; the other operation acquires 200 samples from two channels. The data group resulting from the first analog input operation contains two data sets (two channels), each with 100 data elements (samples). The data group resulting from the second analog input operation contains two data sets (two channels), each with 200 data elements (samples). You can send these two data groups to the Graph control for display in the same line chart because the Line Chart process can accept data groups whose data sets contain different numbers of elements.
The Text control lets you create, display, and modify data in scalar, vector, and matrix format within the VTX environment. In addition, any VTX control that produces output data can pass that data in the appropriate format (scalar, vector, or matrix) within the VTX environment.
However, if you pass data out from the VTX environment to a Visual Basic array with the Transfer control, you must always declare a two-dimensional Visual Basic array to receive the data, whether the data is a single value (scalar), a single data set with multiple values, multiple
3-18 Understanding the VTX System
data sets with one value, or multiple data sets with multiple values. Declare the array using the format (number of data elements, number of data sets).
For example, to pass a data group that contains 100 samples from each of five analog input channels, declare the Visual Basic array using Option Base (0), as follows:
Dim AnalogInData (99, 4) As Double
Moving Data to and from the VTX Environment
The DAS, CTM, and Transfer controls can pass data to and from the VTX environment as well as to other VTX controls. Figure 3-8 illustrates this concept using the DAS and Transfer controls.
1. The DAS board reads data from the instruments and passes it into the VTX environment through the VTX DAS control (Analog In process).
2. Within the VTX environment, the DAS control maps channels to data sets and samples to data elements and, in this example, passes the data to the Transfer control.
3. The VTX Transfer control maps data as appropriate for the destination and then passes the data out from the VTX environment.
Instruments
DAS board
VTX Environment
Data is passed to a Visual Basic array, binary file, or Windows spreadsheet
Figure 3-8. Example of Moving Data to and from the VTX Environment
Source and Destination Controls 3-19
Connections
In Figure 3-8, the DAS control brings data from the DAS board into the VTX environment using an Analog In process; the T ransfer control passes the data out from the VTX en vironment. The opposite is also possible: the Transfer control can bring data into the VTX environment and the DAS control can pass data out from the VTX environment to the DAS board (through an Analog Out or Digital Out process).
Before transferring data into the VTX environment, the DAS, Transfer, and CTM controls map the data to data element and data set combinations. For example, the DAS control maps channels to data sets and samples to data elements. Before transferring data out from the VTX environment, the DAS, Transfer, and CTM controls map the data element and data set combinations as appropriate to the destination. For example, the DAS control treats the data elements in each data set as the samples to write from the specified output channels.
Other data processing within each VTX control depends on the process you select and on the choices you make for the properties associated with the selected process. See the online help for each VTX control to learn more about data in the VTX environment.
A connection in the VTX en vironment is a line that you dra w from a VTX source control to a VTX destination control. When you dra w connections, you enable the VTX controls to pass data and/or start the next process automatically, without code.
The tutorial in Chapter 2 showed you how to draw a connection between two VTX controls on the same form. You can use the same technique to draw connections between VTX controls that are on different forms (called interform connections) or to draw multiple connections to or from a VTX control. For example, if you want to pass data to more than one VTX control, you can draw multiple connections from the same control. Or, if you want a VTX process to use data from multiple sources, you can make multiple connections to the same VTX control. When making multiple connections to the same control, you can specify the order in which the connections are processed and thereby the order in which the data is processed.
3-20 Understanding the VTX System
Before using these features, however, you should understand the types of connections and connection points available in the VTX environment. The following subsections describe the connection types, connection points, and interform connections. See the section “Connecting VTX Controls” beginning on page 4-6 for step-by-step instructions on using the additional features.
Connection Types
Two types of connections exist:
Data - Notifies a destination control that it may begin its configured
process and that data is available for use in that process.
Control - Notifies a destination control that it may begin its
configured process.
The style of the line (wire) that represents the connection shows you whether it is a data connection (solid line) or a control connection (dashed line). When selected, connections change color (from black to blue) and are surrounded by a grey shadow. Figure 3-9 shows the two types of connections. The following two connections in Figure 3-9 are selected:
The control connection between XferCtrl1 and XferCtrl2
The data connection between XferCtrl2 and DAS Ctrl2
Data connection (not selected)
Control connection (selected)
Connection points
Sizing handles
Figure 3-9. Types of Connections
Connections 3-21
Each data connection passes a single data group from a source VTX control to a destination VTX control. Note that because the data connection also carries control, you do not draw both a data connection and a control connection between a source control and a destination control. For example, in Figure 3-9, the data connection between the D AS control (DASCtrl1) and the first Transfer control (XferCtrl1) passes control as well as data. The VTX software does not allow you to draw a control connection between these two controls.
Connection Points
In Figure 3-9, the connections are drawn between rectangles attached to the left and right sides of the VTX controls. These rectangles are called connection points. The connection points on the left side of a control are the input connection points and those on the right are the output connection points.
Data and control always pass from an output connection point to an input connection point, never the reverse. Therefore, when drawing connections, always start at the output connection point and drag the cursor to the input connection point.
In Figure 3-9, the second Transfer control (XferCtrl2) is selected to illustrate the slight difference between the connection points of a VTX control and the sizing handles of a selected control. The sizing handles around XferCtrl2 in Figure 3-9 overlap its input and output connection points. Note that connection points are always visible at design time; sizing handles appear only when you select the control.
Connection points and connections enable data and/or program control to pass from one VTX control to another. Thus, input and output connection points are also called by the two connection type labels, data and control. Each VTX control has two or more of the following types of connection points:
data input
control input
data output
control output
3-22 Understanding the VTX System
Figure 3-10 illustrates the control input, data input, and data output connection points as they appear when you select the Arithmetic process of the Computation control.
Control input connection point
Data input connection points
Figure 3-10. Examples of Connection Points
Every VTX control has at least one control input connection point and at least one control or data output connection point when you drop it on the form. Depending on the process and property selections you make, a control can have additional input and/or output connection points.
Data output connection point
The top control input connection point of every VTX control has a property associated with it, called CtlConnection. The two settings of this property let you specify what happens when control input arrives at this connection point:
Control Only — The control starts its configured process as soon as
the conditions of all data input connections are met.
Clear + Control — The control clears all of its input connections and
connection points in preparation for the process and then starts its configured process as soon as the conditions of all data input connections are met.
Connections 3-23
To distinguish it from other control connection points, the outline of the top control input connection point is darker than the outline of any other control connection points. Figure 3-11 illustrates this difference using the VTX Logic control, which is set up to run an OR process. For the Logic control, the additional control input connection points are referred to as logic input connection points.
Top Control Input Connection Point
Other Control (Logic) Input Connection Points
Data Output Connection Point
Figure 3-11. VTX Logic Control Connection Points
The Data, CTM, and Computation controls can each have multiple output connection points:
The Data control has only data output connection points. When you
select the Switch process in One-to-Many mode, the Data control has multiple data output connection points.
The CTM control can have a combination of data and control output
connection points. The number and type of output connection points depend on the number and type of counter/timer operations you select.
The Computation control can also have a combination of data and
control output connection points. The number and type of output connection points depend on the process selected; the Comparison and Curve Fit processes have multiple output connection points.
Figure 3-12 shows the Data, CTM, and Computation controls with multiple output connection points.
3-24 Understanding the VTX System
With the Curve Fit process selected, the Computation control has two data output connection points.
The maximum number of outputs for the Switch process of the Data control in One-to-Many mode is 8, as shown here. The number of inputs depends on the source of the data.
For this CTM control, the first four operations are EventCount (data output connection points) and the fifth operation is Pulse Gen (control output connection point).
With the Comparison process selected, the Computation control has one control output connection point and two data output connection points.
Figure 3-12. Data, CTM, and Computation Control Output Connection Points
Multiple Connections
Connection points can have multiple connections, which are either control or data, depending on the control and the process selected. When you select a destination control that has multiple connections to one of its input connection points, numbers appear on the connections near the source control. The numbers indicate the order in which you drew the connections and, more importantly, the order in which the destination control processes the data and/or control connections.
Figure 3-13 shows three data connections to the data input connection point on DataCtrl1. The Data control is selected so that you can see the order in which the Data control will process the connections. A single data connection exists between DataCtrl1 and XferCtrl1. In this example, the DAS controls bring data in from instruments, and the Data control
Connections 3-25
Loading...