Tektronix Using Keithley DriverLINX with KPCI-3160 (650KB) User manual

Keithley KPCI-3160 Series
Information in this document is subject to change without notice. The software described is this document is furnished under a license agreement. The software may be used or copied only in accordance with the terms of the agreement.
SCIENTIFIC SOFTWARE TOOLS, INC. SHALL NOT BE LIABLE FOR ANY SPECIAL, INCIDENTAL, 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.
This document may not, in whole or in part, be copied, photocopied, reproduced, translated or reduced to any electronic medium or machine readable form without prior written consent from Scientific Software Tools, Inc.
Keithley KPCI-3160 Series: Using DriverLINX with your Hardware Copyright 1999, 2001, Scientific Software Tools, Inc. All rights reserved.
SST 30-0200-1
DriverLINX, SSTNET, and LabOBJX are registered trademarks and DriverLINX/VB is a trademark of Scientific Software Tools, Inc. All Keithley product names are trademarks or registered of Keithley Instruments, Inc. Microsoft and Windows are registered trademarks and Visual C++ and Visual Basic are trademarks of Microsoft Corporation. Borland is a registered trademark and Borland C++ and Delphi are trademarks of Borland International, Inc. All other brand and product names are trademarks or registered trademarks of their respective companies.
2
Contents
Preface 7
About DriverLINX.....................................................................................................................7
About This User’s Guide...........................................................................................................7
Conventions Used in This Manual.............................................................................................9
Configuring the KPCI-3160 Series 11
Introduction..............................................................................................................................11
Configure DriverLINX Device Dialog.....................................................................................11
Programming the KPCI-3160 Series 23
Selecting an API.......................................................................................................................23
Installing an API......................................................................................................................25
Programming an API................................................................................................................28
Device Subsystem Page.............................................................................................13
Digital Input Subsystem Page....................................................................................15
Digital Output Subsystem Page .................................................................................20
Choosing DriverLINX...............................................................................................23
Choosing Hardware Direct I/O..................................................................................24
Choosing ActiveX Direct I/O....................................................................................25
Installing DriverLINX...............................................................................................26
Installing the Hardware Direct I/O Interface..............................................................26
Installing the ActiveX Direct I/O Interface................................................................27
Programming DriverLINX......................................................................................... 28
Programming the Hardware Direct I/O Interface.......................................................28
Programming the ActiveX Direct I/O Interface.........................................................28
Accessing KPCI-3160 Features using DriverLINX 33
Introduction..............................................................................................................................33
KPCI-3160 Hardware Features................................................................................................34
Differences Between the PCI and ISA Models........................................................................35
Using DriverLINX with the KPCI-3160 Series 39
Introduction..............................................................................................................................39
DriverLINX Hardware Model for the KPCI-3160...................................................................39
DriverLINX Subsystems............................................................................................39
DriverLINX Modes ...................................................................................................40
DriverLINX Operations and Events..........................................................................41
Logical Channels.......................................................................................................42
Buffers.......................................................................................................................42
Connecting Signals to the KPCI-3160.....................................................................................43
Digital Input Subsystem Signals................................................................................43
Using DriverLINX With Your Hardware Contents 3
Digital Output Subsystem Signals..............................................................................44
Counter/Timer Subsystem Signals.............................................................................44
Using the Device Subsystem 47
Introduction ..............................................................................................................................47
Device Modes ..........................................................................................................................48
Device Operations .............................................................................................................. ......48
Using the Digital Input Subsystem 49
Introduction ..............................................................................................................................49
Digital Input Modes .................................................................................................................50
Digital Input Operations...........................................................................................................50
Digital Port Configuration .........................................................................................51
Digital Input Timing Events.....................................................................................................52
None or Null Event....................................................................................................52
Rate Event..................................................................................................................53
Rate Generator: External Clocking............................................................................53
Digital Event..............................................................................................................54
Digital Input Start Events.........................................................................................................55
None or Null Event....................................................................................................55
Command Event.........................................................................................................55
Post-Trigger Sampling with a Digital Event..............................................................55
Digital Input Stop Events.........................................................................................................56
None or Null Event....................................................................................................57
Command Event.........................................................................................................57
Terminal Count Event................................................................................................57
Pre-Trigger Sampling with a Digital Event................................................................57
Digital Input Channels..............................................................................................................58
Digital Input Logical Channels..................................................................................60
Single Channel Digital Input......................................................................................61
Multi-channel Digital Input Range.............................................................................61
Multi-channel Digital Input List.................................................................................62
Extended Logical Channel Addressing......................................................................63
Bit-Masked Addressing..............................................................................................64
Digital Input Buffers................................................................................................................64
Digital Input Messages.............................................................................................................65
Using the Digital Output Subsystem 67
Introduction ..............................................................................................................................67
Digital Output Modes...............................................................................................................68
Digital Output Operations........................................................................................................68
Digital Port Configuration .........................................................................................69
Digital Output Timing Events..................................................................................................70
None or Null Event....................................................................................................70
Rate Event..................................................................................................................71
Rate Generator: External Clocking............................................................................71
Digital Event..............................................................................................................72
Digital Output Start Events......................................................................................................73
None or Null Event....................................................................................................73
Command Event.........................................................................................................73
Post-Trigger Sampling with a Digital Event..............................................................73
Digital Output Stop Events.......................................................................................................74
4 Contents Using DriverLINX With Your Hardware
None or Null Event ....................................................................................................75
Command Event.........................................................................................................75
Terminal Count Event................................................................................................75
Pre-Trigger Sampling with a Digital Event................................................................75
Digital Output Channels...........................................................................................................76
Digital Output Logical Channels ...............................................................................77
Single Channel Digital Output...................................................................................77
Multi-channel Digital Output Range..........................................................................78
Multi-channel Digital Output List..............................................................................79
Extended Logical Channel Addressing......................................................................80
Bit-Masked Addressing .............................................................................................81
Digital Output Buffers..............................................................................................................81
Digital Output Messages..........................................................................................................82
Using the Counter/Timer Subsystem 83
Introduction..............................................................................................................................83
Counter/Timer Channels..........................................................................................................83
Pacer Clock................................................................................................................83
Counter/Timer Messages..........................................................................................................84
Uninstalling DriverLINX 85
How do I uninstall DriverLINX? .............................................................................................85
Troubleshooting 89
Solving Problems.....................................................................................................................89
Solving Problems Recognizing and Installing Drivers...............................................89
Solving Problems Configuring the Drivers................................................................91
Solving Problems Loading Drivers............................................................................91
Generating a DriverLINX Configuration Report .....................................................................93
What is in the Report? ...............................................................................................94
How do I Generate the Report?.................................................................................94
Glossary of Terms 95
Using DriverLINX With Your Hardware Contents 5
Preface
About DriverLINX
Welcome to DriverLINX for Microsoft Windows, the high-performance real-
time data-acquisition device drivers for Windows application development.
DriverLINX is a language- and hardware-independent appli cation-programming
interface designed to support hardware manufacturers’ high-speed analog, digital,
and counter/timer data-acquisition boards in Windows. DriverLINX is a multi-user
and multitasking data-acquisition resource manager providing more than 100 services
for foreground and background data acquisition tasks.
Included with your DriverLINX package are the following items:
The DriverLINX API DLLs and drivers supporting your data-
acquisition hardware
AIO Panel, multifunction instrument for testing analog and digital I/O
features of your Keithley hardware
Source code for the sample programs
The DriverLINX Application Programming Interface files for your
compiler
DriverLINX On-line Help System
DriverLINX Digital I/O Programming Guide
DriverLINX Technical Reference Manual
Supplemental Documentation on DriverLINX and your data acquisition
hardware
About This User’s Guide
The purpose of this manual is to help you quickly learn how to configure and use t he
hardware features of Keithley’s KPCI-3160 board with DriverLINX.
For help installing and configuring your hardware and Dr iverLINX,
please see the manual that accompanied your hardware.
Using DriverLINX With Your Hardware Preface 7
For more information on the DriverLINX API, please see the
DriverLINX Technical Reference Manual and the DriverLINX Digital I/O Programming Guide.
For additional help programming your board, please examine the source
code examples on the Distribution Media.
This manual contains the following chapters: Configuring the KPCI-3160 Describes configuring the KPCI-3160 using the Configure DriverLINX Device dialog
box.
Programming KPCI-3160 Hardware
Describes the available programming options for the KPCI-3160 Series.
Accessing KPCI-3160 Features Using DriverLINX
Describes how DriverLINX supports hardware features of the KPCI-3160 Series. Using DriverLINX with the KPCI-3160 Series Describes the subsystems, modes, and operations that DriverLINX supports for the
KPCI-3160 Series.
Using the Device Subsystem
Describes using DriverLINX to initialize KPCI-3160 hardware.
Using the Digital Input Subsystem
Describes using DriverLINX to perform KPCI-3160 digital input.
Using the Digital Output Subsystem
Shows using DriverLINX to perform KPCI-3160 digital output.
Using the Counter/Timer Subsystem
Describes DriverLINX’s support for timing operations with the KPCI-3160 Series.
Uninstalling DriverLINX
Describes ho w to remove DriverLIN X from your computer.
Troubleshooting
Describes potential installation and configuration problems and their solutions.
8 Preface Using DriverLINX With Your Hardware
Conventions Used in This Manual
The following notational conventions are used in this manual:
Itemized lists are identified by a round bullet (•).
Numbered lists indicate a step-by-step procedure.
DriverLINX Application Programming Interface and Windows macro
and function names are set in bold when mentioned in the text.
DriverLINX indicates the exported function name of the device driver
DLL while DriverLINX indicates the product as a whole.
DriverLINX Application Programming Interface identifiers, menu
items, and Dialog Box names are italicized when mentioned in the text.
Italics are used for emphasis.
Source code and data structure examples are displayed in Courier
typeface and bounded by a box with a single line.
Code
Tables of information are bounded by a box with a double line.
Tables
Concept
Important concepts and notes are printed in the left margin.
Using DriverLINX With Your Hardware Preface 9
Configuring the KPCI-3160 Series
Introduction
The DriverLINX Installation and Configuration Guide provides detailed instructions
for installing and configuring DriverLINX for any Keithley data-acquisition product.
This manual explains the steps and special features that apply only to Keithley’s
KPCI-3160 Series boards.
Installing and configuring DriverLINX for the Keithley KPCI-3160 board requires
three steps:
1. To install DriverLINX, insert the DriverLINX CD-ROM into your
drive and follow the on-screen instructions.
2. To install your KPCI-3160 hardware, read and follow the
instructions in the Keithley KPCI-3160 PCI Bus Digital I/O Board
User’s Manual.
3. To configure DriverLINX, use the DriverLINX Configuration Panel
and consult the on-line help. Also see “Configure DriverLINX Device
Dialog” on page 11 for configuration options specific to a Keithley KPCI-3160 board.
Configure DriverLINX Device Dialog
DriverLINX uses a standardized configuration protocol for all data-acquisition
hardware. Even though Windows automatically assigns r esources for the K PCI-3160,
you must still follow the configuration process to assign a DriverLINX Logical
Device number to the board and configure board-specific features.
When you click the C
DriverLINX displays the Configure DriverLINX Device dialog. The following
sections describe your choices for configuring DriverLINX to work with the Keithley
KPCI-3160 model.
onfigure button in the DriverLINX Configuration Panel,
Using DriverLINX With Your Hardware Configuring the KPCI-3160 Series 11
12 Configuring the KPCI-3160 Series Using DriverLINX With Your Hardware
Device Subsystem Page
Use the Device Subsystem page to tell DriverLINX the Model and Board Id of your
KPCI-3160 board. This page also shows the Vendor and Device number and
provides the Special… button to access the Walking-Bit Test dialog.
Vendor
The Vendor property displays “Keithley Instruments, Inc.” It is a read-only property.
Device
The Device property designates the number, or “name,” of the Logical Device you
are configuri ng. It is a read-only property. To change it, fi rst save (OK) or quit
(Cancel) the current configuration. Then rename the Logical Device using the
DriverLINX Configuration Panel.
Model
The Model property selects the hardware model of the board you’re configuring. This
driver supports only model KPCI-3160.
Windows 95
Windows 95 automatically determines the model of your board so DriverLINX
disables Model selection.
Windows NT
Select your board’s model from the list.
Board Id
The Board Id property associates this Logical Device with a specific board.
DriverLINX automatically enters the KPCI-3160’s serial number in this field.
DriverLINX use s the board’s ser ial number to uniquely recognize boards if you have
installed multiple boards of the same model into your computer.
Windows 95
Using DriverLINX With Your Hardware Configuring the KPCI-3160 Series 13
Windows 95 automatically determines which board to associate with this Logical Device. DriverLINX enters the serial number of the board when it starts the configuration.
Windows NT
Under Windows NT, Board Id is initially blank. DriverLINX will use the Model to match this Logical Device to the first available board and then enter that board’s
serial number.
Detect
The Detect property enables and disables DriverLINX’s hardware detection and testing algorithms. For maximum system reliability, always leave this check box marked.
Special…
The Special… button displays a hardware test dialog. DriverLINX can perform a Walking-Bit Test when it next loads this Logical Device. The Walking-Bit Test checks your KPCI-3160 board for internal input/output line damage.
To perform the Walking-Bit Test:
1. Enable the test using the check box.
2. Make sure that Detect is checked on the Device Subsystem Page (see page 13).
3. Remove the cable from your board.
4. Restart your computer.
½ If the driver finds a damaged line, it makes an entry in the Event Log
and does not load the Logical Device.
½ If the test passes, the driver loads the Logical Device and clears the
check box so the test does not run again.
Important: You must remove the cable from your board for a successful test.
14 Configuring the KPCI-3160 Series Using DriverLINX With Your Hardware
Digital Input Subsystem Page
Use the Digital Input Subsystem page to tell DriverLINX the Configuration Setup of the KPCI-3160’s digital input/output channels. You can also use this page to view the
Channel number and Range of each digital input channel. By default, the hardware configures all digital input/output channels as input ports in
unlatched mode. You can use this page to change the initial configuration of selected channels to output, and, on the KPCI-3160, change input channels to latched mode.
Note: Applications can change a channel’s configuration dynamically; See “Digital Port
Configuration” on page 51.
Channels
The Channels propert y allows you to select a Logi cal Channel for configuring or viewing the channel’s range. Only the digital input/output channels support programmable configuration. The KPCI-3160 has External Clock and External Trigger channels that have fixed, input configurations. See “Digital Input Subsystem Signals” on page 43 for a list of channels for your board.
Range
The Range property specifies the digital range for the selected Logical Channel. This is a read-only property.
Interrupt
Windows automatically determines the interrupt channel, if any, for the KPCI-3160 board. DriverLINX disables this property.
DMA level
The KPCI-3160 does not use system DMA channels. DriverLINX disables this property and displays it as blank.
Using DriverLINX With Your Hardware Configuring the KPCI-3160 Series 15
Configuration Setup
Use caution when configuring and connecting lines to the digital I/O ports. Connecting an incorrect voltage or sourcing/sinking too much current could damage the hardware.
The Configuration S digital I/O port as input or output. The KPCI-3160 also allows configuration of input ports as latched (strobed mode) or unlatched (basic mode).
Unlatched (Basic mode)—Supports simple input/output without control
Latched (Strobed mode)—Supports input/output with an external
DriverLINX supports two methods for statically configuring a digital I/O port.
The simplified method configures all the digital I/O lines of a port for
The advanced method allows you to configure groups of digital I/O
etup property allows you to statically configure each KPCI-3160
or status signals. Outputs are latched and inputs are unlatched. Unlatched inputs return the state of the input lines at the time the software reads the digital input port.
control signal. Inputs and outputs are latched. The latched inputs return the state of the input lines at the time of a strobe signal on the INT_REQ line. The default active edge, or polarity, of the strobe signal is the rising edge. Dynamic reconfiguratio n using a Dio Setup event c an change the active edge to either rising or falling. (See “Dynamically Configuring KPCI-3160 Digital Ports” on page 51.)
input or output in basic mode.
lines for input or output in either basic or strobed mode.
Simplified Digital I/O Port Configuration
For simplified configuration of all lines in a port as either input or output:
1. Select the channel number of the port to configure in the drop-down channel list.
2. Check the Initialize box.
3. Enter one of the following values for the S the entire port as input or output in basic mode:
1—configures all lines in the port as input (unlatched), or
0—configures all lines in the port as output.
etup property to configure
Advanced Digital I/O Port Configuration
With advanced configuration, you can set a port’s mode as basic or strobed or configure nibbles of selected ports as input or output.
Mode Configuration The KPCI-3160 port architecture emulates four Intel 8254-style digital I/O chips.
The 96 I/O lines of the KPCI-3160 consist of four groups of 24 lines. Each group consists of three addressable 8-bit ports, referred to as Ports A, B, and C. Ports A and B of each group are configurable as all input or output. The upper and lower halves (4 bits) of each Port C are individually configurable as inputs or outputs.
Model KPCI-3160 supports two mode settings: basic and strobed (see, “Simplified Digital I/O Port Configuration” above). Unlike the Intel 8254, the KPCI-3160 mode setting applies to all ports in a group. In strobed mode, the KPCI-3160 supports selectable latching on either the rising or falling edge at INT_REQ.
16 Configuring the KPCI-3160 Series Using DriverLINX With Your Hardware
Notes:
Only Port A accepts a mode setup. For Port C nibble direction setup,
see Input/Output Configuration” below.
On the KPCI-3160, all ports in a group operate in the same mode.
To configure the KPCI-3160 ports using mode settings:
1. Select the Port A channel (0, 3, 6, or 9) to configure in the drop-down
channel list.
2. Check the Initialize box.
3. Enter a Setup value in the following format:
KPCI-3160 Mode Configuration
0 M M 0 0
MSB
Mode
Direction
Mode Field
00 = Mode 0 (Basic)
D
LSB
Basic mode supports simple input/output without control or
status signals. Outputs are latched and inputs are unlatched. Unlatched inputs return the state of the input lines at the time the software reads them.
01 = Mode 1 (Strobed, rising-edge strobe)
Strobed mode supports input/output with an external rising-edge input-latching signal. Inputs a nd outputs are latched. The latched inputs return the state of the input lines at the time of a strobe signal on the INT_REQ line.
10 = Mode 2 (Basic)
This is the same mode as Mode 0. Basic mode supports simple input/output without control or status signals. Outputs are latched and inputs are unlatched. Unlatched inputs return the state of the input lines at the time the software reads them.
11 = Mode 3 (Strobed, falling-edge strobe)
Strobed mode supports input/output with an external falling-edge input-latching signal. Inputs and outputs are latched. The latched inputs return the state of the input lines at the time of a strobe signal on the INT_REQ line.
Direction Field
0—configures the port for output
1—configures the port for input
Input/Output Configuration
Using DriverLINX With Your Hardware Configuring the KPCI-3160 Series 17
To configure the KPCI-3160 Port C channel nibbles individually:
1. Select the Port C channel (2, 5, 8, 11) to configure in the drop-down channel list.
2. Check the Initialize box.
3. Enter a Setup value in the following format:
Nibble Configuration Format
1 D
MSB
Upper Nibble Direction
Lower Nibble Direction
Direction Fields
0—configures the nibble for output
1—configures the nibble for input
Advanced Configuration Example: This example shows how to configure channel 2 in nibbles. It configures the lower
nibble as output and the upper nibble as input.
1. Select the channel 2 in the drop-down channel list.
2. Check the Initialize box.
3. Choose the Nibble Configuration format and fill in the Direction fields, right-to-left, as follows:
0—to configure the lower nibble as output
D
LSB
1—to configure the upper nibble as input
1
1 0
2. Calculate the hexadecimal or decimal value:
0x4 + 0x2 + 0x0 = 0x6 4 + 2 + 0 = 6
3. Then, enter 0x6 (hexadecimal) or 6 (decimal) for the S
18 Configuring the KPCI-3160 Series Using DriverLINX With Your Hardware
etup property.
Initialize
Checking the Initialize check box instructs DriverLINX to use the Configuration S
etup property to configure the digital I/O ports. Check Initialize to put the
configuration setup into effect.
Dec
This check box converts the Configuration Setup property to decimal.
Hex
This check box converts the Configuration Setup property to hexadecimal.
Using DriverLINX With Your Hardware Configuring the KPCI-3160 Series 19
Digital Output Subsystem Page
Use the Digital Output subsystem page to change the default digital output port initialization values.
Channels
The Channels property allows you to select a Logical Channel for initialization or
viewing the channel’s range. KPCI-3160 models have twelve digital input/output ports. The Digital Output subsystem shares these ports with the Digital Input subsystem. The KPCI-3160 requires configuration of each port in the digital input/output ports as input or output. See “Digital Input Subsystem Page” on page 15.
Range
The Range property specifies the supported digital output range for the selected Logical Channel. This is a read-only property.
Interrupt
Windows automatically determines the interrupt channel for the KPCI-3160 Series board. DriverLINX disables this property.
DMA level
The KPCI-3160 does not use system DMA channels. DriverLINX disables this property and displays it as blank.
Initialization Value
The Initialization Value property specifies the digital output value DriverLINX will write to the selected Logical Channel on hardware initialization. DriverLINX only writes this value if you enable the In the hardware-defined initialization values if the In For the KPCI-3160, the default digital output value is zero.
itialize check box. By default, DriverLINX uses
itialize check box is not checked.
Initialize
Checking the Initialize check box instructs DriverLINX to use the Initialization V
alue property, rather than the default value, for digital output port initialization.
20 Configuring the KPCI-3160 Series Using DriverLINX With Your Hardware
Dec
This check box converts the Initialization Value property to decimal.
Hex
This check box converts the Initialization Value property to hexadecimal.
Using DriverLINX With Your Hardware Configuring the KPCI-3160 Series 21
Programming the KPCI-3160 Series
Selecting an API
The KPCI-3160 Series supports three different device driver interfaces to best match your programming needs. The supported driver interfaces are
DriverLINX—An interface that is hardware and operating system
independent and supports multitasking, multithreading applications.
Hardware Direct I/O—An interface for Win 95/98, or Win NT/2K
with a special direct I/O driver that supports single-tasking, single­threaded access directly to the KPCI-3160 I/O hardware registers.
ActiveX Direct I/O—An interface that is operating system independent
and supports single-tasking, single-threaded access to an Intel 8255-like function call interface.
Keithley recommends the using the DriverLINX interface for maximum portability and versatility, but the other interfaces are useful in special circumstances. Please review the following sections on the advantages and disadvantages of each interface.
Choosing DriverLINX
Keithley highly recommends selecting the DriverLINX interface for your applications. The DriverLINX interface has the following advantages:
Hardware independence—DriverLINX supports ISA, PCMCIA, and
PCI digital I/O boards with a common interface as well as digital ports on analog I/O and counter/timer boards.
Operating system independence—DriverLINX supports Windows
95/98 and Windows NT/2K with a common interface.
Shared hardware access—DriverLINX allows multiple processes or
threads to cooperatively share hardware resources.
Multitasking, multithreading support—DriverLINX provides the
synchronization and coordination for multitasking, multithreading applications to safely access shared hardware resources.
Using DriverLINX With Your Hardware Programming the KPCI-3160 Series 23
Portability—DriverLINX supports older and newer hardware with a
common interface for 32-bit applications on Windows 95/98 and Windows NT.
Versatility—DriverLINX supports a wide variety of programming styles and languages including C/C++, Visual Basi c, Delphi, and LabVIEW.
Background I/O—DriverLINX supports background I/O using interrupts or other techniques so your application can overlap processing and data acquisition.
Full hardware support—DriverLINX supports all the hardware’s features.
The DriverLINX interface has a few disadvantages compared to the alternative interfaces:
Software modifications—Existing applications will require rewriting to use DriverLINX.
No direct hardware access—Before Windows NT, Microsoft discouraged, but nevertheless allowed, direct application program access to hardware.
Nibble configurationConfigurations of Port C with one input nibble and one output nibble require the use of the Configure DriverLINX Device dialog and cannot be performed by applications.
Speed of single-value I/O—Applications, especially those ported from DOS, that depend on rapid software polling of I/O ports will notice that the operating system time cost for multitasking, multithreading synchronization is higher than direct hardware access.
While writing your application to use a multi-product, portable API is the best long­term solution, you should consider the alternative APIs only for special purpose or short-term needs.
Choosing Hardwar e Direct I/O
The Direct Hardware I/O Interface simulates the hardware behavior of Intel 8255­based products, such as the PIO24 and PIO96, on the KPCI-3160 Series. This interface has the following advantages:
Direct I/O support—This interface supports existing applications that write directly to the digital I/O’s hardware registers using the x86 CPU’s inp and outp instructions.
Intel 8255 emulation—This interface simulates the I/O address map and a subset of the programming protocols of Intel’s 8255 chip.
Fast hardware access—This interface provides the fastest possible access to the hardware registers.
MS-DOS window support—This interface will host 16- and 32-bit console applications running in a n MS-DOS window.
The Hardware Direct I/O Interface has a few, significant disadvantages:
Win 9x only—The Hardware Direct I/O Interface only runs on Windows 95/98. Windows NT does not support direct I/O without
24 Programming the KPCI-3160 Series Using DriverLINX With Your Hardware
using a special port I/O driver available from Keithley’s Web site at www.keithley.com.
Non-exclusive hardware access—This interface does not synchronize
or coordinate hardware access among threads or processes.
Incompatible with DriverLINX—Applications cannot use this
interface with DriverLINX either in the same or another application.
Supports subset of hardware features—This interface does not
support using interrupts or newer KPCI-3160 hardware features not available with Intel 8255-based products.
Keithley does not recommend using this interface for developing new applications.
Choosing ActiveX Direct I/O
The ActiveX Direct I/O interface uses the methods of an ActiveX Automation object to access the KPCI-3160 hardware. This interface has the following advantages:
Operating system independence—Both Windows 95/98 and
Windows NT support this interface.
Intel 8255 emulation—This interface simulates the I/O address map
and programming protocols of Intel’s 8255 chip.
Fast hardware access—This interface provides faster access to the
hardware registers than is available with the DriverLINX interface.
Versatility—Most W indows compilers and scr i pting languages support
ActiveX Automation objects.
Speed of single-value I/O—The I/O performance of this interface is
almost as fast as the Hardware Direct I/O interface when using early binding to the interface.
Board-relative addressing—This interface automatically determines
the actual hardware I/O address unlike the Hardware Direct I/O interface.
ISA digital I/O support—This interface also supports Keithley’s ISA
digital I/O products.
The ActiveX Direct I/O interface also has disadvantages:
Non-exclusive hardware access—This interface does not synchronize
or coordinate hardware access among threads or processes.
Incompatible with DriverLINX—Applications cannot use this
interface with DriverLINX either in the same or another application.
Supports subset of hardware features—This interface does not
support using interrupts.
ActiveX interface—Using Automation objects in some C++ compilers
is more difficult than in Visual Basic.
Installing an API
To install a KPCI-3160 programming interface, select one of the following topics for more information.
Using DriverLINX With Your Hardware Programming the KPCI-3160 Series 25
Installing DriverLINX
The normal installation process automatically installs both the DriverLINX and Hardware Direct I/O APIs. Follow the instructions in the DriverLINX CD installer.
Installing the Hardware Direct I/O Interface
To use the Hardware Direct I/O interface, you do not need to install a product­specific driver, but you must determine the I/O address that the operating system assigned to the KPCI-3160.
Determining the KPCI-3160 I/O Address
Windows automatically selects an available I/O address for the KPCI-3160. If you wish to check this address,
1. From Windows Control Panel, click the System icon and then select the Device Manage r tab.
2. Click on the “+” next to DriverLINX drivers to expand the list of
installed drivers.
3. Click on the driver you want to inspect and then click Pr
operties.
26 Programming the KPCI-3160 Series Using DriverLINX With Your Hardware
4. Select the Resources tab to see the current I/O address assignment.
5. Note the 32-byte (20 hexadecimal) Input/Output Range. The base
address for the 16 bytes of 8255-compatible registers is the beginning of this range. In the example above, the base address is FF80.
6. Close the Device Manager windows.
Installing the ActiveX Direct I/O Interface
The normal installation process automatically installs both the DriverLINX and Direct I/O APIs. Follow the instructions in the DriverLINX CD installer.
Installing the ActiveX Direct I/O Driver
The normal DriverLINX installation automatically installs the ActiveX Direct I/O Driver. This driver is a registered ActiveX object that resides in KDigIO.DLL.
This driver requires that you install the DriverLINX kernel drivers as it uses their services. On Win NT, the kernel driver is KPCI3160.SYS. On Win 95/98, it is KPCI3160.VXD. Follow the normal DriverLINX installation and configuration procedures to install these kernel drivers.
Configuring the ActiveX Direct I/O Driver
The ActiveX Direct I/O Driver requires that you configure a DriverLINX Logical Device usi ng the DriverLINX Configuration Panel
Using DriverLINX With Your Hardware Programming the KPCI-3160 Series 27
Programming an API
To use a KPCI-3160 programming interface, select one of the following topics for more information.
Programming DriverLINX
The DriverLINX API is extensively documented in this manual and in the Digital I/O Programming Guide and the DriverLINX or DriverLINX/VB Technical Reference Manuals.
Programming the Hardware Direct I/O Interface
This interface uses only the x86 CPU instructions, inp and outp, for 8-bit I/O. See
“Determining the KPCI-3160 I/O Address” on page 26 to determine the I/O address range for the KPCI-3160.
Each Intel 8255 chip consists of three 8-bit I/O ports and an 8-bit control port. The three data ports are called Port A, B, and C and they reside at base address + 0, 1, 2, respectively. The KPCI-3160 has four 8255-type ports.
utility. The ActiveX Direct I/O driver does not require any separate configuration.
For more information on register-level programming for the KPCI-3160, see the KPCI-3160 PCI Digital I/O Board User’s Manual.
Keithley does not recommend this interface for new applications.
Programming the ActiveX Direct I/O Interface
The ActiveX Direct I/O Interface is an ActiveX Automation object hosting one interface. This control is compatible with Microsoft Visual C++ and Visual Basic as well as other ActiveX-hosting languages.
The methods of the control’s interface, IKDigitalIo, emulate the 8-bit port I/O behavior of an Intel 8255 chip. Consult an Intel hardware manual or the programming section of the KPCI-3160 PCI Digital I/O Board User’s Manual.
IKDigitalIo Intel 8255 Interface
The following syntax descriptions are shown in C/C++. For Visual Basic, use the
Object Browser to see the VB syntax. Also see “Using the ActiveX Direct I/O Driver in Visual Basic” on page 29.
HRESULT OpenDevice(BSTR Driver, long Device); Opens a digital I/O device. Driver is “KPCI3160” to open a KPCI-3160 board. Device is the DriverLINX Logical Device number of the KPCI-3160 board to open.
HRESULT CloseDevice(); Closes a previously opened KPCI-3160 device. The number of CloseDevice calls must match the number of OpenDevice calls.
28 Programming the KPCI-3160 Series Using DriverLINX With Your Hardware
HRESULT Read(short Offset, unsigned char * Result);
Reads an 8-bit value from the KPCI-3160 board. Offset is the value of the register to read relative the base I/O address. Result is the value read from the register.
HRESULT Write(short Offse t, unsigned char Va l ue);
Writes an 8-bit value to the KPCI-3160 board. Offset is the value of the register to write relative the base I/O address. Value is the output to write to the register.
HRESULT Op enCount(long *Count);
Returns the number of times a client has called OpenDevice for this Logical Device. Count is the address of the value for the result.
HRESULT Device(long *LogicalDevice);
Returns the Logical Device number if the device is open. Otherwise it returns –1.
LogicalDevice is the address of the value for the result.
HRESULT Driver(BSTR *Name);
Returns the DriverLINX class driver name if any device is open. Otherwise it returns an empty string. Name is the address of a string value for the result.
Using the ActiveX Direct I/O Driver in Visual Basic
The following instructions are for Version 5 of Microsoft Visual Basic. If you have a different version, please consult the Visual Basic documentation.
1. From VB’s “P
2. Scroll t hrough the “A
Digital I/O Library”.
roject” menu, select “References…”
vailable References”, looking for “Keithley
Using DriverLINX With Your Hardware Programming the KPCI-3160 Series 29
3. Check “Keithley Digital I/O Library” and then click OK.
4. From VB’s “V libraries.
5. Search for “KDIGIOLib”.
iew” menu, select “Object Browser” to display a list of
6. The Object Browser shows the VB syntax for the IKDigitalIo (see “IKDigitalIo Intel 8255 Interface” on page 28) class.
Creating a Simple Visual Basic Application
1. Create a Visual Basic form with the controls show above.
2. Add the following source code to declare, open, close, read, and write a device.
KPIO New KDigitalIo
cmdClose_Click() KPIO.CloseDevice
30 Programming the KPCI-3160 Series Using DriverLINX With Your Hardware
Loading...
+ 68 hidden pages