Tektronix KPXI Analog Output Module Reference manual

www.keithley.com
KPXI Analog Output Module
Reference Manual
KPXI-AO-901-01 Rev. A / January 2007
A GREATER MEASURE OF CONFIDENCE
ECA 42912

WARRANTY

Keithley Instruments, Inc. warrants this product to be free from defects in material and workmanship for a period of 1 year from date of shipment.
Keithley Instruments, Inc. warrants the following items for 90 days from the date of shipment: probes, cables, rechargeable batteries, diskettes, and documentation.
During the warranty period, we will, at our option, either repair or replace any product that proves to be defective.
To exercise this warranty, write or call your local Keithley Instruments representative, or contact Keithley Instruments headquarters in Cleveland, Ohio. You will be given prompt assistance and return instructions. Send the product, transportation prepaid, to the indicated service facility. Repairs will be made and the product returned, transportation prepaid. Repaired or replaced products are warranted for the balance of the original warranty period, or at least 90 days.
LIMITATION OF WARRANTY
This warranty does not apply to defects resulting from product modification without Keithley Instruments’ express written consent, or misuse of any product or part. This warranty also does not apply to fuses, software, non-rechargeable batteries, damage from battery leakage, or problems arising from normal wear or failure to follow instructions.
THIS WARRANTY IS IN LIEU OF ALL OTHER WARRANTIES, EXPRESSED OR IMPLIED, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. THE REMEDIES PROVIDED HEREIN ARE BUYER’S SOLE AND EXCLUSIVE REMEDIES.
NEITHER KEITHLEY INSTRUMENTS, INC. NOR ANY OF ITS EMPLOYEES SHALL BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF ITS INSTRUMENTS AND SOFTWARE EVEN IF KEITHLEY INSTRUMENTS, INC., HAS BEEN ADVISED IN ADVANCE OF THE POSSIBILITY OF SUCH DAMAGES. SUCH EXCLUDED DAMAGES SHALL INCLUDE, BUT ARE NOT LIMITED TO: COSTS OF REMOVAL AND INSTALLATION, LOSSES SUSTAINED AS THE RESULT OF INJURY TO ANY PERSON, OR DAMAGE TO PROPERTY.
A G R E A T E R M E A S U R E O F C O N F I D E N C E
Corporate Headquarters • 28775 Aurora Road • Cleveland, Ohio 44139
440-248-0400 • Fax: 440-248-6168 • 1-888-KEITHLEY (534-8453) • www.keithley.com
12/06
KPXI
Analog Output Module
Reference Manual
©2007, Keithley Instruments, Inc.
Document Number:
All rights reserved.
Cleveland, Ohio, U.S.A.
KPXI-AO-901-01 Rev. A / January 2007
Manual Print History KPXI Analog Output Module Reference Manual

Manual Print History

The print history shown below lists the printing dates of all Revisions and Addenda created for this manual. The Revision Level letter increases alphabetically as the manual undergoes subsequent updates. Addenda, which are released between Revisions, contain important change information that the user should incorporate immediately into the manual. Addenda are numbered sequentially. When a new Revision is created, all Addenda associated with the previous Revision of the manual are incorporated into the new Revision of the manual. Each new Revision includes a revised copy of this print history page.
Revision A (Document Number KPXI-AO-901-01) ............................................. January 2007
All Keithley Instruments product names are trademarks or registered trademarks of Keithley Instruments, Inc. Other brand names are trademarks or registered trademarks of their respective holders.
KPXI-AO-901-01 Rev. A / January 2007
The following safety precautions should be observed before using this product and any associated instrumentation. Although some instruments and accessories would normally be used with non-hazardous voltages, there are situations where hazardous conditions may be present.
This product is intended for use by qualified personnel who recognize shock hazards and are familiar with the safety precautions required to avoid possible injury. Read and follow all installation, operation, and maintenance information carefully before using the product. Refer to the manual for complete product specifications.
If the product is used in a manner not specified, the protection provided by the product may be impaired.
The types of product users are:
Responsible body is the individual or group responsible for the use and maintenance of equipment, for ensuring that the equipment is operated within its specifications and operating limits, and for ensuring that operators are adequately trained.
Operators use the product for its intended function. They must be trained in electrical safety procedures and proper use of the instrument. They must be protected from electric shock and contact with hazardous live circuits.
Maintenance personnel perform routine procedures on the product to keep it operating properly, for example, setting the line voltage or replacing consumable materials. Maintenance procedures are described in the manual. The procedures explicitly state if the operator may perform them. Otherwise, they should be performed only by service personnel.

Safety Precautions

Service personnel are trained to work on live circuits, and perform safe installations and repairs of products. Only properly
trained service personnel may perform installation and service procedures.
Keithley Instruments products are designed for use with electrical signals that are rated Measurement Category I and Measurement Category II, as described in the International Electrotechnical Commission (IEC) Standard IEC 60664. Most measurement, control, and data I/O signals are Measurement Category I and must not be directly connected to mains voltage or to voltage sources with high transient over-voltages. Measurement Category II connections require protection for high transient over-voltages often associated with local AC mains connections. Assume all measurement, control, and data I/O connections are for connection to Category I sources unless otherwise marked or described in the Manual.
Exercise extreme caution when a shock hazard is present. Lethal voltage may be present on cable connector jacks or test fixtures. The American National Standards Institute (ANSI) states that a shock hazard exists when voltage levels greater than 30V RMS, 42.4V peak, or 60VDC are present. A good safety practice is to expect that hazardous voltage is present in any unknown circuit before measuring.
Operators of this product must be protected from electric shock at all times. The responsible body must ensure that operators are prevented access and/or insulated from every connection point. In some cases, connections must be exposed to potential human contact. Product operators in these circumstances must be trained to protect themselves from the risk of electric shock. If the circuit is capable of operating at or above 1000 volts, no conductive part of the circuit may be exposed.
Do not connect switching cards directly to unlimited power circuits. They are intended to be used with impedance limited sources. NEVER connect switching cards directly to AC mains. When connecting sources to switching cards, install protective devices to limit fault current and voltage to the card.
Before operating an instrument, make sure the line cord is connected to a properly grounded power receptacle. Inspect the connecting cables, test leads, and jumpers for possible wear, cracks, or breaks before each use.
12/06
When installing equipment where access to the main power cord is restricted, such as rack mounting, a separate main input power disconnect device must be provided, in close proximity to the equipment and within easy reach of the operator.
For maximum safety, do not touch the product, test cables, or any other instruments while power is applied to the circuit under test. ALWAYS remove power from the entire test system and discharge any capacitors before: connecting or disconnecting cables or jumpers, installing or removing switching cards, or making internal changes, such as installing or removing jumpers.
Do not touch any object that could provide a current path to the common side of the circuit under test or power line (earth) ground. Always make measurements with dry hands while standing on a dry, insulated surface capable of withstanding the voltage being measured.
The instrument and accessories must be used in accordance with its specifications and operating instructions or the safety of the equipment may be impaired.
Do not exceed the maximum signal levels of the instruments and accessories, as defined in the specifications and operating information, and as shown on the instrument or test fixture panels, or switching card.
When fuses are used in a product, replace with same type and rating for continued protection against fire hazard.
Chassis connections must only be used as shield connections for measuring circuits, NOT as safety earth ground connections.
If you are using a test fixture, keep the lid closed while power is applied to the device under test. Safe operation requires the use of a lid interlock.
If a screw is present, connect it to safety earth ground using the wire recommended in the user documentation.
!
The symbol on an instrument indicates that the user should refer to the operating instructions located in the manual.
The symbol on an instrument shows that it can source or measure 1000 volts or more, including the combined effect of normal and common mode voltages. Use standard safety precautions to avoid personal contact with these voltages.
The symbol on an instrument shows that the surface may be hot. Avoid personal contact to prevent burns.
The symbol indicates a connection terminal to the equipment frame.
The WARNING heading in a manual explains dangers that might result in personal injury or death. Always read the associated information very carefully before performing the indicated procedure.
The CAUTION heading in a manual explains hazards that could damage the instrument. Such damage may invalidate the warranty.
Instrumentation and accessories shall not be connected to humans.
Before performing any maintenance, disconnect the line cord and all test cables.
To maintain protection from electric shock and fire, replacement components in mains circuits, including the power transformer, test leads, and input jacks, must be purchased from Keithley Instruments. Standard fuses, with applicable national safety approvals, may be used if the rating and type are the same. Other components that are not safety related may be purchased from other suppliers as long as they are equivalent to the original component. (Note that selected parts should be purchased only through Keithley Instruments to maintain accuracy and functionality of the product.) If you are unsure about the applicability of a replacement component, call a Keithley Instruments office for information.
To clean an instrument, use a damp cloth or mild, water based cleaner. Clean the exterior of the instrument only. Do not apply cleaner directly to the instrument or allow liquids to enter or spill on the instrument. Products that consist of a circuit board with no case or chassis (e.g., data acquisition board for installation into a computer) should never require cleaning if handled according to instructions. If the board becomes contaminated and operation is affected, the board should be returned to the factory for proper cleaning/servicing.

Table of Contents

Section Topic Page
1 Introduction............................................................................................. 1-1
Introduction ................................................................................................. 1-2
Overview..................................................................................................... 1-2
Applications ................................................................................................ 1-2
Features...................................................................................................... 1-2
Manual addenda......................................................................................... 1-3
Safety symbols and terms .......................................................................... 1-3
Specifications.............................................................................................. 1-3
Unpacking and inspection........................................................................... 1-4
Inspection for damage.......................................................................... 1-4
Shipment contents ............................................................................... 1-4
Instruction manual................................................................................ 1-4
Repacking for shipment........................................................................ 1-4
Available accessories ................................................................................. 1-5
Connections................................................................................................ 1-5
Software introduction .................................................................................. 1-5
Programming library KDAQ-DRVR ...................................................... 1-5
KDAQ-LVIEW LabVIEW® driver .......................................................... 1-6
2 Installation............................................................................................... 2-1
Introduction ................................................................................................. 2-2
Handling precautions .................................................................................. 2-2
Mechanical drawing .................................................................................... 2-2
PCI configuration ........................................................................................ 2-2
Plug-and-Play....................................................................................... 2-2
Configuration........................................................................................ 2-3
Troubleshooting.................................................................................... 2-3
Installation................................................................................................... 2-3
3 Operation and connection................................................................... 3-1
Introduction ................................................................................................. 3-2
Signal connections...................................................................................... 3-3
Connectors pin assignment.................................................................. 3-3
A/D conversion ........................................................................................... 3-4
KPXI Analog Output Series A/D data format........................................ 3-5
Software polling mode.......................................................................... 3-5
Programmable scan mode ................................................................... 3-5
Trigger mode ........................................................................................ 3-7
Bus-mastering DMA data transfer........................................................ 3-9
D/A conversion ........................................................................................... 3-9
Architecture ........................................................................................ 3-10
Hardware controlled waveform generation ........................................ 3-10
Setting up the DACs........................................................................... 3-11
Utilizing multiplying characteristics of DACs ...................................... 3-11
Software update ................................................................................. 3-12
Waveform generation......................................................................... 3-12
Trigger modes .................................................................................... 3-14
Iterative waveform generation ............................................................ 3-15
Stop modes ........................................................................................ 3-16
Table of Contents KPXI Analog Output Module Reference Manual
Section Topic Page
3 Operation and connection (continued)
General purpose digital I/O ....................................................................... 3-18
General purpose timer/counter operation ................................................. 3-18
Timer/Counter functions basics .......................................................... 3-18
General purpose timer/counter modes............................................... 3-19
Trigger sources ......................................................................................... 3-21
Software trigger .................................................................................. 3-22
External analog trigger ....................................................................... 3-22
Timing signal............................................................................................. 3-24
System synchronization interface ....................................................... 3-25
Calibration ................................................................................................. 3-25
Auto-calibration................................................................................... 3-25
Saving calibration constants............................................................... 3-26
Loading calibration constants ............................................................. 3-26
4 Waveform Generation Demonstration .............................................. 4-1
Waveform generation demonstration .......................................................... 4-2
Appendix Topic Page
A KDAQ-DRVR User’s Guide.................................................................. A-1
Introduction to KDAQ-DRVR...................................................................... A-2
About the KDAQ-DRVR software ........................................................ A-2
KDAQ-DRVR hardware support .......................................................... A-2
KDAQ-DRVR language support .......................................................... A-2
Fundamentals of building applications with KDAQ-DRVR ......................... A-3
Microsoft® Visual Basic (Version 6.0) .................................................. A-3
Using Microsoft Visual Basic.NET ....................................................... A-4
Microsoft Visual C/C++........................................................................ A-4
KDAQ-DRVR utilities for Win32 ................................................................. A-5
KDAQ-DRVR configuration utility (configdrv) ...................................... A-5
KDAQ-DRVR data file converter utility (KiDAQCvt)............................. A-6
KDAQ-DRVR overview .............................................................................. A-6
General configuration function group .................................................. A-7
Analog input function group................................................................. A-7
Analog output function group............................................................. A-10
Digital input function group ................................................................ A-12
Digital output function group .............................................................. A-13
General timer/counter function group ................................................ A-13
DIO function group ............................................................................ A-13
SSI function group ............................................................................. A-14
Calibration function group.................................................................. A-14
KDAQ-DRVR application hints................................................................. A-15
Analog input programming hints ........................................................ A-16
Analog output programming hints ............................................................ A-36
One-shot analog output programming scheme ................................. A-36
Digital input programming hints ......................................................... A-50
Digital output programming hints....................................................... A-51
DAQ event message programming hints........................................... A-52
Continuous data transfer in KDAQ-DRVR ............................................... A-53
Continuous data transfer mechanism................................................ A-53
Double-buffered AI/AO operation ...................................................... A-53
Single-buffered versus double-buffered data transfer ....................... A-54
Pre-trigger mode/middle-trigger data acquisition (AI)........................ A-54
ii KPXI-AO-901-01 Rev. A / January 2007
KPXI Analog Output Module Reference Manual Table of Contents
Appendix Topic Page
B KDAQ-DRVR Function Reference ..................................................... B-1
Function description ................................................................................... B-2
Data types............................................................................................ B-2
Function reference............................................................................... B-2
Status Codes............................................................................................ B-94
AI range codes ......................................................................................... B-95
AI data format........................................................................................... B-97
DATA file format ....................................................................................... B-97
Header............................................................................................... B-98
ChannelRange................................................................................... B-99
Data Block ......................................................................................... B-99
C KIDAQ®-LabVIEW Compatible Interface Guide............................. C-1
Introduction to KIDAQ®-LabVIEW ............................................................. C-2
Overview.............................................................................................. C-2
Using KIDAQ LabVIEW VIs in LabVIEW............................................. C-2
KIDAQ LabVIEW Programming........................................................... C-3
Device Driver Handling .............................................................................. C-4
Windows XP/2000 Device Driver......................................................... C-4
Driver Utility ......................................................................................... C-4
KIDAQ Utilities ........................................................................................... C-4
KIDAQ Registry/Configuration utility.................................................... C-4
KIDAQ Device Browser ....................................................................... C-4
KIDAQ LabVIEW VIs Overview.................................................................. C-5
Analog Input VIs .................................................................................. C-6
Analog Output VIs................................................................................ C-6
Digital I/O VIs....................................................................................... C-7
Timer/Counter VIs................................................................................ C-7
Calibration and Configuration VIs ........................................................ C-8
Error Handler VI................................................................................... C-8
Distribution of Applications......................................................................... C-8
Windows XP/2000 ............................................................................... C-8
D KIDAQ®-LabVIEW Compatible Function Reference..................... D-1
Introduction ................................................................................................ D-2
Hardware support....................................................................................... D-2
KPXI-DIO series: ................................................................................. D-2
KPXI-DAQ series: ................................................................................ D-2
Digitizer series: .................................................................................... D-2
Analog input VIs......................................................................................... D-3
Easy analog input VIs.......................................................................... D-3
Intermediate analog input VIs.............................................................. D-7
Analog output VIs..................................................................................... D-21
Easy analog output VIs...................................................................... D-21
Intermediate analog output VIs.......................................................... D-24
Advanced analog output VIs.............................................................. D-32
Digital I/O VIs ........................................................................................... D-33
Easy Digital I/O VIs............................................................................ D-33
Intermediate Digital I/O VIs................................................................ D-37
Advanced Digital I/O VIs.................................................................... D-45
Counter VIs .............................................................................................. D-46
Easy Counter VIs .............................................................................. D-46
Intermediate Counter VIs .................................................................. D-50
Advanced Counter VIs ...................................................................... D-63
Calibration and Configuration VIs ............................................................ D-67
Calibration VIs .................................................................................. D-67
Other Calibration and Configuration VIs............................................ D-68
KPXI-AO-901-01 Rev. A / January 2007 iii
Table of Contents KPXI Analog Output Module Reference Manual
Appendix Topic Page
D KIDAQ®-LabVIEW Compatible Function Reference (continued)
Service VIs ............................................................................................... D-70
Error Codes ............................................................................................. D-71
AI Range Codes ...................................................................................... D-73
AI Data Format ....................................................................................... D-76
iv KPXI-AO-901-01 Rev. A / January 2007

List of Figures

Section Figure Title Page
1 Figure 1-1 Accessories configuration guide.................................................... 1-5
2 Figure 2-1 PCB layout of Model KPXI-AO-4-1M/Model KPXI-AO-8-1M ......... 2-2
Figure 2-2 Typical PXI module installation ...................................................... 2-4
Figure 2-3 Device manager (successful installation) ...................................... 2-5
3 Figure 3-1 Block diagram ................................................................................ 3-2
Figure 3-2 Connector pin assignment .......................................................... 3-3
Figure 3-3 Analog output series scan timing................................................... 3-6
Figure 3-4 Post trigger example...................................................................... 3-7
Figure 3-5 Trigger delay example ................................................................... 3-8
Figure 3-6 Post-trigger or delay-trigger acquisition with retrigger example..... 3-8
Figure 3-7 Scatter/gather DMA for data transfer............................................. 3-9
Figure 3-8 Block diagram of D/A group ......................................................... 3-10
Figure 3-9 Data format in FIFO and mapping ............................................... 3-11
Figure 3-10 Typical D/A timing of waveform generation ................................. 3-13
Figure 3-11 Post-trigger generation ................................................................ 3-14
Figure 3-12 Delay-trigger generation .............................................................. 3-15
Figure 3-13 Post-trigger with retrigger generation .......................................... 3-15
Figure 3-14 Finite iterative waveform generation with post-trigger ................. 3-16
Figure 3-15 Infinite iterative waveform generation with post-trigger ............... 3-16
Figure 3-16 Example mode I........................................................................... 3-17
Figure 3-17 Example mode II.......................................................................... 3-17
Figure 3-18 Example mode III......................................................................... 3-18
Figure 3-19 Mode 1 operation......................................................................... 3-19
Figure 3-20 Mode 2 operation......................................................................... 3-19
Figure 3-21 Mode 3 operation......................................................................... 3-20
Figure 3-22 Mode 4 operation......................................................................... 3-20
Figure 3-23 Mode 5 operation......................................................................... 3-20
Figure 3-24 Mode 6 operation......................................................................... 3-21
Figure 3-25 Mode 7 operation......................................................................... 3-21
Figure 3-26 Mode 8 operation......................................................................... 3-21
Figure 3-27 Analog trigger block diagram .................................................. 3-22
Figure 3-28 Below-low analog trigger condition .............................................. 3-23
Figure 3-29 Above-high analog trigger condition ............................................ 3-23
Figure 3-30 Inside-region analog trigger condition.......................................... 3-23
Figure 3-31 High-hysteresis analog trigger condition...................................... 3-24
Figure 3-32 Low-hysteresis analog trigger condition ...................................... 3-24
Figure 3-33 Routing of DAQ signals ............................................................... 3-25
List of Figures KPXI Analog Output Module Reference Manual
Appendix Figure Title Page
A Figure A-1 Open Project dialog box................................................................ A-3
Figure A-2 Driver Configuration window ......................................................... A-5
Figure A-3 KDAQ-DRVR application building blocks.................................... A-15
Figure A-4 Typical function flow for all types of KDAQ-DRVR series............ A-16
Figure A-5 Fills channel gain queue first....................................................... A-17
Figure A-6 Synchronous operation ............................................................... A-18
Figure A-7 Non-double buffered asynchronous operation............................ A-19
Figure A-8 Double buffered asynchronous operation ................................... A-20
Figure A-9 All types of KPXI-DRVR series ................................................... A-22
Figure A-10 Fills channel gain queue first....................................................... A-23
Figure A-11 All types of KDAQ-DRVR series ................................................. A-25
Figure A-12 Fills channel gain queue first....................................................... A-26
Figure A-13 All types of KDAQ-DRVR series ................................................. A-27
Figure A-14 Fills channel gain queue first....................................................... A-29
Figure A-15 All types of KDAQ-DRVR series ................................................. A-31
Figure A-16 Fills channel gain queue first....................................................... A-32
Figure A-17 All types of KDAQ-DRVR series ................................................. A-33
Figure A-18 Fills channel gain queue first....................................................... A-35
Figure A-19 One-shot analog output programming ........................................ A-37
Figure A-20 One-shot analog output programming ........................................ A-38
Figure A-21 Non-double-buffered asynchronous continuous
analog output programming ........................................................ A-39
Figure A-22 Non-double-buffered asynchronous continuous
analog output programming ........................................................ A-40
Figure A-23 Double-buffered asynchronous continuous analog
output programming .................................................................... A-41
Figure A-24 Double-buffered asynchronous continuous analog
output programming .................................................................... A-43
Figure A-25 Typical flow of asynchronous analog output operation ............... A-44
Figure A-26 Typical flow of asynchronous analog output operation ............... A-45
Figure A-27 Typical flow of double-buffered asynchronous
analog output operation .............................................................. A-47
Figure A-28 Typical flow of double-buffered asynchronous
analog output operation .............................................................. A-49
Figure A-29 One-shot digital input programming ............................................ A-50
Figure A-30 Typical flow of non-buffered single-point digital output operation A-51
Figure A-31 Double buffer mode principle ...................................................... A-53
B Figure B-1 Scan timing example................................................................... B-13
Figure B-2 Scan timing example................................................................... B-15
Figure B-3 Scan timing example................................................................... B-17
Figure B-4 Scan timing example................................................................... B-20
Figure B-5 Scan timing example................................................................... B-22
Figure B-6 Scan timing example................................................................... B-25
Figure B-7 Scan timing example................................................................... B-27
Figure B-8 Scan timing example................................................................... B-30
Figure B-9 DATA file format .......................................................................... B-98
Figure B-10 DAQ File Conversion Utility....................................................... B-100
C Figure C-1 Function Browser Options............................................................. C-2
Figure C-2 Functions palette........................................................................... C-3
Figure C-3 Keithley PXI Devices Explorer ...................................................... C-5
vi KPXI-AO-901-01 Rev. A / January 2007
KPXI Analog Output Module Reference Manual List of Figures
Appendix Figure Title Page
D Figure D-1 Analog input palette ...................................................................... D-3
Figure D-2 Analog output palette .................................................................. D-21
Figure D-3 Digital I/O palette......................................................................... D-33
KPXI-AO-901-01 Rev. A / January 2007 vii
List of Figures KPXI Analog Output Module Reference Manual
This page left blank intentionally.
viii KPXI-AO-901-01 Rev. A / January 2007

List of Tables

Section Table Title Page
3 Table 3-1 Connector pin assignment............................................................. 3-4
Table 3-2 Bipolar input range and converted digital codes............................ 3-5
Table 3-3 Unipolar input range and converted digital codes.......................... 3-5
Table 3-4 Summary of programmable scan counters.................................... 3-5
Table 3-5 Trigger modes and corresponding trigger sources ........................ 3-6
Table 3-6 D/A output versus digital codes ................................................... 3-11
Table 3-7 Trigger signals and corresponding signal sources....................... 3-12
Table 3-8 Summary of counters for waveform generation........................... 3-13
Table 3-9 Analog trigger SRC1(EXTATRIG) ideal transfer characteristics .. 3-22
4 Table 4-1 Various waveform samples............................................................ 4-2
Appendix Table Title Page
A Table A-1 Initial default channel configuration ............................................. A-18
Table A-2 Initial default AI configuration....................................................... A-18
Table A-3 Initial default channel configuration ............................................. A-38
Table A-4 Initial default DA configuration ..................................................... A-38
B Table B-1 Suggested data types .................................................................... B-2
Table B-2 Example trigger condition selection (KDAQ_AIO_Config) ........... B-46
Table B-3 Status codes returned by KDAQ-DRVR ...................................... B-94
Table B-4 Analog input range of digitizers ................................................... B-96
Table B-5 Valid values for each model......................................................... B-96
Table B-6 AI data format .............................................................................. B-97
Table B-7 Data file header ........................................................................... B-98
Table B-8 Data structure of ChannelRange unit (length: 2 bytes)................ B-99
D Table D-1 KI AI acquire waveform.................................................................. D-3
Table D-2 KI AI acquire waveforms................................................................ D-4
Table D-3 KI AI sample channel..................................................................... D-6
Table D-4 KI AI sample channels ................................................................... D-6
Table D-5 KI AI clear ...................................................................................... D-7
Table D-6 KI AI config .................................................................................... D-9
Table D-7 2-byte binary array....................................................................... D-12
Table D-8 Scaled and Binary Arrays ............................................................ D-14
Table D-9 Scaled Array ................................................................................ D-16
Table D-10 KI AI single scan .......................................................................... D-17
Table D-11 KI AI start ..................................................................................... D-19
Table D-12 KI AO generate waveform ........................................................... D-22
Table D-13 KI AO generate waveforms.......................................................... D-22
Table D-14 KI AO update channel.................................................................. D-23
Table D-15 KI AO update channels................................................................ D-24
Table D-16 KI AO clear .................................................................................. D-25
Table D-17 KI AO Config................................................................................ D-25
List of Tables KPXI Analog Output Module Reference Manual
Appendix Table Title Page
D Table D-18 KI AO start................................................................................... D-27
Table D-19 KI AO wait ................................................................................... D-28
Table D-20 KI AO write binary array.............................................................. D-29
Table D-21 KI AO write binary array scaled array ......................................... D-30
Table D-22 KI AO Trigger and Gate Config ................................................... D-32
Table D-23 KI Read from Digital Line ............................................................ D-34
Table D-24 KI Read from Digital Port ............................................................ D-34
Table D-25 KI Write to Digital Line................................................................. D-35
Table D-26 KI Write to Digital Port................................................................. D-36
Table D-27 KI DIO Clear................................................................................ D-37
Table D-28 KI DIO Config .............................................................................. D-38
Table D-29 KI DIO Read................................................................................ D-40
Table D-30 KI DIO Start................................................................................. D-42
Table D-31 KI DIO Write ................................................................................ D-43
Table D-32 KI DIO Port Config ...................................................................... D-45
Table D-33 KI Count Events or Time ............................................................. D-46
Table D-34 KI Generate Delayed Pulse......................................................... D-47
Table D-35 KI Generate Pulse-Train.............................................................. D-48
Table D-36 KI Measure Pulse-Width or Period.............................................. D-49
Table D-37 KI Continuous Pulse Generator Config ....................................... D-50
Table D-38 KI Counter Divider Config ........................................................... D-52
Table D-39 KI Counter Read ......................................................................... D-53
Table D-40 KI Counter Start........................................................................... D-54
Table D-41 KI Counter Stop........................................................................... D-55
Table D-42 KI Delayed Pulse Generator Config ............................................ D-56
Table D-43 KI Down Counter or Divider Config............................................. D-58
Table D-44 KI Event or Time Counter Config ................................................ D-59
Table D-45 KI Pulse-Width or Period Measurement Config .......................... D-61
Table D-46 KI UpDown Counter Config......................................................... D-62
Table D-47 KI ICTR Control........................................................................... D-63
Table D-48 KI KPXI-DAQ series devices and Digitizer Series Calibrate ...... D-67
Table D-49 KI Route Signal .......................................................................... D-68
Table D-50 KI SSI Control ............................................................................ D-69
Table D-51 KI Error Handler ......................................................................... D-70
Table D-52 Error Codes: KIDAQ LabVIEW VIs ............................................. D-71
Table D-53 Analog Input Range .................................................................... D-73
Table D-54 Valid analog input ranges (specified by module)......................... D-75
Table D-55 Analog Input data format (by Model)........................................... D-76
x KPXI-AO-901-01 Rev. A / January 2007
In this section:
Top ic Page
Introduction......................................................................................... 1-2
Overview .............................................................................................. 1-2
Applications........................................................................................ 1-2
Features ............................................................................................... 1-2
Manual addenda................................................................................. 1-3
Safety symbols and terms .............................................................. 1-3
Specifications..................................................................................... 1-3
Section 1
Introduction
Unpacking and inspection .............................................................. 1-4
Inspection for damage ...................................................................... 1-4
Shipment contents............................................................................ 1-4
Instruction manual ............................................................................ 1-4
Repacking for shipment.................................................................... 1-4
Available accessories....................................................................... 1-5
Connections........................................................................................ 1-5
Software introduction....................................................................... 1-5
Programming library KDAQ-DRVR................................................... 1-5
KDAQ-LVIEW LabVIEW® driver....................................................... 1-6
Section 1: Introduction KPXI Analog Output Module Reference Manual

Introduction

This manual is designed to help you understand and use KPXI Analog Output Series high-performance multi-function modules.
This section contains general information about the Keithley Instruments KPXI-AO-4-1M and KPXI-AO-8-1M. The information is organized as follows:
Overview
Applications
Features
Manual addenda
Safety symbols and terms
Specifications
Unpacking and inspection
Available accessories
Connections
Software introduction
If you have any questions after reviewing this information, please contact your local Keithley Instruments representative or call one of our Applications Engineers at 1-800-KEITHLEY. You can also contact us through our website at www.keithley.com.

Overview

Keithley Instruments’ KPXI Analog Output Series provides advanced analog output cards based on 32-bit PCI / PXI architecture (Peripheral Component Interconnect) / (PCI eXtensions for Instrumentation). The Model KPXI-AO-4-1M provides up to four analog output channels while the Model KPXI-AO-8-1M provides up to eight analog output channels.

Applications

High-performance designs and state-of-the-art technology make this card ideal for waveform generation, industrial process control, and signal-analysis applications in medical, process control, and other related fields. Specific applications are:
Automotive testing
Arbitrary waveform generator
Transient signal measurement
Laboratory automation
Biotech measurement

Features

Key features and benefits include:
32-bit PCI/PXI-Bus, plug and play
Up to 1MS/s analog output rate
Up to 400KS/s analog input rate
Output channels:
Programmable bipolar/unipolar range for analog input channels and individual analog
Model KPXI-AO-4-1M — Up to four analog output channels Model KPXI-AO-8-1M — Up to eight analog output channels
output channels
1-2 Return to Section Topics KPXI-AO-901-01 Rev. A / January 2007
KPXI Analog Output Module Reference Manual Section 1: Introduction
Programmable internal/external reference for individual analog output channels
D/A FIFO size (Digital to Analog First In First Out): Model KPXI-AO-4-1M — 8K samples Model KPXI-AO-8-1M — 16K samples
A/D FIFO (Analog to Digital) size (all models): 2K samples
Versatile trigger sources: software trigger external digital trigger, analog trigger and trigger from System Synchronization Interface (SSI)
A/D data transfer: software polling and bus-mastering DMA with Scatter/Gather
D/A data transfer: software update and bus-mastering DMA with Scatter/Gather
A/D trigger modes: post-trigger, delay-trigger with re-trigger functionality
D/A outputs with waveform generation capability
System Synchronization Interface (SSI)
A/D and D/A full auto-calibration
Built-in programmable D/A external reference voltage compensator
Jumper-less (software configurable)

Manual addenda

Any improvements or changes concerning the Model KPXI-AO-4-1M / KPXI-AO-8-1M or manual will be explained in an addendum included with the manual. Be sure to note these changes and incorporate them into the manual.

Safety symbols and terms

The following symbols and terms may be found on the Model KPXI-AO-4-1M / KPXI-AO-8-1M or used in this manual.
The symbol indicates that the user should refer to the operating instructions located in the
!
manual.
The symbol shows that high voltage may be present on the terminal(s). Use standard safety precautions to avoid personal contact with these voltages.
The symbol on an instrument shows that the surface may be hot. Avoid personal contact to prevent burns.
The WARNING heading used in this manual explains dangers that might result in personal injury or death. Always read the associated information very carefully before performing the indicated procedure.
The CAUTION heading used in this manual explains hazards that could damage the unit. Such damage may invalidate the warranty.

Specifications

Refer to the product data sheet for updated KPXI Analog Output Series analog output multi­function cards specifications. Check the Keithley Instruments website at www.keithley.com for the latest updates to the specifications.
KPXI-AO-901-01 Rev. A / January 2007 Return to Section Topics 1-3
Section 1: Introduction KPXI Analog Output Module Reference Manual

Unpacking and inspection

Inspection for damage
CAUTION Your Model KPXI-AO-4-1M / KPXI-AO-8-1M module contains electro-static
sensitive components that can easily be damaged by static electricity.
Therefore, handle the card on a grounded anti-static mat. The operator should be wearing an anti-static wristband, grounded at the same point as the anti-static mat.
The Model KPXI-AO-4-1M / KPXI-AO-8-1M was carefully inspected electrically and mechanically before shipment.
Inspect the card module carton for obvious damages. Shipping and handling may damage the module. Make sure there are no shipping and handling damages on the module’s carton before continuing.
After opening the card module carton, extract the system module and place it only on a grounded anti-static surface with component side up. Save the original packing carton for possible future shipment.
Again, inspect the module for damages. Report any damage to the shipping agent immediately.
Shipment contents
The following items are included with every Model KPXI-AO-4-1M / KPXI-AO-8-1M order:
Model KPXI-AO-4-1M / KPXI-AO-8-1M Portable RF PowerMeter
CD containing required software and manuals
Instruction manual
A CD-ROM containing this Reference Manual and required software is included with each Model KPXI-AO-4-1M / KPXI-AO-8-1M order. If a hardcopy of the Model KPXI-AO-4-1M / KPXI­AO-8-1M Reference Manual is required, you can order the Manual Package (Keithley Instruments Part Number Model KPXI-AO-901-01). The Manual Package includes an instruction manual and any pertinent addenda.
Always check the Keithley Instruments website at www.keithley.com for the latest revision of the manual. The latest manual can be downloaded (in PDF format) from the website.
Repacking for shipment
Should it become necessary to return the Model KPXI-AO-4-1M / KPXI-AO-8-1M for repair, carefully pack the unit in its original packing carton or the equivalent, and follow these instructions:
Call Keithley Instruments’ repair department at 1-888-KEITHLEY (1-888-534-8453) for a Return Material Authorization (RMA) number.
Let the repair department know the warranty status of the Model KPXI-AO-4-1M / KPXI-AO-8-1M.
Write ATTENTION REPAIR DEPARTMENT and the RMA number on the shipping label.
Complete and include the Service Form located at the back of this manual.
1-4 Return to Section Topics KPXI-AO-901-01 Rev. A / January 2007
KPXI Analog Output Module Reference Manual Section 1: Introduction
CAUTION The boards must be protected from static discharge and physical shock.
Never remove any of the socketed parts except at a static-free workstation. Use the anti-static bag shipped with the product to handle the board. Wear a grounded wrist strap when servicing.

Available accessories

NOTE Check the Keithley Instruments website (www.keithley.com) for additional accessories
that may have been added to the Keithley Instruments product line for the Model KPXI-AO-4-1M / KPXI-AO-8-1M.
Available accessories are listed below (also see Figure 1-1).
KPXI-DAQ-TB: Terminal board with 68-pin SCSI-II connector.
KPXI-DAQ-CAB: Cable connecting terminal block to KPXI-AO modules.
Figure 1-1
Accessories configuration guide

Connections

Keithley Instruments’ KPXI Analog Output Series is equipped with one 68-pin VHDCI-type connector (AMP-787254-1). Use this for making connections (for example, connect digital input / output, analog input / output, timer /counter signals, etc.).
NOTE Refer to Signal connections (contained in Section 3) for detailed information including pin
assignments.

Software introduction

Keithley Instruments’ provides versatile software drivers and packages for different systems. Keithley Instruments not only provides programming libraries such as DLL’s for most Windows based systems, but also drivers for other software packages such as LabVIEW.
All software options are included in the Keithley Instruments’ CD.
Programming library KDAQ-DRVR
KDAQ-DRVR includes device drivers and DLL’s for Windows XP® and Windows 2000®. Therefore, all applications developed with KDAQ-DRVR are compatible on Windows XP/2000. The developing environment can be VB, VC++, BC5, or any Windows programming language that
1. National Instruments™, NI, and LabVIEW are trademarks of the National Instruments Corporation.
®
1
KPXI-AO-901-01 Rev. A / January 2007 Return to Section Topics 1-5
Section 1: Introduction KPXI Analog Output Module Reference Manual
allows calls to a DLL. Documentation includes a User's Guide (refer to Appendix A: KDAQ-DRVR
User’s Guide), and a Function Reference (refer to Appendix B: KDAQ-DRVR Function Reference).
KDAQ-LVIEW LabVIEW® driver
KDAQ-LVIEW contains the VI’s, which are used to interface with National Instrument's® Lab-VIEW® software package. The KDAQ-LVIEW supports Windows XP/2000®. The LabVIEW driver is shipped free with the board. Documentation includes an Interface Guide (refer to
Appendix C: KIDAQ®-LabVIEW Compatible Interface Guide), and an interface Function
Reference (refer to Appendix D: KIDAQ®-LabVIEW Compatible Function Reference).
1-6 Return to Section Topics KPXI-AO-901-01 Rev. A / January 2007
In this section:
Top ic Page
Introduction......................................................................................... 2-2
Handling precautions ....................................................................... 2-2
Mechanical drawing.......................................................................... 2-2
PCI configuration............................................................................... 2-2
Installation........................................................................................... 2-3
Section 2
Installation
Plug-and-Play ................................................................................... 2-2
Configuration .................................................................................... 2-3
Troubleshooting................................................................................ 2-3
Section 2: Installation KPXI Analog Output Module Reference Manual

Introduction

This section contains information about handling and installing Keithley Instruments’ KPXI Analog Output Series cards:
Handling precautions
Mechanical drawing
PCI configuration
Installation

Handling precautions

CAUTION Use care when handling the KPXI Analog Output Series module. KPXI Analog
Output Series modules contain electro-static sensitive components that can be easily damaged by static electricity.
Follow these guidelines when handling:
Only handle the card on a grounded anti-static mat.
Wear an an anti-static wristband that is grounded at the same point as the anti-static mat.

Mechanical drawing

NOTE: See Figure 3-2 for a CN1 pinouts.
Figure 2-1
PCB layout of Model KPXI-AO-4-1M/Model KPXI-AO-8-1M
CN1 (68-Pin Connector)
Board-to-board Connector

PCI configuration

Plug-and-Play
As a plug-and-play component, the board requests an interrupt number via its PCI controller. The system BIOS responds with an interrupt assignment based on the board information and system parameters. These system parameters are determined by the installed drivers and the hardware
2-2 Return to Section Topics KPXI-AO-901-01 Rev. A / January 2007
KPXI Analog Output Module Reference Manual Section 2: Installation
load recognized by the system. If this is the first KIDAQ® KPXI Analog Output Series card installed on your Windows detailed information.
Configuration
Configuration is done on a board-by-board basis for all PCI boards on your system. Configuration is controlled by the system and software. There is no jumper setting required (or available) for base address, DMA, and interrupt IRQ.
The configuration is not static, but is subject to change with every boot of the system (as new boards are added or removed).
Troubleshooting
If your system doesn't boot or if you experience erratic operation with your PXI board in place, it's likely caused by an interrupt conflict (perhaps the BIOS Setup is incorrectly configured). In general, the solution, is to consult the BIOS documentation that comes with your system.

Installation

Step 1. Install driver software
Windows® will find the new module automatically. If this is the first time a KIDAQ® KPXI Analog Output Series card is running on your Windows system, you will need to install a hardware driver. Use the following installation procedure as a guide.
®
system, you will also need to install a hardware driver. Refer to Installation for
NOTE: Keithley Instruments controllers are pre-loaded with the necessary drivers.
For Windows XP/2000:
1. Insert the CD shipped with the module. The CD should auto load. From the base menu install the KDAQ-DRVR. This is the hardware driver that recognizes the KPXI Analog Out­put Series modules. If the CD does not auto load run, then under x:\KDAQ-DRVR\DISK1\, you will find SETUP.EXE (x is the drive letter of your CDROM). This will also run the install.
2. When you complete driver installation, turn off the system.
Step 2. Inspect module
Keeping the “Handling precautions” information in mind, inspect the module for damage. With the module placed on a firm, flat surface, press down on all socketed IC's to make sure that they are properly seated.
If the module does not pass the inspection, do not proceed with the installation.
CAUTION Do not apply power to the card if it has been damaged.
The KIDAQ® KPXI Analog Output Series card is now ready for installation.
Step 3. Install module
Remove power from the system and install the KPXI Analog Output Series card in an available slot.
The PXI connectors are rigid and require careful handling when inserted and removed. Improper handling of modules can easily damage the backplane.
KPXI-AO-901-01 Rev. A / January 2007 Return to Section Topics 2-3
Section 2: Installation KPXI Analog Output Module Reference Manual
To insert the module into a PXI chassis, use the following procedure as a guide:
1. Turn off the system.
2. Align the module's edge with the card guide in the PXI chassis.
3. Slide the module into the chassis until resistance is felt from the PXI connector.
4. Push the ejector upwards and fully insert the module into the chassis. Once inserted, a "click" can be heard from the ejector latch.
5. Tighten the screw on the front panel.
6. Turn on the system.
To remove a module from a PXI chassis, use the following procedure as a guide:
1. Turn off the system.
2. Loosen the screw on the front panel.
3. Push the ejector downwards and carefully remove the module from the chassis.
Figure 2-2
Typical PXI module installation
Typical PXI chassis
Card guide
Front panel screw
Modules edge
Ejector latch
2-4 Return to Section Topics KPXI-AO-901-01 Rev. A / January 2007
KPXI Analog Output Module Reference Manual Section 2: Installation
Step 4. Verify installation
When the system is turned on for the first time with a new module present (or a module in a new slot), Windows Add New Hardware Wizard attempts to locate the correct driver. If it cannot find the correct driver, even after you have loaded the driver above in Step 1, then force the Add New Hardware Wizard to look in Windows system32 directory. The driver files should be in this location. If they are not, shutdown the system, remove the module, and restart the installation process.
When the Add New Hardware Wizard finishes, the window will verify whether or not installation was successful. To confirm if the module is installed correctly at a later time, use Windows Device Manager. In the Device Manager under KIDAQ Boards, look for a device name matching the model number of the newly installed board. If it is found, installation is complete. If the board appears with a exclamation point or warning in Device Manager, the installation was unsuccessful. If unsuccessful, use Device Manager to update the driver or un-install the module, power down the system, remove the module, and attempt installation again from Step 1.
Figure 2-3
Device manager (successful installation)
KPXI-AO-901-01 Rev. A / January 2007 Return to Section Topics 2-5
Section 2: Installation KPXI Analog Output Module Reference Manual
This page left blank intentionally.
2-6 Return to Section Topics KPXI-AO-901-01 Rev. A / January 2007
In this section:
Top ic Page
Introduction......................................................................................... 3-2
Signal connections ........................................................................... 3-3
A/D conversion................................................................................... 3-4
D/A conversion................................................................................... 3-9
Section 3
Operation and connection
Connectors pin assignment .............................................................. 3-3
KPXI Analog Output Series A/D data format .................................... 3-5
Software polling mode ...................................................................... 3-5
Programmable scan mode ............................................................... 3-5
Trigger mode .................................................................................... 3-7
Bus-mastering DMA data transfer .................................................... 3-9
Architecture .................................................................................... 3-10
Hardware controlled waveform generation ..................................... 3-10
Setting up the DACs ........................................................................3-11
Utilizing multiplying characteristics of DACs....................................3-11
Software update.............................................................................. 3-12
Waveform generation ..................................................................... 3-12
Trigger modes................................................................................. 3-14
Iterative waveform generation ........................................................ 3-15
Stop modes..................................................................................... 3-16
General purpose digital I/O........................................................... 3-18
General purpose timer/counter operation ................................ 3-18
Timer/Counter functions basics ...................................................... 3-18
General purpose timer/counter modes ........................................... 3-19
Trigger sources................................................................................ 3-21
Software trigger .............................................................................. 3-22
External analog trigger ................................................................... 3-22
Timing signal .................................................................................... 3-24
System synchronization interface................................................... 3-25
Calibration ......................................................................................... 3-25
Auto-calibration............................................................................... 3-25
Saving calibration constants........................................................... 3-26
Loading calibration constants ......................................................... 3-26
Section 3: Operation and connection KPXI Analog Output Module Reference Manual

Introduction

This section contains operation information on KPXI Analog Output Series cards, including signal connections. The operation theories described in this section include A/D conversion (Analog to Digital), D/A conversion (Digital to Analog), Digital I/O (Input Output), and General Purpose Counter / Timer (refer to Analog Output Series modules.
Figure 3-1
Block diagram
Figure 3-1). Use this information to configure and program the KPXI
68 pin Mini-SCSI connector
DA GROUP B
Ext-WF-Trig, Ext-Dtrig, Ext-timebase
24-bit DIO / GPTC^2 / External Triggers
8255 24-bit DIO
MUX
14-bit
ADC
AD Control and Timing
Logic
AD Control and
Trigger Logic
AD Control
FIFO (for Data
& Configuration)
Analog
Analog Trtigger Signals
Trigger Logic
Daughter Board FIFO Interface
Daughter Board
FIFO Interface
12-bit
DAC
12-bit
DAC
DA GROUP A
FIFO
Calibration
Board to Board Interface
DAQ
Bus
DAQ Bus
Interface
DAQ 2000
Control and
Trigger Logic
Local Bus
Interface and DMA
Logic
DA Control and Timing
Logic
DA Control and
Trigger Logic
DA Interface
FIFO
GRXXC0
GRXXC1
SSI XXXX PFI
OPAOPAOPA
12-bit
DAC
LATCHLATCHLATCH
OPA
12-bit
DAC
LATCH
CPLD
Analog
Trigger
General Purpose timer/Counter Signals
Programmabale Function Inputs
82CXXX
82CXXA
Control
Logic
Logic Bus
Interface
EEPROM
24-bit I/O
Power
Logic
Power Circuit
Power
DMA
Local Bus Interface
PCI Bus Controller
Universal PCI Interface
Local Bus Signals
Configuration
and
Calibration
EEPROM
System Synchronization Interface
Universal 32-bit PCI Bus
3-2 Return to Section Topics KPXI-AO-901-01 Rev. A / January 2007
KPXI Analog Output Module Reference Manual Section 3: Operation and connection

Signal connections

Signal connections describes the KPXI Analog Output Series card connectors and the signal connection between KPXI Analog Output Series card and external devices.
Connectors pin assignment
KPXI Analog Output series cards are equipped with one 68-pin VHDCI-type connector (AMP­787254-1) used for digital input / output, analog input / output, and timer/counter signals, etc.,. Connector pin assignments are defined in
Figure 3-2
Connector pin assignment
AO_0 1 35 AGND AO_1 2 36 AGND AO_2 3 37 AGND AO_3 4 38 AGND
AOEXTREF_A/AI_0 5 39 AGND
AI_1 6 40 AGND
EXTATRIG/AI_2 7 41 AGND
AOEXTREF_B/AI_3 8 42 AGND
AO_4/AI_4 9 43 AGND AO_5/AI_5 10 44 AGND AO_6/AI_6 11 45 AGND AO_7/AI_7 12 46 AGND
AO_TRIG_OUTA 13 47 EXTWFTRG_A
AO_TRIG_OUTB 14 48 EXTWFTRG_B
GPTC1_SRC 15 49 VCC GPTC0_SRC 16 50 DGND
GPTC0_GATE 17 51 GPTC1_GATE
GPTC0_OUT 18 52 GPTC1_OUT
GPTC0_UPDOWN 19 53 GPTC1_UPDOWN
RESERVED 20 54 DGND
AFI1 21 55 AFI0
PB7 22 56 PB6 PB5 23 57 PB4 PB3 24 58 PB2 PB1 25 59 PB0 PC7 26 60 PC6 PC5 27 61 PC4
DGND 28 62 DGND
PC3 29 63 PC2 PC1 30 64 PC0
PA7 31 65 PA6 PA5 32 66 PA4 PA3 33 67 PA2 PA1 34 68 PA0
Figure 3-2 and Table 3-1.
KPXI-AO-901-01 Rev. A / January 2007 Return to Section Topics 3-3
Section 3: Operation and connection KPXI Analog Output Module Reference Manual
Table 3-1
Connector pin assignment
Pin # Signal Name Reference Direction Description
1-4 AO_<0 to 3> AGND Output Voltage output of DA channel <0 to 3> 5 AOEXTREF_A/AI_0 AGND Input External reference for AO channel <0 to 3> / AI
input 0 (pin is shared depending on configuration) 6 AI_1 AGND Input AI input 1 7 EXTATRIG/AI_2 AGND Input External analog trigger / AI input 2 8 AOEXTREF_B/AI_3 AGND Input External reference for AO channel <4 to 7> / AI
input 3 (pin is shared depending on configuration) 9 to 12 AO_<4 to 7> / AI_<4 to 7> AGND Output/Input KPXI-AO-8-1M:
Voltage output of DA channel <4 to 7>
KPXI-AO-4-1M: AI channel <4 to 7> 13, 14 AO_TRIG_OUT_<A, B> DGND Output AO trigger signal for channel <0 to 3> <4 to 7>
15, 16 GPTC<0, 1>_SRC DGND Input Source of GPTC<0, 1> 17, 51 GPTC<0, 1>_GATE DGND Input Gate of GPTC<0, 1> 18, 52 GPTC<0, 1>_OUT DGND Input Output of GPTC<0, 1> 19, 53 GPTC<0, 1>_UPDOWN DGND Input Up/down of GPTC<0, 1> 20 RESERVED -------- -------- Reserved Pin 21,55 AFI<1, 0> DGND Input Auxiliary Function Input 22, 56, 23,
57, 24, 58, 25, 59
26, 60, 27, 61, 29, 63, 30, 64 31, 65, 32, 66, 33, 67, 34, 68 35-46 AGND -------- -------- Analog ground 47, 48 EXTWFTRIG_<A, B> DGND Input External waveform trigger for AO channel <0 to 3>
49 VCC DGND Power (Output) +5V power source 28, 50, 54, 62DGND -------- -------- Digital ground
PB<7, 0> DGND PIO Programmable DIO of 8255 port B
PC<7, 0> DGND PIO Programmable DIO of 8255 port C
PA< 7 , 0 > DGND PIO Programmable DIO of 8255 port A
<4 to 7>
*PIO: Programmable Input/Output

A/D conversion

When using the A/D converter, determine the properties of the signal to be measured. Also, set up the A/D configuration, which includes scan channels, input range, and polarities.
The A/D acquisition is initiated by a trigger signal. The data acquisition starts once the trigger signal matches the trigger conditions. Converted data is queued into the FIFO buffer, and then transferred to the host PC's memory for further processing.
KPXI Analog Output Series cards provide two acquisition modes: Software Polling and Programmable Scan. These acquisition modes are described in the following paragraphs and include timing, trigger modes, trigger sources, and transfer methods.
3-4 Return to Section Topics KPXI-AO-901-01 Rev. A / January 2007
KPXI Analog Output Module Reference Manual Section 3: Operation and connection
KPXI Analog Output Series A/D data format
The data format of the acquired 14-bit A/D data is 2's Complement coding.
Table 3-2
Bipolar input range and converted digital codes
Magnitude Bipolar Input Range Digital code
FSR ±10V ±5V ±2.5V ±1.25V LSB 112 0.78µV 610.39µV 305.19µV 152.60µV FSR-1LSB 9.998779V 4.999389V 2.499694V 1.249847V 1FFF Midscale + LSB 1120.78µV 610.39µV 305.19uV 152.60uV 0001 Midscale 0V 0V 0V 0V 0000 Midscale - LSB -1120.78µV -610.39µV -305.19µV -152.60uV 3FFF
-FSR -10V -5V -2.5V -1.25V 2000
Table 3-3
Unipolar input range and converted digital codes
Magnitude Unipolar Input Range Digital code
FSR 0V to 10V 0 to +5V 0 to +2.5V 0 to +1.25V LSB 610.39µV 305.19µV 152.60µV 76.3µV FSR - LSB 4.999389V 2.499694V 1.249847V 1.249923V 1FFF Midscale + LSB 5.000611V 2.500306V 1.250153V 0.625076V 0001 Midscale 5V 2.5V 1.25V 0.625V 0000 Midscale - LSB 4.999389V 2.499694V 1.249847V 1.249923V 3FFF
-FSR 0V 0V 0V 0V 2000
Software polling mode
This is the easiest mode to acquire single A/D data. The A/D converter performs one conversion whenever the software command is executed. The software polls the conversion status and reads the A/D data back when it becomes available.
Use this mode when applications need to acquire A/D data in real time. In this mode, the timing of the A/D conversion is fully software controlled. Note that this mode would cause difficulty maintaining a fixed A/D sampling rate (refer to
Programmable scan mode
NOTE A scan is a sequential sampling of a group of multiple channels at a defined interval.
Use this mode when applications need to acquire A/D data at a precise and fixed rate. The scan interval is defined by SI_counter. Likewise, the sample interval of multiple channels is defined by SI2_counter. Refer to
Table 3-4
Summary of programmable scan counters
Counter Name Width Description Notes
SI_counter 24-bit Scan Interval, which defines the
*Timebase=40M for KPXI Analog Output Series
Table 3-4 for more information.
interval between each scan
Programmable scan mode).
Scan Interval = SI_counter / Timebase*
KPXI-AO-901-01 Rev. A / January 2007 Return to Section Topics 3-5
Section 3: Operation and connection KPXI Analog Output Module Reference Manual
Table 3-4 (continued)
Summary of programmable scan counters
Counter Name Width Description Notes
SI2_counter 24-bit Sampling Interval, which defines the
interval between each sampled channel
PSC_counter 24-bit Post Scan Counts, which defines
how many scans to be performed with respect to each trigger
Delay_counter 16-bit Defines the delay time for scan after
trigger
*Timebase=40M for KPXI Analog Output Series
Sampling Interval =SI2_counter / Timebase*
Delay Time = (Delay_counter / Timebase*)
KIDAQ® KPXI Analog Output Series modules can sample multiple channels in continuous/ discontinuous ascending sequence. For example, users may program KIDAQ Output Series to perform a scan in the channel sequence of 1-2-4-1-2-4.
There are three trigger modes available in programmable scan: Post-Trigger, Delay-Trigger, Post/Delay-Trigger with Retrigger. Refer to modes and their trigger sources.
Table 3-5
Trigger modes and corresponding trigger sources
Trigger Mode Description Trigger Sources
Post-Trigger Perform a scan right after the trigger occurs Software Trigger Delay-Trigger Scan delayed by the amount of time
Post/Delay-Trigger with Retrigger
Figure 3-3
Analog output series scan timing
Scan_start
Trigger
Figure 3-3 and Table 3-5 for a summary on trigger
programmed after the trigger Perform repeated scan while trigger occurs and it could be under Post-Trigger or Delay-
Trigger mode
3 Scans, 4 Samples per scan
(PSC_Counter=3)
(Scan acqui sition is perform ed in asce nding sequ ence for enabled channe ls)
Ch0
Ch1
Ch2
Ch3
Ch0
Ch1
Ch2
Ch3
Ch0
Ch1
Ch2
Ch3
®
KPXI Analog
Digital Trigger Analog Trigger SSI AD Trigger
AD_conversion
Scan_in_progress
Acquisition_in_progress
Sampling Interval t= SI2_COUNTER/TimeBase
Scan Interval T= SI_COUNTER/TimeBase
NOTES:
1. The maximum A/D sampling rate is 400KHz for KIDAQ® KPXI series therefore the minimum
setting of SI2_counter is 100.
2. The Scan Interval cannot be smaller than the interval of data sampling interval multipled by the
number of channels per Scan: SI_counter >= SI2_counter * NumChan_Counter
3-6 Return to Section Topics KPXI-AO-901-01 Rev. A / January 2007
KPXI Analog Output Module Reference Manual Section 3: Operation and connection
Trigger mode
Post-trigger acquisition
Use post-trigger acquisition to perform scans immediately following a trigger signal. Specify the number of scans to be performed after the trigger signal using the PSC_counter (refer to
Figure 3-4). The total acquired data length =
(number_of_channels_enabled_for_scan_acquisition) * PSC_counter.
Figure 3-4
Post trigger example
(NumChan_Counter=4, PSC_Counter=3)
Trigger
Scan_start
AD_conversion
Scan_in_progress
Acquisition_in_progress
Acquired & stored data (3 scans)
Operation start
Delay-trigger acquisition
Use delay-trigger to delay the scan after a trigger signal. Specify the delay time using the Delay_counter (refer to
The counter counts down on the rising edges of Delay_counter clock source after the trigger signal. When the count reaches 0, KIDAQ the scan. The acquired data length = (number_of_channels_enabled_for_scan_acquisition) * PSC_counter. The Delay_counter clock source can be software selected from Internal 40MHz Timebase, external input (AFI-1), or General Purpose Timer/Counter Output 0/1.
Figure 3-5).
®
KPXI Analog Output Series modules start to perform
KPXI-AO-901-01 Rev. A / January 2007 Return to Section Topics 3-7
Section 3: Operation and connection KPXI Analog Output Module Reference Manual
Figure 3-5
Trigger delay example
(NumChan _Counter=4, PSC_Counter=3)
Trigger
Scan_start
AD_conversion
Scan_in_progress
Acquisition_in_progress
Dela y until Delay_Counter reaches 0
Operation start
Post-trigger or delay-trigger acquisition with retrigger
Use post-trigger or delay-trigger acquisition with retrigger to perform repeated scans when there are repeated triggers (refer to trigger signal, and then the module waits for the next trigger signal. When the trigger signal occurs, the module performs two additional scans.
When the re-trigger function is disabled, only one trigger signal would be accepted after retrigger.
NOTE Retrigger signals asserted during scan process will be ignored.
Figure 3-6
Post-trigger or delay-trigger acquisition with retrigger example
(NumChan _Counter=4, PSC_Counter=2, retrig_no=3)
Trigger
Scan_start
Figure 3-6). In the example, two scans are performed after the first
Acquired & stored data (3 scans)
AD_conversion
Scan_in_progress
Acquisition_in_progress
Acquired & stored data (6 scans)
Operation start
3-8 Return to Section Topics KPXI-AO-901-01 Rev. A / January 2007
KPXI Analog Output Module Reference Manual Section 3: Operation and connection
Bus-mastering DMA data transfer
Bus-mastering DMA mode
In order to utilize the maximum PCI bandwidth, PCI bus-mastering DMA is used for high speed DAQ boards. The bus-mastering capability of the PLX PCI controller takes over the PCI bus when it becomes the master. Bus mastering reduces the required size of on-board memory as well as CPU loading, since data is directly transferred to the host PC's memory without CPU intervention.
The hardware temporarily stores the acquired data in the onboard Data FIFO buffer, then transfers the data to the user-defined DMA buffer in the host PC's memory. Bus-mastering DMA utilizes the fastest available transfer rate of PCI-bus. Once the analog acquisition operation starts, control returns to your program.
DMA with scatter gathering capability
In multi-user or multi-tasking OS (operating systems) such as Microsoft Windows®, it would be difficult to allocate a large continuous memory block due to memory fragmentation. PLX PCI controller provides scatter /gather or chaining mode to link non-continuous memory blocks into a linked list, so that users can transfer large amounts of data without being limited by the fragment of memory blocks. Users can configure the linked list for the input DMA channel and the output DMA channel, individually.
Figure 3-7 shows the linked list that is constructed by three DMA descriptors. Each descriptor
contains a PCI address, a local address, a transfer size, and the pointer to the next descriptor. You can collect fragmented memory blocks and chain their associative DMA descriptors together. KIDAQ functions. Sample programs are also supplied in the KIDAQ KPXI Driver CD.
In non-chaining mode, the maximum DMA data transfer size would be 2M double words (8M bytes). By using chaining mode with scatter/gather, there is no limitation on DMA data transfer size. Users can also link the descriptor nodes circularly to achieve a multi-buffered DMA.
Figure 3-7
Scatter/gather DMA for data transfer
®
KPXI Analog Output Series software driver provides easy ways to setup scatter/gather

D/A conversion

KIDAQ® KPXI Analog Output Series offers a flexible and versatile analog output scheme to fit the users' complex field applications. In order to fully utilize the KIDAQ following.
KPXI-AO-901-01 Rev. A / January 2007 Return to Section Topics 3-9
®
KPXI series, read the
Section 3: Operation and connection KPXI Analog Output Module Reference Manual
Architecture
KIDAQ® KPXI Analog Output Series contains four 12-bit Digital-to-Analog Converter (DAC) channels packed into each D/A group. The Model KPXI-AO-8-1M contains two D/A groups that provide up to eight channels total, while the Model KPXI-AO-4-1M contains one D/A group that provides up to four channels.
NOTE Group A is shown in Figure 3-8, Group B is identical.
Figure 3-8
Block diagram of D/A group
Figure 3-8 shows the D/A block diagram. DACs are controlled implicitly by CPLD. DAC outputs are
updated only when digital codes for all enabled DA channels are ready and latched. This ensures D/A conversions are synchronized for each channel in the same D/A group. Use this property to perform multi-channel waveform generation without any phase-lag.
Hardware controlled waveform generation
FIFO is a hardware first-in first-out data queue. This queue temporarily holds digital codes for D/A
conversion. When KIDAQ the waveform patterns are stored in FIFO, with 8K maximum samples. Waveform patterns larger than 8K are supported by utilizing bus-mastering DMA transfer supported by PCI controller (refer to
Bus-mastering DMA data transfer). Data format in FIFO is shown in Figure 3-9.
®
KPXI Analog Output Series operates in Waveform Generation mode,
3-10 Return to Section Topics KPXI-AO-901-01 Rev. A / January 2007
KPXI Analog Output Module Reference Manual Section 3: Operation and connection
Figure 3-9
Data format in FIFO and mapping
With hardware-based waveform generation, D/A conversions are updated automatically by CPLD rather than application software. Unlike conventional software-based waveform generation, the precise hardware timing control guarantees non-distorted waveform generation, even when the host CPU is under heavy loading. Detailed function setup will be explained in
generation.
Waveform
NOTE When using waveform generation mode, all the four DACs in the same D/A group must
be configured for the same mode. However, any one of the DAC can be disabled. If you need to use the software update mode, use another D/A group on the KPXI-AO-8-1M.
Setting up the DACs
Before using the DACs, you should set up the reference source and its polarity. Each DAC has its own reference and polarity settings. For example, the internal voltage reference of D/A Group A is tied to the internal +10V, however, you can still connect external reference through AOEXTREF (pin 5 on CN1). For this example, we will connect it to a +3.3V voltage source. Therefore, each DAC in D/A Group A has two reference options: 10V or 3.3V. However, DA update timing, trigger source, and trigger/stop mode are all the same throughout that D/A group.
KIDAQ® KPXI Analog Output Series provides the capability to fine-tune the voltage reference from the external source. The external reference passes through an on-board calibrated circuit, with programmable offset. Users can utilize this capability to generate precise D/A outputs.
CAUTION The range of external voltage reference should be within ±10V.
Utilizing multiplying characteristics of DACs
The D/A reference selection lets you fully utilize the multiplying characteristics of the DACs. Digital codes sent to the D/A converters will be multiplied by the reference to generate output. Refer to
Table 3-6 for the D/A output associated with the specific digital codes.
Table 3-6
D/A output versus digital codes
Bipolar Unipolar
Magnitude
FSR - LSB +Vref * (2046 / 2048) Vref * (4095 / 4096) 0FFF Midscale + LSB +Vref * (1 / 2048) Vref * (2049 / 4096) 0801
KPXI-AO-901-01 Rev. A / January 2007 Return to Section Topics 3-11
Output Output Digital Code
Section 3: Operation and connection KPXI Analog Output Module Reference Manual
Table 3-6 (continued)
D/A output versus digital codes
Bipolar Unipolar
Magnitude
Midscale 0 Vref * (2048 / 4096) 0800 Midscale - LSB -Vref * ( 1 / 2048) Vref * (2047 / 4096) 07FF
-FSR + LSB -Vref * (2046 / 2048) Vref * (1 / 4096) 0001
-FSR -Vref 0 0000
KIDAQ® KPXI Analog Output Series can generate standard and arbitrary functions, continuously or piece-wise.
Section 4 demonstrates possible waveform patterns generated by KIDAQ® KPXI
Analog Output Series in combination with various counters, clock sources, and voltage references.
Software update
This method is suitable for applications that need to generate D/A output controlled by user programs. In this mode, the D/A converter generates one output once the software command is issued. However, note that it would be difficult to determine the software update rate under a multi­task operating system like Windows
Waveform generation
This method is suitable for applications that need to generate waveforms at a precise and fixed rate. Various programmable counters help generate complex waveforms with great flexibility.
There are three event signals involved in waveform generation: Start, DAWR (DA WRite), and Stop. Please refer to corresponding Trigger Sources.
Table 3-7 for a brief summary on waveform generation events and their
Output Output Digital Code
®
.
For more information, refer to Trigger modes, Stop modes, and Trigger sources.
Table 3-7
Trigger signals and corresponding signal sources
Signal Descriptions Valid Sources
Star t Start waveform generation process. • Software Trigger
• External Digital Trigger
• Analog Trigger
• SSI Trigger
DAWR Write data to the DAC on the falling edges of DAWR. • Internal Update
• External Update
• SSI Update
Stop Stop waveform generation • Software Trigger
• External Digital Trigger
• Analog Trigger
Six counters interact with the waveform to generate different DAWR timing, allowing for the formation of different waveforms.
3-12 Return to Section Topics KPXI-AO-901-01 Rev. A / January 2007
KPXI Analog Output Module Reference Manual Section 3: Operation and connection
A
NOTE The maximum D/A update rate is 1MHz; therefore, the minimum setting of the update
interval (UI_counter) is 40.
Table 3-8
Summary of counters for waveform generation
Counter Name Width Description Note
UI_counter 24-bit Update Interval, which defines the
update interval between each data output
UC_counter 24-bit Update Counts, which defines the
number of data in a waveform
IC_counter 16-bit Iteration Counts, which defines how
many times the waveform is generated
DLY1_counter 16-bit Defines the delay time for waveform
generation after the trigger signal
DLY2_counter 16-bit Defines the delay time to separate
consecutive waveform generation. Effective only in Iterative Waveform Generation mode
Trig_counter 16-bit Defines the acceptable start trigger
count when the retrigger function is enabled
Timebase*=40M for KIDAQ® KPXI Analog Output Series
Update Interval = UI_counter / Time-base*.
When value in UC_counter is smaller than the size of waveform patterns, the waveform is generated piece-wise.
Delay Time = (DLY1_counter / Clock Timebase)
Delay Time = (DLY2_counter / Clock Timebase)
Figure 3-10
Typical D/A timing of waveform generation
4 update counts, 3 iterations
(UC _Counter=4, IC_Counter=3)
Trigger
UC_Counter=4
DAWR
WFG_in_progress
Output Wa veform
Operation start
Delay until DLY1_Counter reaches 0
2
Delay until DLY2_Counter reaches 0
DA update_interval t= UI_Counter/Timebase
4
0
-4
single waveform
IC_Counter = 3
Delay until DLY2_Counter reaches 0
NOTE Figure 3-10 is a graphic representation of typical D/A timing when the data buffer contains
values of 2V, 4V, -4V, 0V.
KPXI-AO-901-01 Rev. A / January 2007 Return to Section Topics 3-13
Section 3: Operation and connection KPXI Analog Output Module Reference Manual
Trigger modes
Post-trigger generation
Use post-trigger generation when you want to generate a waveform right after a trigger signal. The number of patterns to be updated after the trigger signal is specified by UC_counter* IC_counter, as illustrated in
Delay-trigger generation
Use delay-trigger when users want to delay the waveform generation after the trigger signal. The delay time is determined by DLY1_counter, as shown in
Figure 3-11.
Figure 3-12.
The counter counts down on the rising edges of DLY1_counter clock source after the start trigger signal. When the count reaches zero, KIDAQ
®
KPXI Analog Output Series modules starts to generate the waveform. The DLY1_counter clock source can be software selected from the Internal 40MHz Timebase, external clock input (AFI-0), or GPTC output 0/1.
Post-trigger or delay-trigger with retrigger
Use post-trigger or delay-trigger with retrigger when users want to generate multiple waveforms with respect to multiple incoming trigger signals. Users can set Trig_counter to specify the number of acceptable trigger signals.
Figure 3-13 illustrates an example. Two waveforms are generated after the first trigger signal
(Iterative Waveform Generation is used in this example, refer to Iterative waveform generation for details). The board then waits for another trigger signal. When the next trigger signal is asserted, the board generates two additional waveforms. After three trigger signals (as specified in Trig_Counter), no additional triggers signals will be accepted unless the software trigger reset command is executed.
NOTE Start Trigger signals asserted during waveform generation process will be ignored.
Figure 3-11
Post-trigger generation
Trigger
DAWR
WFG_in_progress
8 update counts, 1 iteration
(UC _Counter=8, IC_Counter=1)
Output Waveform
Operation start
4 3
4
-
-
3-14 Return to Section Topics KPXI-AO-901-01 Rev. A / January 2007
KPXI Analog Output Module Reference Manual Section 3: Operation and connection
0
Figure 3-12
Delay-trigger generation
Trigger
DAWR
WFG_in_progress
Outp ut Wa vefor m
Operation start
8 update counts, 1 iteration
(UC _Counter=8, IC_Counter=1)
Delay until DLY1_counter reaches 0
Figure 3-13
Post-trigger with retrigger generation
4 update counts, 2 iterations (UC _Counter=4, IC_Counter=2, Trig_Counter=3,
Trigger
DAWR
WFG_in_progress
Output Waveform
DLY2_Counter disabled, DLY2_Counter disabled)
4
Operation start
a single waveform
Ignored
Iterative waveform generation
Users can set IC_counter to generate iterative waveforms, in any trigger mode. The IC_counter stores the iteration number. Examples are shown in
When IC_counter is disabled, the waveform generation will not stop until a stop trigger is asserted. Refer to
An on-board data FIFO is used to buffer the waveform patterns for wave-form generation. If the size of a single waveform is smaller than that of the FIFO, after initially loading the data from the host PC's memory, the data in FIFO will be re-used when a single waveform generation is completed. In other words, it won't occupy the PCI bandwidth afterwards. However, if the size of a single waveform is larger than that of the FIFO, it needs to be intermittently loaded from the host PC's memory via DMA, thus PCI bandwidth would be occupied.
If the value specified in UC_counter is smaller than the sample size of the waveform patterns, the waveform will be generated piece-wise. For example, if a 16-sample sine wave is defined and the UC_counter is set to 2, the generated waveform will be a 1/8-cycle sine wave for every waveform period. In other words, a complete sine wave will be generated for every 8-iterations. If value specified in UC_counter is larger than the sample size of waveform LUT, say, 32; the generated waveform will be a 2-cycle sine wave for every waveform period.
In conjunction with different trigger modes and counter setups, users can manipulate a single waveform to generate different, more complex wave-forms. For more information, please refer to
Section 4, Waveform Generation Demonstration.
NOTE Figure 3-14 is a graphic representation of typical D/A timing when the data buffer contains
values of 2V, 4V, -4V, 0V.
Stop modes for details.
Figure 3-14 and Figure 3-15.
KPXI-AO-901-01 Rev. A / January 2007 Return to Section Topics 3-15
Section 3: Operation and connection KPXI Analog Output Module Reference Manual
A
Figure 3-14
Finite iterative waveform generation with post-trigger
Trigger
DAWR
WFG_in_progress
Output Waveform
Operation start
4 update counts, 3 iterations
(UC _Counter=4, IC_Counter=3, DLY2_Counter=0)
single waveform
NOTE Figure 3-15 is a graphic representation of typical D/A timing when the data buffer contains
values of 2V, 4V, -4V, 0V.
Figure 3-15
Infinite iterative waveform generation with post-trigger
4 update counts, infinite iterations
(UC _Counter=4, IC _Counter=disabled, DLY2_Counter=disabled)
Trigger
DAWR
WFG_in_pr ogress
waveform gene ration won’t stop until a stop trigger is asserted
DLY2_Counter in iterative waveform generation
To expand the flexibility of Iterative Waveform Generation, DLY2_counter was implemented to separate consecutive waveform generations.
The DLY2_counter starts counting down right after a single waveform generation is completed. When it reaches zero, the next iteration of waveform generation will start as shown in If users are generating waveform piece-wise, the next piece of waveform will be generated. The DLY2_counter clock source can be software selected from Internal 40MHz Timebase, external clock input (AFI-0), or GPTC output 0/1.
Stop modes
Waveform generation can be stopped while it is still in progress, through either a hardware or software trigger. The stop trigger sources can be software selected from internal software trigger, external digital trigger (AFI-0/1), or analog trigger. The following three stop modes are provided to stop finite or infinite waveform generation:
Mode I
After a Mode I stop trigger is asserted, the waveform generation stops immediately. Refer to Figure
3-16 for an example.
Output Waveform
Operation start
Figure 3-10.
3-16 Return to Section Topics KPXI-AO-901-01 Rev. A / January 2007
KPXI Analog Output Module Reference Manual Section 3: Operation and connection
Mode II
After a Mode II stop trigger is asserted, the waveform generation continues to generate a complete waveform then stops the operation. Refer to
Figure 3-17 for an example. Since UC_counter is set
to 4, the total generated data points must be a multiple of 4.
Users can check WFG_in_progress (waveform generation in progress) status by software read­back to confirm the stop of a waveform generation.
Mode III
After a Mode III stop trigger is asserted, the waveform generation continues until the iterative number of waveforms specified in IC_Counter is completed. Refer to Since IC_Counter is set to 3, the total generated waveforms must be a multiple of 3.
Users can check WFG_in_progress (waveform generation in progress) status by software read­back to confirm the stop of a waveform generation.
Figure 3-16
Example mode I
4 update counts, infinite iterations
(UC _Counter=4, IC_Counter disabled)
Trigger
DAWR
Figure 3-18 for an example.
WF G_in_progres s
Output Waveform
Figure 3-17
Example mode II
WFG_in_progres s
Output Waveform
Trigger
DAWR
Operation start
4 update counts, infinite iterations
(UC _Counter=4, IC_Counter disabled)
Operation start
stop trig ger
stop trig ger
KPXI-AO-901-01 Rev. A / January 2007 Return to Section Topics 3-17
Section 3: Operation and connection KPXI Analog Output Module Reference Manual
Figure 3-18
Example mode III
4 update counts, finite iterations
(UC _Counter=4, IC_Counter=3, Trig_Counter>1)
Trigger
DAWR
WFG_in_progres s
Output Waveform
Operation start
stop trigger

General purpose digital I/O

KIDAQ® KPXI Analog Output Series provides 24-line general-purpose digital I/O (GPIO) through a 82C55A chip.
The 24-line GPIO are separated into three ports: Port A, Port B and Port C. High nibble (bit[7…4]), and low nibble (bit[3…0]) of each port can be individually programmed to be either inputs or outputs. Upon system startup or reset, all the GPIO pins are reset to high impedance inputs.
For more information on programmable I/O chip 82C55A, please refer to http://www.intel.com.

General purpose timer/counter operation

Two independent 16-bit up/down general purpose timer/counters are embedded in FPGA firmware for user applications. The general purpose timer/counters have the following features:
Direction of counting can be controlled (hardware or software)
Selectable counter clock source (from either internal or external clock up to 10MHz)
Programmable gate selection
Programmable input and output signal polarities (active-high or active-low)
Initial Count can be loaded via software
Current count value can be read-back by software without affecting circuit operation
Timer/Counter functions basics
Each timer/counter has three inputs that can be controlled via hardware or software. They are:
GPTC_CLK: clock input
GPTC_GATE: gate input ()
GPTC_UPDOWN: up/down control input
The GPTC_CLK input acts as a clock source to the timer/counter. Active edges on the GPTC_CLK input increment or decrement the counter. The GPTC_UPDOWN input determines
whether the counter's counting-up or counting-down. The GPTC_GATE input is a control line, which acts as a counter enable or a counter trigger signal in different modes.
The output of timer/counter is GPTC_OUT. After power-up, GPTC_OUT is pulled high by a 10K resistor. GPTC_OUT goes low after the DAQ board is initialized.
All polarities of the input/output signals can be software programmed. In this manual, all timing figures assume that GPTC_CLK, GPTC_GATE, and GPTC_OUT are set to be triggered on the rising-edge (positive-logic).
3-18 Return to Section Topics KPXI-AO-901-01 Rev. A / January 2007
KPXI Analog Output Module Reference Manual Section 3: Operation and connection
General purpose timer/counter modes
Eight programmable timer/counter modes are provided. All modes start operations following the software start command. The GPTC software reset command initializes the status of the counter and reloads the initial value to the counter.
Mode1: Simple gated-event counting
In this mode, the counter counts the number of pulses on the GPTC_CLK after the software start. Initial count value can be loaded via software. Current count value can be read-back by software at any time. GPTC_GATE is used to enable/disable counting. When GPTC_GATE is inactive, the counter halts the current count value. down-counting mode.
Figure 3-19
Mode 1 operation
Software start
Gate
CLK
Figure 3-19 illustrates the operation with initial count = 5 in
Count value
55 432110 ffff
Mode2: Single period measurement
In this mode, the counter counts the period of the signal on GPTC_GATE in terms of GPTC_CLK. Initial count can be loaded via software. After the software start, the counter counts the number of active edges on GPTC_CLK between two active edges of GPTC_GATE. After the completion of the period measurement, GPTC_OUT outputs high and current count value can be read-back by software.
Figure 3-20 illustrates the operation where initial count = 0, up-counting mode.
Figure 3-20
Mode 2 operation
Software start
Gate
CLK
Count value
00 123455 5
Mode3: Single pulse-width measurement
In this mode, the counter counts the pulse-width of the signal on GPTC_GATE in terms of GPTC_CLK. The initial count can be loaded via software. After the software start, the counter
counts the number of active edges on GPTC_CLK when GPTC_GATE is active. GPTC_OUT outputs high, and current count value can be read-back via software after the completion of the pulse-width measurement.
Figure 3-21 illustrates the operation where initial count = 0 in
up-counting mode.
KPXI-AO-901-01 Rev. A / January 2007 Return to Section Topics 3-19
Section 3: Operation and connection KPXI Analog Output Module Reference Manual
Figure 3-21
Mode 3 operation
Software start
Gate
CLK
Count value
00 1234555
Mode4: Single gated pulse generation
This mode generates a single pulse with programmable delay and programmable pulse-width following the software start. These software programmable parameters could be specified in terms of periods of the GPTC_CLK. GPTC_GATE is used to enable/disable counting. When GPTC_GATE is inactive, the counter halts the counting.
Figure 3-22 illustrates the generation of a
single pulse with a pulse-delay of two and a pulse-width of four.
Figure 3-22
Mode 4 operation
Software start
Gate
CLK
Count value
OUT
2 2 1 0 3 2 2 1 0
Mode5: Single triggered pulse generation
This function generates a single pulse with programmable delay and programmable pulse-width following an active GPTC_GATE edge. These software programmable parameters can be specified in terms of periods of the GPTC_CLK input. Once the first GPTC_GATE edge triggers the single pulse, GPTC_GATE takes no effect until the software start is re-executed.
Figure 3-23
illustrates the generation of a single pulse with pulse delay of two and pulse-width of four.
Figure 3-23
Mode 5 operation
Software start
Gate
CLK
Count value
OUT
2 2 1 0 3 2 1 0
Mode6: Re-triggered single pulse generation
This mode is similar to mode 5 except that the counter generates a pulse following every active edge on GPTC_GATE. After the software start, every active GPTC_GATE edge triggers a single
3-20 Return to Section Topics KPXI-AO-901-01 Rev. A / January 2007
KPXI Analog Output Module Reference Manual Section 3: Operation and connection
pulse with programmable delay and pulse-width. Any GPTC_GATE trigger that occurs during the pulse generation would be ignored.
Figure 3-24 illustrates the generation of two pulses with pulse
delay of two and pulse-width of four.
Figure 3-24
Mode 6 operation
S o f t w a r e s t a r t
G a t e
C L K
C o u n t v a l u e
O U T
2 2 1 0 3 2 1 0 2
I g n o r e d
2 1 0
3 2 1 0 2
2
Mode7: Single triggered continuous pulse generation
This mode is similar to mode 5, except that the counter generates continuous periodic pulses with programmable pulse interval and pulse-width following the first active edge of GPTC_GATE. Once the first GPTC_GATE edge triggers the counter, GPTC_GATE takes no effect until the software start is re-executed. of four and pulse-width of three.
Figure 3-25 illustrates the generation of two pulses with pulse delay
Figure 3-25
Mode 7 operation
S o f t w a r e s t a r t
G a t e
C L K
C o u n t v a l u e
O U T
4 4 4 3 2 1 0 2 1
0 3 2 1 0 2 1
0 3 2
Mode8: Continuous gated pulse generation
This mode generates periodic pulses with programmable pulse interval and pulse-width following the software start. GPTC_GATE is used to enable/disable counting. When GPTC_GATE is inactive, the counter halts the current count value. pulses with pulse delay of four and pulse-width of three.
Figure 3-26
Mode 8 operation
S o f t w a r e s t a r t
G a t e
C L K
C o u n t v a l u e
O U T
4 4 3 3 2 1 0 2 1
Figure 3-26 illustrates the generation of two
0 3 2 1 0 2 1
1 0 3

Trigger sources

KIDAQ® KPXI Analog Output Series provides flexible trigger selections. In addition to software trigger, KIDAQ trigger source for A/D and D/A processes are individually configurable through software.
KPXI-AO-901-01 Rev. A / January 2007 Return to Section Topics 3-21
®
KPXI Analog Output Series also supports external analog and digital triggers. The
Section 3: Operation and connection KPXI Analog Output Module Reference Manual
NOTE A/D and D/A conversion share the same analog trigger.
Software trigger
This trigger mode does not require an external trigger source. The trigger asserts immediately following the execution of the specified function call. A/D and D/A processes can receive an individual software trigger.
External analog trigger
The analog trigger circuitry routing is shown in the Figure 3-27. The analog multiplexer selects either a direct analog input from the EXTATRIG pin (SRC1 in Figure 3-27) on the 68-pin connector CN1 or the input signal of ADC (SRC2 in Figure 3-27). The range of trigger level for SRC1 is ±10V and the resolution is 78mV (refer to Table 3-9), while the trigger range of SRC2 is the full-scale range of AD input, and the resolution is the desired range divided by 256.
Figure 3-27
Analog trigger block diagram
CN1
Input Multipexer
AIn
Instrumentation Amplifier
A/D Converter
EXTATRIG
SRC2
SRC1
MUX
Analog Trigger
Circuit
Table 3-9
Analog trigger SRC1(EXTATRIG) ideal transfer characteristics
Trigger Level digital setting Trigger voltage
0xFF 9.92V
0xFE 9.84V
--- --­0x81 0.08V 0x80 0 0x7F -0.08V
--- --­0x01 -9.92V 0x00 -10V
The trigger signal asserts when an analog trigger condition is met. The KIDAQ® KPXI Analog Output Series provide five analog trigger conditions. KIDAQ
®
KPXI Analog Output Series uses 2 threshold voltages: Low_Threshold and High_Threshold to compose 5 different trigger conditions. The trigger conditions are software configurable.
Below-low analog trigger condition
Figure 3-28 shows the “Below-low analog trigger condition.” The trigger signal asserts when the
input analog signal is lower than the Low_Threshold voltage. High_Threshold setting is not used in this trigger condition.
3-22 Return to Section Topics KPXI-AO-901-01 Rev. A / January 2007
KPXI Analog Output Module Reference Manual Section 3: Operation and connection
Figure 3-28
Below-low analog trigger condition
Above-high analog trigger condition
Figure 3-29 shows the “Above-high analog trigger condition.” The trigger signal asserts when the
input analog signal is higher than the High_Threshold voltage. The Low_Threshold setting is not used in this trigger condition.
Figure 3-29
Above-high analog trigger condition
Inside-region analog trigger condition
Figure 3-30 shows the “Inside-region analog trigger condition.” The trigger signal asserts when the
input analog signal level falls in the range between the High_Threshold and the Low_Threshold voltages.
Figure 3-30
Inside-region analog trigger condition
KPXI-AO-901-01 Rev. A / January 2007 Return to Section Topics 3-23
Section 3: Operation and connection KPXI Analog Output Module Reference Manual
High-hysteresis analog trigger condition
Figure 3-31 shows the “High-hysteresis analog trigger condition.” The trigger signal asserts when
the input analog signal level is higher than the High_Threshold voltage, where the hysteresis region is determined by the Low_Threshold voltage.
Figure 3-31
High-hysteresis analog trigger condition
Low-hysteresis analog trigger condition
Figure 3-32 shows the “Low-hysteresis analog trigger condition.” The trigger signal asserts when
the input analog signal level is lower than the Low_Threshold voltage, where the hysteresis region is determined by the High_Threshold voltage.
Figure 3-32
Low-hysteresis analog trigger condition

Timing signal

In order to meet the requirements for user-specific timing or synchronizing multiple boards, KIDAQ external circuitry or other boards. The timing of the KIDAQ composed of a bunch of counters and trigger signals in the FPGA on board.
There are seven timing signals related to the DAQ timing, which in turn influence the A/D, D/A process, and GPTC operation. These signals are fed through the Auxiliary Function Inputs pins (AFI) or the System Synchronization Interface bus (SSI). A multiplexer implemented in the FPGA selects the desired timing signal from these inputs, as shown in the
®
KPXI Analog Output Series provides a flexible interface for connecting timing signals with
®
KPXI Analog Output Series is
Figure 3-33.
Use the SSI to achieve synchronization between multiple boards, or use the AFI to derive timing signals from an external timing circuit. The System Synchronization Interface (SSI) can be routed to the PXI trigger bus for multiple module synchronization within a chassis.
3-24 Return to Section Topics KPXI-AO-901-01 Rev. A / January 2007
KPXI Analog Output Module Reference Manual Section 3: Operation and connection
Figure 3-33
Routing of DAQ signals
Internal timing
signals
System synchronization interface
NOTE The System Synchronization Interface (SSI) can be routed to the PXI trigger bus for
SSI uses bidirectional I/O to provide flexible connections between boards. Each of the seven timing signals and which board to be the SSI master is selectable. The SSI master can drive the timing signals of the slaves. This allows better synchronization between boards to be achieved.
NOTE When power-up or reset, the KPXI Analog Output Series board is reset to using its

Calibration

This paragraph introduces the calibration process which minimizes AD measurement errors and DA output errors.
SSI timing s ignals
AFI timing signals
multiple module synchronization within a chassis.
internal timing signals.
DAQ tim ing signals
KIDAQ® KPXI Analog Output Series modules are factory calibrated before shipment. The on­board high precision band-gap voltage reference together with TrimDAC compensates for unwanted offsets and gain errors, caused by environment variation or component aging.
Auto-calibration
The auto-calibration feature of KIDAQ® KPXI Analog Output Series helps users complete a calibration process, without required external voltage references or measurement devices.
The on-board auto-calibration circuitry is composed of a precision band-gap voltage reference, an ADC and a TrimDAC. TrimDAC is a multi-channel DAC that generates DC offsets that counteract the offsets from the main DACs. Digital codes for the TrimDAC, as well as the temperature and the date of the calibration, are stored in the onboard EEPROM. Keithley Instrument’s does not recommend end-users to adjust the onboard band-gap voltage reference in anyway, unless an ultra-precision calibrator is available.
Due to temperature, humidity variations, and component aging, the precision of the DAQ board may degrade over time. It is suggested that users periodically calibrate the DAQ board. The user calibration constants can also be stored in the on-board EEPROM.
NOTE 1. Before starting auto-calibration, warm up the board for at least 15 minutes.
KPXI-AO-901-01 Rev. A / January 2007 Return to Section Topics 3-25
Section 3: Operation and connection KPXI Analog Output Module Reference Manual
2.Remove the cable before auto-calibration, (the D/A outputs are changed when the cables are removed).
Saving calibration constants
An on-board EEPROM is used to store calibration constants. In addition to a default bank that stores factory calibration constants, there are three user banks. Save the subsequently performed calibration constants to any of these user banks. Software for users to save calibration constants is available from Keithley Instruments and can be found in the KDAQ Driver installation CD.
Loading calibration constants
Users can calibrate the DAQ board in three sites and store the calibration constants in different user banks. When moving DAQ board from one site to another, users can load the calibration constants without re-calibration. Software for users to load calibration constants is available from Keithley Instruments and can be found in the KDAQ Driver installation CD.
3-26 Return to Section Topics KPXI-AO-901-01 Rev. A / January 2007
In this section:
Top ic Page
Waveform generation demonstration .......................................... 4-2
Section 4
Waveform Generation Demonstration
Section 4: Waveform Generation Demonstration KPXI Analog Output Module Reference Manual

Waveform generation demonstration

Combined with 6 counters, selectable trigger sources, external reference sources, and time base, KIDAQ
®
KPXI Analog Output Series provides the capabilities to generate complex waveforms. Various modes shown below can be mixed together to generate waveforms that are even more complex.
Although users can always load a new waveform to generate any desired waveform, using hardware capabilities will maximize both efficiency and flexibility. Refer to sample waveforms.
Table 4-1
Various waveform samples
Name Description Example
Standard function Waveforms including sine wave, triangular
wave, saw wave, ramp, etc., can be con verted to Waveform LUT. Using larger wave­form means trading maximum output rate for lower harmonic distortion.
Arbitrary function User defined arbitrary function without size
limit can be generated. Users can also concatenate various standard functions of same length into one arbitrary function and setup piece-wise generation, so each standard function can be generated in sequence, with a user definable intermediate
space. Standard function with fre­quency variant
Users can alter the frequency of generated
waveforms by driving DAWR from external
signal via AF0/AF1/SSI.
The resultant updating rate should be kept
within 1MHz. In this demo, iterative genera
tion is used.
-
-
Table 4-1 for various
Iterative generation with inter­mediate space
Piece-wise generation When the value specified in UC_counter is
4-2 Return to Section Topics KPXI-AO-901-01 Rev. A / January 2007
Utilize DLY2_counter to separate consecu-
tive waveform generations in iterative gener-
ation mode.
smaller than the sample size of waveform,
the waveform is generated piece-by-piece.
The intermediate space between each piece
is determined by DLY2_counter.
In this demo, the UC_counter is set to 1/8 of
the sample size of waveform.
KPXI Analog Output Module Reference Manual Section 4: Waveform Generation Demonstration
Table 4-1 (cont.)
Various waveform samples
Name Description Example
Amplitude modulated When external D/A reference is used, apply-
ing sinusoidal voltage reference will result in an amplitude modulated (AM) waveform generation. One D/A channel can generate a sine wave, loop it back to AOEXTREF_A/B pin, and generate AM waveform by another D/A channel using external reference. This can be accomplished in a single D/A group.
Frequency modulated By feeding AFI0/AFI1 with PWM source,
pulse train from VCO, or any time-varying digital signal, KIDAQ Series boards are capable of generating fre quency modulated (FM) waveform. Since all four channels are synchronized in a D/A group, precise quadrature waveform generation is guaranteed, provided the waveform are shifted 90-degree for the other channel. Phase differences of any degree can also be setup. Combined with external High-speed pro­grammable Digital I/O card, Phase-Shift­Keying or Phase-Reversal-Keying can also be achieved.
®
KPXI Analog Output
-
KPXI-AO-901-01 Rev. A / January 2007 Return to Section Topics 4-3
Section 4: Waveform Generation Demonstration KPXI Analog Output Module Reference Manual
This page left blank intentionally.
4-4 Return to Section Topics KPXI-AO-901-01 Rev. A / January 2007
In this appendix:
Top ic Page
Introduction to KDAQ-DRVR ..........................................................A-2
About the KDAQ-DRVR software ..................................................... A-2
KDAQ-DRVR hardware support....................................................... A-2
KDAQ-DRVR language support ....................................................... A-2
Appendix A
KDAQ-DRVR User’s Guide
Fundamentals of building applications with KDAQ-DRVR .... A-3
Microsoft
Using Microsoft Visual Basic.NET ....................................................A-4
Microsoft Visual C/C++..................................................................... A-4
®
Visual Basic (Version 6.0) ...............................................A-3
KDAQ-DRVR utilities for Win32 .....................................................A-5
KDAQ-DRVR configuration utility (configdrv) ................................... A-5
KDAQ-DRVR data file converter utility (KiDAQCvt).......................... A-6
KDAQ-DRVR overview ..................................................................... A-6
General configuration function group ...............................................A-7
Analog input function group.............................................................. A-7
Analog output function group..........................................................A-10
Digital input function group............................................................. A-12
Digital output function group........................................................... A-13
General timer/counter function group............................................. A-13
DIO function group .........................................................................A-13
SSI function group..........................................................................A-14
Calibration function group...............................................................A-14
KDAQ-DRVR application hints.....................................................A-15
Analog input programming hints.....................................................A-16
Analog output programming hints..............................................A-36
One-shot analog output programming scheme .............................. A-36
Digital input programming hints ......................................................A-50
Digital output programming hints ....................................................A-51
DAQ event message programming hints........................................ A-52
Continuous data transfer in KDAQ-DRVR ................................ A-53
Continuous data transfer mechanism.............................................A-53
Double-buffered AI/AO operation ...................................................A-53
Single-buffered versus double-buffered data transfer .................... A-54
Pre-trigger mode/middle-trigger data acquisition (AI) ..................... A-54
Appendix A: KDAQ-DRVR User’s Guide KPXI Analog Output Module Reference Manual

Introduction to KDAQ-DRVR

About the KDAQ-DRVR software
KDAQ-DRVR is a software development kit for Keithley Instruments KPXI-DAQ cards. It contains a high performance data acquisition driver for developing custom applications under Microsoft Windows
KDAQ-DRVR was developed to provide a simple programming interface in communication with the Keithley Instruments' KPXI-DAQ Series cards. The KDAQ-DRVR’s easy-to-use memory and data-buffer management capabilities frees developers from these issues but still allows high-level access to the card’s features.
Using KDAQ-DRVR also takes advantage of the power and features of Win32® System for data acquisition applications, including the ability to run multiple applications and utilize extended memory. Using KDAQ-DRVR in a Visual Basic interfaces and graphics.
In addition to the software drivers, sample programs are provided for your reference. These sample programs will save programming time and highlight some of the KPXI-DAQ Series cards features.
®
XP/2000 environments.
®
environment makes it easy to create custom user
KDAQ-DRVR hardware support
Keithley Instruments will periodically upgrade the KDAQ-DRVR for new KPXI- DAQ cards. Refer to the Release Notes for the most recent list of cards that the current KDAQ-DRVR supports. The following cards are supported by KDAQ-DRVR:
KPXI-SDAQ-4-2M: 2MHz 4 channels simultaneous A/D and 2 channels D/A output device
with bus mastering DMA transfer capability
KPXI-SDAQ-4-500K: 500kHz 4 channels simultaneous A/D and 2 channels D/A output
device with bus mastering DMA transfer capability
KPXI-DAQ-64-3M: 3MHz 64 channels multiplexed A/D and 2 channels D/A output device
with bus mastering DMA transfer capability
KPXI-DAQ-64-500K: 500kHz 64 channels multiplexed A/D and 2 channels D/A output
device with bus mastering DMA transfer capability
KPXI-DAQ-64-250K: 250kHz 64 channels multiplexed A/D and 2 channels D/A output
device with bus mastering DMA transfer capability
KPXI-DAQ-96-3M: 3MHz 96 channels multiplexed A/D device with bus mastering DMA
transfer capability
KPXI-AO-4-1M: High performance, 4 channels analog output, multi-function device with
bus mastering DMA transfer capability
KPXI-AO-8-1M: High performance, 8 channels analog output, multi-function device with
bus mastering DMA transfer capability
KDAQ-DRVR language support
KDAQ-DRVR is the DLL (Dynamic-Link Library) version for use with Windows XP/2000. It works with any Windows programming language that allows calls to a DLL, such as Microsoft Visual C/ C++ (4.0 or above), Borland C++ (5.0 or above), or Microsoft Visual Basic (4.0 or above).
A-2 Return to Section Topics KPXI-AO-901-01 Rev. A / January 2007
KPXI Analog Output Module Reference Manual Appendix A: KDAQ-DRVR User’s Guide

Fundamentals of building applications with KDAQ-DRVR

The following paragraphs outline how to create Windows KDAQ-DRVR projects using Microsoft® Visual Basic
®
(Version 6.0), Microsoft Visual Basic.NET, and Microsoft Visual C/C++.
Microsoft® Visual Basic (Version 6.0)
To create a Windows® XP/2000 Keithley KDAQ-DRVR application using the API and Microsoft Visual Basic, follow these steps:
Step 1: Enter Visual Basic and open or create a project to use KDAQ-DRVR
To create a new project, select New Project from the File menu.
To use an existing project:
1. Open the file by selecting Open Project from the File menu. The Open Project dialog box
appears (Figure A-1).
Figure A-1
Open Project dialog box
2. Load the project by finding and double-clicking the project file name in the applicable directory.
Step 2: Include function declarations and constants file (KDAQDRVR.BAS)
If it is not already included in the project, add the KDAQDRVR.BAS file as a module to your project. All function declarations and constants are contained in this file. These function declarations and constants are used to develop user data acquisition applications.
Step 3: Design the application interface
Add elements, such as a command button, list box, or text box, etc., on the Visual Basic form used to design the interface. These elements are standard controls from the Visual Basic Toolbox. To place a needed control on the form:
1. Select the needed control from the Toolbox.
2. Draw the control on the form. Alternatively, to place the default-sized control on the form, click the form. Use the Select Objects tool to reposition or resize controls.
KPXI-AO-901-01 Rev. A / January 2007 Return to Section Topics A-3
Appendix A: KDAQ-DRVR User’s Guide KPXI Analog Output Module Reference Manual
Step 4: Set control properties
Set control properties from the properties list. To view the properties list, select the desired control and do one of the following:
Press F4
Select the Properties command in the View menu
or
Click the Properties button on the Toolbar.
Step 5: Write the event codes
The event codes define the action desired when an event occurs. To write the event codes:
1. Double-click the control or form needing event code (the code module will appear).
2. Add new code as needed. All functions that are declared in KDAQDRVR.BAS can be called
to perform data acquisition operations (refer to tables contained later in this manual).
Step 6: Run your application
To run the application, either:
Press F5
•Select Start from the Run menu
or
Click the Start icon on the Toolbar
Using Microsoft Visual Basic.NET
To create a data acquisition application using KDAQ-DRVR and Visual Basic.NET, use the procedure for KDAQDRVR.VB (instead of the file named KDAQDRVR.BAS).
Microsoft® Visual Basic (Version 6.0) as an outline, but in step 2, use the file named
Microsoft Visual C/C++
To create a Windows XP/2000 KDAQ-DRVR library application using the KDAQ-DRVR function library and Microsoft Visual C/C++, follow these steps:
Step 1: Enter Visual C/C++ and open or create a project that will use the KDAQ-DRVR
NOTE The project can be a new or existing one.
Step 2: Include function declarations and constants file (KDAQDRVR.H)
Include KDAQDRVR.H in the C/C++ source files that call KDAQ-DRVR functions by adding the following statement in the source file:
#include "kdaqdrvr.h"
NOTE: KDAQ-DRVR function declarations and constants are contained in kdaqdrvr.h. Use the
functions and constants to develop user-self data acquisition applications.
Step 3: Build your application
1. Set suitable compile and link options.
A-4 Return to Section Topics KPXI-AO-901-01 Rev. A / January 2007
KPXI Analog Output Module Reference Manual Appendix A: KDAQ-DRVR User’s Guide
2. Select Build from the Build menu (Visual C/C++ 4.0 and higher).
3. Remember to link the Keithley Command Compatible library: KDAQ-DRVR.LIB

KDAQ-DRVR utilities for Win32

The following information describes the tools that accompany the KDAQ-DRVR package.
KDAQ-DRVR configuration utility (configdrv)
The configdrv utility sets or changes the allocated buffer sizes of AI (analog input), AO (analog output), DI (digital input) and DO (digital output). The default location of this utility is in the <InstallDir>\Util directory.
The allocated buffer sizes (of AI, AO, DI, DO) represent the amount of memory assigned to each buffer. The memory is allocated in page KB (1024 bytes per page). The device driver will try to allocate the required size of memory at system startup. The size of the initial allocated memory is the maximum memory size that DMA (Direct Memory Access) or interrupt transfer can use. If the memory required exceeds the initial allocated size, an unexpected result in that transfer (DMA or interrupt) will result.
The Driver Configuration window is shown in Figure A-2. To change the allocated buffer settings for a single KDAQ-DRVR driver, use the configdrv utility and select the model number of the card from the Card type: drop-down menu (for example, KPXI-SDAQ-4-2).
The allocated buffer size fields of AI, AO, DI and DO are the default (or previously set) values. To change a value, type the desired value in the box corresponding to AI, AO, DI, or DO. Set the value according to the requirements of your applications. Click Apply and then OK to finish changing the settings.
Figure A-2
Driver Configuration window
KPXI-AO-901-01 Rev. A / January 2007 Return to Section Topics A-5
Appendix A: KDAQ-DRVR User’s Guide KPXI Analog Output Module Reference Manual
KDAQ-DRVR data file converter utility (KiDAQCvt)
Data files generated by KDAQ-DRVR functions which perform continuous data acquisition and storage operations, are written to disk in binary format. Since a binary file cannot be read by either a normal text editor or accessed by Microsoft Excel
KiDAQCvt to convert the binary file to a file format easily read. The default location of this utility is <InstallDir>\Util directory.
The KiDAQCvt main window includes two frames: the upper frame (called the Input File frame) is used for the source data file; the lower frame which is used for the destination file.
To load the source binary data file, type the binary data file name in File Path field or click Browse to select the source file from the Input File frame. Click the Load button to process the selected file. As the file is loaded, the information related to the data file (e.g., data type, data width, AD Range, etc.) are shown in the corresponding fields in the Input File frame. The default converted data file path and format are also listed.
The default destination file has a .cvt extension and is located in the same directory as the source. To change the default setting, type the desired file path or browse from Output File frame to the desired destination file location.
KIDAQCvt provides three types of data format conversion: Text file with scaled data, Binary file
with scaled data, and Text file with binary codes.
®
, KDAQ-DRVR provides a tool named
Text file with scaled data
Data in hexadecimal format is scaled to the engineering unit (voltage, amplitude, etc.,) according to the card type, data width, and data range. Then, it is written to disk in text file format. This type of data is available for data accessed from continuous Analog Input (AI) operation only.
Binary file with scaled data
Data in hexadecimal format is scaled to the engineering unit (voltage, amplitude, etc.) according to the card type, data width, and data range. Then, it is written to disk in binary file format. This type of data is available using continuous Analog Input (AI) operation only.
Text file with binary codes
Data in hexadecimal format or converted to a decimal value is written to disk in text file format. If the original data includes channel information, the raw value will be handled to get the real data value. This type of data is available using continuous AI and DI operations.
The text delimiter in the converted file is user-selectable between space, comma, and tab.
To add title/head (which includes the card type information at the beginning of the file), check the Title/Head box.
After setting the properties (file path, format, etc.) related to the converted file, push the Start
Convert button on the Output File frame to perform the file conversion.

KDAQ-DRVR overview

This overview describes classes of functions in the KDAQ-DRVR. KDAQ-DRVR functions are grouped to the following classes:
General configuration function group
Analog input function group
– Analog input configuration functions – One-shot analog input functions
A-6 Return to Section Topics KPXI-AO-901-01 Rev. A / January 2007
KPXI Analog Output Module Reference Manual Appendix A: KDAQ-DRVR User’s Guide
– Continuous analog input functions – Asynchronous analog input monitoring functions
Analog output function group
– Analog output configuration functions – One-shot analog output functions – Continuous analog output functions – Asynchronous analog output monitoring functions
Digital input function group
– One-shot digital input functions
Digital output function group
– One-shot digital output functions
General timer/counter function group
DIO function group
– Digital input/output configuration function
SSI function group
Calibration function group
General configuration function group
Use these functions to initialize and configure the data acquisition card.
KDAQ_Register_Card
Initializes the hardware and software states of a Keithley Instruments PXI DAQ card. Call Register_Card before calling any other KDAQ-DRVR library functions.
KDAQ_Release_Card
Tells KDAQ-DRVR library that this registered card is not used currently and can be released. This would make room for a new card to register.
KDAQ_AIO_Config
Informs KDAQ-DRVR library of Timer source, and analog trigger source for the Keithley Instruments PXI DAQ Device.
Analog input function group
Analog input configuration functions
KDAQ_AI_CH_Config
Informs KDAQ-DRVR library of the AI range selected for the specified analog input channel of Keithley Instruments PXI DAQ Device. KDAQ_AI_CH_Config must be called before calling any function to perform an analog input operation.
KDAQ_AI_Config
Informs KDAQ-DRVR library of trigger source, trigger mode, input mode and trigger properties for the analog input operation of Keithley Instruments PXI DAQ device. KDAQ_AI_Config must be called before calling any function to perform continuous analog input operation.
KPXI-AO-901-01 Rev. A / January 2007 Return to Section Topics A-7
Appendix A: KDAQ-DRVR User’s Guide KPXI Analog Output Module Reference Manual
KDAQ_AI_MuxScanSetup
Informs and stores numChans, chans, and gain_refGnd in the Channel-Gain Queue for a scanned data acquisition operation.
KDAQ_AI_InitialMemoryAllocated
Gets the actual size of analog input memory that is available in the device driver.
One-shot analog input functions
KDAQ_AI_ReadChannel
Performs a software triggered A/D conversion (analog input) on an analog input channel and returns the value converted (un-scaled).
KDAQ_AI_SimuReadChannel
Performs a software triggered A/D conversion (analog input) on analog input channels and returns the values converted (un-scaled). This function is only available for Simultaneous AD card (for example, Keithley Instruments KPXI-SDAQ-4-2M).
KDAQ_AI_ReadMuxScan
Returns readings for all analog input channels selected by KDAQ_AI_MuxScanSetup. This function is only available for the Multiplexed AD card (e.g., KPXI-DAQ-64-500K).
KDAQ_AI_ScanReadChannels
Performs software triggered A/D conversions (analog input) on analog input channels and returns the values converted (un-scaled). This function is only available for the Multiplexed AD card (e.g., KPXI-DAQ-64-500K).
KDAQ_AI_VReadChannel
Performs a software triggered A/D conversion (analog input) on an analog input channel and returns the value scaled to a voltage in units of volts.
KDAQ_AI_VoltScale
Converts the result from an KDAQ_AI_ReadChannel call to the actual input voltage.
Continuous Analog Input functions
KDAQ_AI_ContReadChannel
On the specified analog input channel, this function performs continuous A/D conversions at a rate that is as close as possible to the rate specified.
KDAQ_AI_ContScanChannels
Performs continuous A/D conversions on the specified continuous analog input channels at an available rate closest to the rate you specified. This function is only available for those cards that support auto-scan functionality.
KDAQ_AI_ContReadMultiChannels
On the specified analog input channels, this function performs continuous A/D conversions at the closest available rate to the rate specified. This function is only available for those cards that support auto-scan functionality.
A-8 Return to Section Topics KPXI-AO-901-01 Rev. A / January 2007
KPXI Analog Output Module Reference Manual Appendix A: KDAQ-DRVR User’s Guide
KDAQ_AI_ContReadChannelToFile
On the specified analog input channel, this function performs continuous A/D conversions at an available rate that is closest to the rate specified and saves the acquired data in a disk file.
KDAQ_AI_ContScanChannelsToFile
On the specified continuous analog input channels, this function performs continuous A/D conversions at the available rate that is closest to the rate specified and saves the acquired data in a disk file. This function is only available for those cards that support auto-scan functionality.
KDAQ_AI_ContReadMultiChannelsToFile
On the specified analog input channels, this function performs continuous A/D conversions at the available rate closest to the rate specified and saves the acquired data in a disk file. This function is only available for those cards that support auto-scan functionality.
KDAQ_AI_ContMuxScan
This function initializes the Channel-Gain Queue to point to the start of the scan sequence as specified by KDAQ_AI_MuxScanSetup and starts a multiple-channel scanned data acquisition operation. This function is only available for the Multiplexed AD card (e.g. KPXI-DAQ-64-500K).
KDAQ_AI_ContMuxScanToFile
Initializes the Channel-Gain Queue to point to the start of the scan sequence as specified by KDAQ_AI_MuxScanSetup, starts a multiple-channel scanned data acquisition operation, and saves the acquired data in a disk file.
KDAQ_AI_ContVScale
Converts the values of an array of acquired data from a continuous A/D conversion call to the actual input voltages.
KDAQ_AI_ContStatus
Checks the current status of the continuous analog input operation.
KDAQ_AI_EventCallBack
Controls and notifies the user's application when a specified DAQ event occurs. The notification is performed through a user-specified callback function.
KDAQ_AI_ContBufferSetup
Sets up the buffer for continuous analog input.
KDAQ_AI_ContBufferReset
Resets all buffers set by function KDAQ_AI_ContBufferSetup.
Asynchronous analog input monitoring functions
KDAQ_AI_AsyncCheck
Checks the current status of the asynchronous analog input operation.
KDAQ_AI_AsyncClear
Stops the asynchronous analog input operation.
KPXI-AO-901-01 Rev. A / January 2007 Return to Section Topics A-9
Appendix A: KDAQ-DRVR User’s Guide KPXI Analog Output Module Reference Manual
KDAQ_AI_AsyncDblBufferMode
Enables or Disables double buffer data acquisition mode.
KDAQ_AI_AsyncDblBufferHalfReady
Checks whether the next half buffer of data in the circular buffer is ready for transfer during an asynchronous double-buffered analog input operation.
KDAQ_AI_AsyncDblBufferToFile
Copies half of the data of the circular buffer into a disk file.
KDAQ_AI_AsyncDblBufferOverrun
Checks or clears overrun status of the double-buffered analog input operation.
KDAQ_AI_AsyncDblBufferHandled
Notifies KDAQ-DRVR the ready buffer has been handled in a user application.
KDAQ_AI_AsyncReTrigNextReady
Checks whether the data associated to the next trigger signal is ready during an asynchronous re­triggered analog input operation.
Analog output function group
Analog output configuration functions
KDAQ_AO_CH_Config
Informs KDAQ-DRVR library of the reference voltage value selected for an analog output channel of a Keithley Instruments PXI DAQ Device. KDAQ_AO_CH_Config must be called before calling the function to perform the voltage output operation.
KDAQ_AO_Config
Informs KDAQ-DRVR library of trigger source, trigger mode, output mode and trigger properties for the analog output operation of Keithley Instruments PXI DAQ Device. KDAQ_AO_Config must be called before calling the function to perform continuous analog output operation of the Keithley Instruments PXI DAQ Device.
KDAQ_AO_InitialMemoryAllocated
Gets the actual size of analog output DMA memory that is available in the device driver.
KDAQ_AO_Group_Setup
Assigns one or more analog output channels to a waveform generation group.
KDAQ_AO_Group_WFM_StopConfig
Informs KDAQ-DRVR library of stop source and stop mode for the asynchronous analog output operation of a specified group.
A-10 Return to Section Topics KPXI-AO-901-01 Rev. A / January 2007
KPXI Analog Output Module Reference Manual Appendix A: KDAQ-DRVR User’s Guide
One-shot analog output functions
KDAQ_AO_WriteChannel
Writes a binary value to the specified analog output channel.
KDAQ_AO_SimuWriteChannel
Writes binary values to the specified analog output channels simultaneously. This function is only available for Simultaneous DA card.
KDAQ_AO_VWriteChannel
Accepts a voltage value, scales it to the proper binary value and writes a binary value to the specified analog output channel.
KDAQ_AO_VoltScale
Scales a voltage to a binary value.
KDAQ_AO_Group_Update
Writes binary values to the specified group of analog output channels simultaneously.
KDAQ_AO_Group_VUpdate
Accepts voltage values, scales them to the proper binary values and writes binary values to the specified group of analog output channels simultaneously.
Continuous analog output functions
KDAQ_AO_ContWriteChannel
On the specified analog output port, this function performs continuous analog output at a rate as close as possible to the rate specified.
KDAQ_AO_ContWriteMultiChannels
Performs continuous D/A conversions on the specified analog output channels at a rate that is as close as possible to the rate specified.
KDAQ_AO_ContStatus
Checks the current status of the continuous analog output operation.
KDAQ_AO_EventCallBack
Controls and notifies the user's application when a specified DAQ event occurs. The notification is performed through a user-specified callback function.
KDAQ_AO_ContBufferSetup
This function sets up the buffer for continuous analog output.
KDAQ_AO_ContReset
This function resets all buffers set by function KDAQ_AO_ContBufferSetup for continuous analog output.
KPXI-AO-901-01 Rev. A / January 2007 Return to Section Topics A-11
Appendix A: KDAQ-DRVR User’s Guide KPXI Analog Output Module Reference Manual
KDAQ_AO_ContBufferCompose
This function organizes the data for each channel and fills them in the buffer for continuous analog output operation.
KDAQ_AO_ContBufferComposeAll
Fills the data for a specified channel in the buffer for continuous analog output operation.
KDAQ_AO_Group_FIFOLoad
Loads a waveform buffer to on-board DA FIFOs.
KDAQ_AO_Group_WFM_Start
On the specified group of analog output channels, this function performs continuous D/A conversions at a rate that is as close as possible to the rate specified.
Asynchronous analog output monitoring function
KDAQ_AO_AsyncCheck
Checks the current status of the asynchronous analog output operation.
KDAQ_AO_AsyncClear
Stops the asynchronous analog output operation.
KDAQ_AO_AsyncDblBufferMode
Enables or Disables double buffer data acquisition mode.
KDAQ_AO_AsyncDblBufferHalfReady
Checks whether the next half buffer of data in circular buffer is ready during an asynchronous double-buffered analog output operation.
KDAQ_AO_Group_WFM_AsyncCheck
Checks the current status of the asynchronous analog output operation of a specified group.
KDAQ_AO_ Group_WFM _AsyncClear
Stops the asynchronous analog output operation of a specified group.
Digital input function group
One-shot digital input functions
KDAQ_DI_ReadLine
Reads the digital logic state of the specified digital line in the specified port.
KDAQ_DI_ReadPort
Reads digital data from the specified digital input port.
A-12 Return to Section Topics KPXI-AO-901-01 Rev. A / January 2007
KPXI Analog Output Module Reference Manual Appendix A: KDAQ-DRVR User’s Guide
Digital output function group
One-Shot Digital Output functions
KDAQ_DO_WriteLine
Sets the digital output line in the digital output port to the specified state. This function is only available for those cards that support digital output read-back functionality.
KDAQ_DO_WritePort
Writes digital data to the specified digital output port.
KDAQ_DO_ReadLine
Reads the specified digital output line in the specified digital output port.
KDAQ_DO_ReadPort
Reads digital data from the specified digital output port.
General timer/counter function group
KDAQ_GCTR_Setup
Controls the general-purpose counter to operate in the specified mode.
KDAQ_GCTR_Read
Reads the counter value of the general-purpose counter without disturbing the counting process.
KDAQ_GCTR_Control
Controls the selected counter/timer by software.
KDAQ_GCTR_Reset
Halts the specified general-purpose timer/counter operation and reloads the initial value of the timer/counter.
KDAQ_GCTR_Status
Reads the counter value of the general-purpose counter without disturbing the counting process.
DIO function group
Digital input/output configuration function
KDAQ_DIO_PortConfig
This function is only used by the Digital I/O cards whose I/O port can be set as an input port or output port. This function informs KDAQ-DRVR library of the port direction selected for the digital input/output operation. Call KDAQ_DIO_PortConfig before calling functions to perform digital input/output operation.
KPXI-AO-901-01 Rev. A / January 2007 Return to Section Topics A-13
Appendix A: KDAQ-DRVR User’s Guide KPXI Analog Output Module Reference Manual
SSI function group
KDAQ_SSI_SourceConn
Connects a device to the specified SSI bus trigger line.
KDAQ_SSI_SourceDisConn
Disconnects a device signal from the specified SSI bus trigger line.
KDAQ_SSI_SourceClear
Disconnects a device signal from the specified SSI bus trigger line.
Calibration function group
KDAQ_DB_Auto_Calibration_ALL
Calibrates your Keithley Instruments PXI DAQ Device.
KDAQ_EEPROM_CAL_Constant_Update
Save new calibration constants to the specified bank of EEPROM.
KDAQ_Load_CAL_Data
Load calibration constants from the specified bank of EEPROM.
SDAQ4M2_Acquire_AD_Error
Acquires the offset and gain errors of the specified AI channel in the specified polarity mode.
SDAQ4M2_Acquire_DA_Error
Acquires the offset and gain errors of the specified DA channel in the specified polarity mode.
SDAQ4K500_Acquire_AD_Error
Acquires the offset and gain errors of the specified AI channel in the specified polarity mode.
SDAQ4K500_Acquire_DA_Error
Acquires the offset and gain errors of the specified DA channel in the specified polarity mode.
DAQ64M3_Acquire_AD_Error
Acquires the offset and gain errors of ADC.
DAQ64M3_Acquire_DA_Error
Acquires the offset and gain errors of the specified DA channel in the specified polarity mode.
DAQ64K500_Acquire_AD_Error
Acquires the offset and gain errors of ADC.
DAQ64K500_Acquire_DA_Error
Acquires the offset and gain errors of the specified DA channel in the specified polarity mode.
A-14 Return to Section Topics KPXI-AO-901-01 Rev. A / January 2007
KPXI Analog Output Module Reference Manual Appendix A: KDAQ-DRVR User’s Guide
DAQ64K250_Acquire_AD_Error
Acquires the offset and gain errors of ADC.
DAQ64K250_Acquire_DA_Error
Acquires the offset and gain errors of the specified DA channel in the specified polarity mode.
DAQ96M3_Acquire_AD_Error
Acquires the offset and gain errors of ADC.
AOxM1_Acquire_DA_Error
Acquires the offset and gain errors of the specified DA channel in the specified polarity mode.
AOxM1_Acquire_AD_Error
Acquires the offset and gain errors of ADC.

KDAQ-DRVR application hints

This paragraph provides the programming function flow that KDAQ-DRVR performs during analog I/O and digital I/O.
The figure below shows the basic building blocks of a KDAQ-DRVR application. Each building block of KDAQ-DRVR uses KDAQ_Register_Card at the beginning and KDAQ_Release_Card at the end. Other than that similarity, the functions comprising each building block vary dependent on the specific devices and applications.
Figure A-3
KDAQ-DRVR application building blocks
KDAQ_Register_Card
Configuration Function
AI/AO/DI//DO Operation Function
KDAQ_Release_Card
KPXI-AO-901-01 Rev. A / January 2007 Return to Section Topics A-15
Appendix A: KDAQ-DRVR User’s Guide KPXI Analog Output Module Reference Manual
The programming schemes for analog input/output and digital input/output are described individually in the following sections.
Analog input programming hints
KDAQ-DRVR provides two kinds of analog input operation: non-buffered single-point analog input readings and buffered continuous analog input operation.
The non-buffered single-point AI uses a software polling method to read data from the device. The programming scheme for this kind of AI operation is described in the paragraph titled
analog input programming scheme.
The buffered continuous analog input uses DMA transfer to send data from the device to user's buffer. The maximum number of counts in one transfer depends on the size of initially allocated memory for the analog input in the driver. We recommend having your applications use the KDAQ_AI_InitialMemoryAllocated function to get the initial allocated memory size before performing continuous AI operation.
The buffered continuous analog input includes:
synchronous continuous AI
non-double-buffered asynchronous continuous AI
double-buffered asynchronous continuous AI
pre/middle triggered non-double-buffered asynchronous continuous AI
pre/middle triggered double-buffered asynchronous continuous AI
One-shot
For more information regarding the special consideration and performance issues for the buffered continuous analog input, refer to the Continuous Data Transfer in the KDAQ-DRVR chapter for details.
One-shot analog input programming scheme
This section describes the typical flow of non-buffered single-point analog input readings.
Figure A-4
Typical function flow for all types of KDAQ-DRVR series
KDAQ_AI_CH_Config
Voltage reading ?
KDAQ_AI_ReadChannel/ KDAQ_AI_SimuReadChannel
YesNo
KDAQ_AI_VReadChannel
Yes
A-16 Return to Section Topics KPXI-AO-901-01 Rev. A / January 2007
Another reading ?
No
KPXI Analog Output Module Reference Manual Appendix A: KDAQ-DRVR User’s Guide
Example code fragment
card = KDAQ_Register_Card(KPXI_SDAQ_4_2M, card_number); … KDAQ_AI_CH_Config (card, channelNo, AD_B_10_V); KDAQ_AI_ReadChannel(card, channelNo, &analog_input[i]); … KDAQ_Release_Card(card);
NOTE: Figure A-5 applies to the following cards: KPXI-DAQ-64-3M, KPXI-DAQ-64-500K, KPXI-
DAQ-64-250K, and KPXI-DAQ-96-3M.
Figure A-5
Fills channel gain queue first
KDAQ_AI_MuxScanSetup
KDAQ_AI_ReadMuxScan
Yes
Another reading ?
No
Fills channel/gain queue
Example code fragment
card = KDAQ_Register_Card(KPXI_DAQ_64_3M, card_number); CHANNELCOUNT = 1; chans[0] = 0; ranges[0] = AD_B_10_V| AI_RSE; KDAQ_AI_MuxScanSetup(card, CHANNELCOUNT, chans, ranges); KDAQ_AI_ReadMuxScan (card, chan_data); … KDAQ_Release_Card(card);
Continuous analog input (with initial default settings) programming scheme
This programming section describes the typical flow of synchronous analog input operation performed by the device in a default configuration. For synchronous AI, the SyncMode argument in continuous AI functions has to be set as SYNCH_OP and for asynchronous AI, the SyncMode argument has to be set as ASYNCH_OP.
KPXI-AO-901-01 Rev. A / January 2007 Return to Section Topics A-17
Appendix A: KDAQ-DRVR User’s Guide KPXI Analog Output Module Reference Manual
Tab le A- 1
Initial default channel configuration
Description Value
AD data range AD_B_10_V Reference ground* AI_RSE
* Reference ground is available for KPXI-DAQ-64-3M, KPXI-DAQ-64-500K, KPXI-DAQ-64-250K and KPXI-DAQ-96-3M.
Tab le A- 2
Initial default AI configuration
Description Value
A/D conversion source KDAQ_AI_ADCONVSRC_Int (internal timer pacer) A/D trigger mode KDAQ_AI_TRGMOD_POST (post trigger) A/D trigger source KDAQ_AI_TRGSRC_SOFT (software trigger) Auto buffer reset TRUE
Figure A-6
Synchronous operation
KDAQ_Register_Card
KDAQ_AI_ContBufferSetup
Yes
With SyncMode
=SYNCH_OP
KDAQ_ AI_ContScanChannels/ KDAQ_ AI_ContScanChannelsToFile
Sample multiple continuous chans?
KDAQ_ AI_ContReadChannel/ KDAQ_ AI_ContReadChannelToFile
Scale to voltage?
KDAQ_AI_ContVScale
No
With SyncMode
=SYNCH_OP
A-18 Return to Section Topics KPXI-AO-901-01 Rev. A / January 2007
KPXI Analog Output Module Reference Manual Appendix A: KDAQ-DRVR User’s Guide
Example code fragment
card = KDAQ_Register_Card(KPXI_SDAQ_4_2M, card_number); KDAQ_AI_ContBufferSetup (card, ai_buf, data_size, &Id); KDAQ_AI_ContScanChannels (card, channel, Id, data_size/(channel+1), scan_intrv, samp_intrv, SYNCH_OP); or KDAQ_AI_ContReadChannel(card, channel, Id, data_size, scan_intrv, samp_intrv, SYNCH_OP) … KDAQ_Release_Card(card);
Figure A-7
Non-double buffered asynchronous operation
KDAQ_Register_Card
KDAQ_AI_ContBufferSetup
Sample multiple
With SyncMode =ASYNCH_OP
KDAQ_AI_ContScanChannels/ KDAQ_AI_ContScanChannelsToFile
continuous chans?
KDAQ_AI_ContReadChannel/ KDAQ_AI_ContReadChannelToFile
KDAQ_AI_AsyncCheck
NoYes
With SyncMode =ASYNCH_OP
No
Operation complete?
Ye s
KDAQ_AI_AsyncClear
Example code fragment
card = KDAQ_Register_Card(KPXI_SDAQ_4_2M, card_number); KDAQ_AI_ContBufferSetup (card, ai_buf, data_size, &BufId); KDAQ_AI_ContScanChannels (card, channel, BufId, data_size/(channel+1), ScanIntrv, SampIntrv, ASYNCH_OP); or KDAQ_AI_ContReadChannel(card, channel, BufId, data_size, ScanIntrv, SampIntrv, ASYNCH_OP)
do { KDAQ_AI_AsyncCheck(card, &bStopped, &count); } while (!bStopped);
KDAQ_AI_AsyncClear(card, &StartPos, &count); … KDAQ_Release_Card(card);
KPXI-AO-901-01 Rev. A / January 2007 Return to Section Topics A-19
Appendix A: KDAQ-DRVR User’s Guide KPXI Analog Output Module Reference Manual
o
o
Figure A-8
Double buffered asynchronous operation
KDAQ_Register_Card
With Enable=TRU E
KDAQ_AI_AsyncDblBufferMode
With SyncM =ASYNCH_OP
KDAQ_AI_ContScanChannels/ KDAQ_AI_ContScanChannelsToFile
KDAQ_AI_AsyncDblBufferHalfReady
No
Handling the ready data / KDAQ_AI_AsyncDblBufferToFile
No
Sample multiple continuous chans?
KDAQ_AI_ContReadChannel/ KDAQ_AI_ContReadChannelToFile
Next half buffer
ready for transfer?
Ye s
Want to stop
the operation?
Ye s
NoYe s
With SyncM =ASYNCH_OP
KDAQ_AI_AsyncClear
A-20 Return to Section Topics KPXI-AO-901-01 Rev. A / January 2007
KPXI Analog Output Module Reference Manual Appendix A: KDAQ-DRVR User’s Guide
Example code fragment
card = KDAQ_Register_Card(KPXI_SDAQ_4_2M, card_number); … KDAQ_AI_AsyncDblBufferMode (card, 1); // Double-buffered AI KDAQ_AI_ContBufferSetup (card, ai_buf, data_size, &BufId); KDAQ_A_ContBufferSetup (card, ai_buf2, data_size, &BufId); KDAQ_AI_ContScanChannels (card, channel, BufId, data_size/(channel+1), ScanIntrv, SampIntrv, ASYNCH_OP); or KDAQ_AI_ContReadChannel(card, channel, BufId, data_size, ScanIntrv, SampIntrv, ASYNCH_OP) do { do { KDAQ_AI_AsyncDblBufferHalfReady(card, &HalfReady, &fstop); } while (!HalfReady);
//Handling the ready data … } while (!clear_op);
KDAQ_AI_AsyncClear(card, &startPos, &count); … KDAQ_Release_Card(card);
Post trigger mode/ delay trigger mode synchronous continuous analog input pro­gramming scheme
This programming section describes the typical flow of post trigger or delay triggered synchronous analog input operation. While performing continuous AI operation, the AI configuration function has to be called at the beginning of the application. In addition, for synchronous AI, the SyncMode argument in continuous AI functions has to be set as SYNCH_OP.
KPXI-AO-901-01 Rev. A / January 2007 Return to Section Topics A-21
Appendix A: KDAQ-DRVR User’s Guide KPXI Analog Output Module Reference Manual
o
Figure A-9
All types of KPXI-DRVR series
KDAQ_AI_CH_Config
KDAQ_AI_Config /
With TimerBase
= KDAQ_ExtTimeBase
KDAQ_AI_PostTrig_Config
KDAQ_AIO_Config
With SyncM
=SYNCH_OP
KDAQ_AI_ContScanChannels/ KDAQ_AI_ContScanChannelsToFile
Yes
External timer base?
No
KDAQ_AI_ContBufferSetup
Sample multiple
continuous chans?
KDAQ_AI_ContReadChannel/
K
DAQ_AI_ContReadChannelToFile
Scale to voltage?
Yes
KDAQ_AI_ContVScale
NoYes
No
No
With SyncMode =SYNCH_OP
A-22 Return to Section Topics KPXI-AO-901-01 Rev. A / January 2007
KPXI Analog Output Module Reference Manual Appendix A: KDAQ-DRVR User’s Guide
Example code fragment
card = KDAQ_Register_Card(KPXI_SDAQ_4_2M, card_number); KDAQ_AI_CH_Config (card, channel, range ) KDAQ_AI_Config (card, 0, KDAQ_AI_TRGMOD_POST| KDAQ_AI_TRGSRC_ExtD| KDAQ_AI_TrgPositive, 0, 0, 0, 1); // or // KDAQ_AI_PostTrig_Config (card, KDAQ_AI_ADCONVSRC_Int, KDAQ_AI_TRGSRC_ExtD| KDAQ_AI_TrgPositive, 0, 0, 1); KDAQ_AI_ContBufferSetup (card, ai_buf, data_size, &Id); KDAQ_AI_ContScanChannels (card, channel, Id, data_size/(channel+1), scan_intrv, samp_intrv, SYNCH_OP); or KDAQ_AI_ContReadChannel(card, channel, Id, data_size, scan_intrv, samp_intrv, SYNCH_OP) … KDAQ_Release_Card(card);
Figure A-10
Fills channel gain queue first
NOTE: Only the following models have the Fills channel gain queue first feature:
KPXI-DAQ-64-3M, KPXI-DAQ-64-500K, KPXI-DAQ-64-250K, KPXI-DAQ-96-3M.
KDAQ_AI_MuxScanSetup
KDAQ_AI_Config /
With TimerBase
= KDAQ_ExtTimeBase
KDAQ_AIO_Config
Yes
KDAQ_AI_PostTrig_Config
External timer base?
No
KDAQ_AI_ContBufferSetup
KDAQ_AI_ContMuxScan
Scale to voltage?
Yes
No
KDAQ_AI_ContVScale
KPXI-AO-901-01 Rev. A / January 2007 Return to Section Topics A-23
Appendix A: KDAQ-DRVR User’s Guide KPXI Analog Output Module Reference Manual
Example code fragment
card = KDAQ_Register_Card(KPXI_DAQ_64_500K, card_number); CHANNELCOUNT = 1; chans[0] = 0; ranges[0] = AD_B_10_V| AI_RSE; KDAQ_AI_MuxScanSetup(card, CHANNELCOUNT, chans, ranges); KDAQ_AI_Config (card, KDAQ_AI_ADCONVSRC_Int, KDAQ_AI_TRGMOD_POST| KDAQ_AI_TRGSRC_ExtD| KDAQ_AI_TrgPositive, 0, 0, 0, 1); // or // KDAQ_AI_PostTrig_Config (card, KDAQ_AI_ADCONVSRC_Int, KDAQ_AI_TRGSRC_ExtD| KDAQ_AI_TrgPositive, 0, 0, 1); KDAQ_AI_ContBufferSetup (card, ai_buf, data_size, &Id); KDAQ_AI_ContMuxScan (card, Id, data_size/CHANNELCOUNT, SAMPLE_INTERVAL*CHANNELCOUNT, SAMPLE_INTERVAL, SYNCH_OP); … KDAQ_Release_Card(card);
Post trigger mode/ delay trigger mode non-double-buffered asynchronous continu­ous analog input programming scheme
This programming section describes the typical flow of post trigger or delay triggered, non-double­buffered asynchronous analog input operation. While performing continuous AI operation, the AI configuration function has to be called at the beginning of your application. In addition, for asynchronous AI, the SyncMode argument in continuous AI functions has to be set as ASYNCH_OP.
A-24 Return to Section Topics KPXI-AO-901-01 Rev. A / January 2007
KPXI Analog Output Module Reference Manual Appendix A: KDAQ-DRVR User’s Guide
Figure A-11
All types of KDAQ-DRVR series
KDAQ_AI_CH_Config
KDAQ_AI_Config or KDAQ_AI_PostTrig_Config or KDAQ_AI_DelayTrig_Config
KDAQ_AIO_Config
With SyncMode =ASYNCH_OP
KDAQ_AI_ContScanChannels/ KDAQ_AI_ContScanChannelsToFile
Yes
External Timer Base
KDAQ_AI_ContBufferSetup
Ye s
Sample multiple continuous chans?
KDAQ_AI_AsyncCheck
No
Operation complete?
KDAQ_AI_AsyncClear
No
No
KDAQ_AI_ContReadChannel/ KDAQ_AI_ContReadChannelToFile
Yes
With SyncMode =ASYNCH_OP
Example code fragment
card = KDAQ_Register_Card(KPXI_SDAQ_4_2M, card_number); … KDAQ_AI_CH_Config (card, channel, range ); KDAQ_AI_Config (card, 0, KDAQ_AI_TRGMOD_POST| KDAQ_AI_TRGSRC_ExtD| KDAQ_AI_TrgPositive, 0, 0, 0, 1); // or // KDAQ_AI_PostTrig_Config (card, KDAQ_AI_ADCONVSRC_Int, KDAQ_AI_TRGSRC_ExtD| KDAQ_AI_TrgPositive, 0, 0, 1); KDAQ_AI_AsyncDblBufferMode (card, 0); //non-double-buffered AI KDAQ_AI_ContBufferSetup (card, ai_buf, data_size, &BufId); KDAQ_AI_ContScanChannels (card, channel, BufId, data_size/(channel+1), ScanIntrv, SampIntrv, ASYNCH_OP); or KDAQ_AI_ContReadChannel(card, channel, BufId, data_size, ScanIntrv, SampIntrv, ASYNCH_OP);
do { KDAQ_AI_AsyncCheck(card, &bStopped, &count); } while (!bStopped); KDAQ_AI_AsyncClear(card, &StartPos, &count); … KDAQ_Release_Card(card);
KPXI-AO-901-01 Rev. A / January 2007 Return to Section Topics A-25
Appendix A: KDAQ-DRVR User’s Guide KPXI Analog Output Module Reference Manual
Figure A-12
Fills channel gain queue first
NOTE: Only the following models have the Fills channel gain queue first feature:
KPXI-DAQ-64-3M, KPXI-DAQ-64-500K, KPXI-DAQ-64-250K, KPXI-DAQ-96-3M.
KDAQ_AI_MuxScanSetup
KDAQ_AI_Config/KDAQ_AI_PostTrig_Config/KDAQ_AI_DelayTrig_Config
KDAQ_AIO_Config
Yes
External Timer Base
KDAQ_AI_ContBufferSetup
KDAQ_AI_ContMuxScan / KDAQ_AI_ContMuxScanToFile
KDAQ_AI_AsyncCheck
No
Operation complete?
No
With SyncMode =ASYNCH_OP
Yes
KDAQ_AI_AsyncClear
Example code fragment
card = KDAQ_Register_Card(KPXI_DAQ_64_500K, card_number); … CHANNELCOUNT = 1; chans[0] = 0; ranges[0] = AD_B_10_V| AI_RSE; KDAQ_AI_MuxScanSetup(card, CHANNELCOUNT, chans, ranges); KDAQ_AI_Config (card, 0, KDAQ_AI_TRGMOD_POST| KDAQ_AI_TRGSRC_ExtD| KDAQ_AI_TrgPositive, 0, 0, 0, 1); // or // KDAQ_AI_PostTrig_Config (card, KDAQ_AI_ADCONVSRC_Int, KDAQ_AI_TRGSRC_ExtD| KDAQ_AI_TrgPositive, 0, 0, 1); KDAQ_AI_AsyncDblBufferMode (card, 0); //non-double-buffered AI KDAQ_AI_ContBufferSetup (card, ai_buf, data_size, &BufId); KDAQ_AI_ContMuxScan (card, BufId, data_size/(channel+1), ScanIntrv, SampIntrv, ASYNCH_OP);
do { KDAQ_AI_AsyncCheck(card, &bStopped, &count); } while (!bStopped); KDAQ_AI_AsyncClear(card, &StartPos, &count); … KDAQ_Release_Card(card);
A-26 Return to Section Topics KPXI-AO-901-01 Rev. A / January 2007
KPXI Analog Output Module Reference Manual Appendix A: KDAQ-DRVR User’s Guide
Post trigger mode/ delay trigger mode double-buffered asynchronous continuous analog input programming scheme
This section describes the typical flow of post trigger or delay triggered, double-buffered asynchronous analog input operation. While performing continuous AI operation, the AI configuration function has to be called at the beginning of the application. For asynchronous AI, the SyncMode argument in continuous AI functions has to be set as ASYNCH_OP. In addition, double-buffered AI operation is enabled by setting the KDAQ_AI_AsyncDblBufferMode enable argument to 1.
Figure A-13
All types of KDAQ-DRVR series
KDAQ_AI_CH_Config
KDAQ_AI_Config/KDAQ_AI_PostTrig_Config//KDAQ_AI_DelayTrig_Config
KDAQ_AIO_Config
With SyncMode =ASYNCH_OP
yes
External timer base?
No
KDAQ_AI_ContBufferSetup KDAQ_AI_ContBufferSetup
With Enable=TRUE
KDAQ_AI_AsyncDblBufferMode
Sample multiple continuous chans?
KDAQ_AI_ContScanChannels/ KDAQ_AI_ContScanChannelsToFile
KDAQ_AI_AsyncDblBufferHalfReady
No
ready for transfer ? Next half buffer
KDAQ_AI_ContReadChannel/ KDAQ_AI_ContRe adChannelToFile
NoYe s
Ye s
Handling the ready data or KDAQ_AI_AsyncDblBufferToFile
With SyncMode =ASYNCH_OP
No
operation want to stop?
Ye s
KDAQ_AI_AsyncClear
KPXI-AO-901-01 Rev. A / January 2007 Return to Section Topics A-27
Appendix A: KDAQ-DRVR User’s Guide KPXI Analog Output Module Reference Manual
Example code fragment
card = KDAQ_Register_Card(KPXI_SDAQ_4_2M , card_number); …1 KDAQ_AI_CH_Config (card, channel, range); KDAQ_AI_Config (card, 0, KDAQ_AI_TRGMOD_POST| KDAQ_AI_TRGSRC_ExtD| KDAQ_AI_TrgPositive, 0, 0, 0, 1); // or // KDAQ_AI_PostTrig_Config (card, KDAQ_AI_ADCONVSRC_Int, KDAQ_AI_TRGSRC_ExtD| KDAQ_AI_TrgPositive, 0, 0, 1); KDAQ_AI_AsyncDblBufferMode (card, 1); // Double-buffered AI KDAQ_AI_ContBufferSetup (card, ai_buf, data_size, &BufId); KDAQ_A_ContBufferSetup (card, ai_buf2, data_size, &BufId); KDAQ_AI_ContScanChannels (card, channel, BufId, data_size/(channel+1), ScanIntrv, SampIntrv, ASYNCH_OP); or KDAQ_AI_ContReadChannel(card, channel, BufId, data_size, ScanIntrv, SampIntrv, ASYNCH_OP); do { do { KDAQ_AI_AsyncDblBufferHalfReady(card, &HalfReady, &fstop); } while (!HalfReady);
//Handling the ready data … } while (!clear_op);
KDAQ_AI_AsyncClear(card, &startPos, &count); … KDAQ_Release_Card(card);
A-28 Return to Section Topics KPXI-AO-901-01 Rev. A / January 2007
KPXI Analog Output Module Reference Manual Appendix A: KDAQ-DRVR User’s Guide
Figure A-14
Fills channel gain queue first
NOTE: Only the following models have the Fills channel gain queue first feature: KPXI-DAQ-
64-3M, KPXI-DAQ-64-500K, KPXI-DAQ-64-250K, KPXI-DAQ-96-3M.
KDAQ
KDAQ_AI_Config/KDAQ_AI_PostTrig_Config//KDAQ_AI_DelayTrig_Config
KDAQ_AIO_Config
yes
_AI_MuxScanSetup
External timer base?
No
KDAQ_AI_ContBufferSetup
With Enable=TRUE
KDAQ_AI_AsyncDblBufferMode
With SyncMode =ASYNCH_OP
KDAQ_AI_ContMuxScan / KDAQ_AI_ContMuxScanToFile
KDAQ_AI_AsyncDblBufferHalfReady
No
ready for transfer ? Next half buffer
Ye s
Handling the ready data or KDAQ_AI_AsyncDblBufferToFile
No
operation want to stop?
Ye s
KDAQ_AI_AsyncClear
KPXI-AO-901-01 Rev. A / January 2007 Return to Section Topics A-29
Appendix A: KDAQ-DRVR User’s Guide KPXI Analog Output Module Reference Manual
Example code fragment
card = KDAQ_Register_Card(KPXI_DAQ_64_500K, card_number); … CHANNELCOUNT = 1; chans[0] = 0; ranges[0] = AD_B_10_V| AI_RSE; KDAQ_AI_MuxScanSetup(card, CHANNELCOUNT, chans, ranges); KDAQ_AI_Config (card, 0, KDAQ_AI_TRGMOD_POST| KDAQ_AI_TRGSRC_ExtD| KDAQ_AI_TrgPositive, 0, 0, 0, 1); // or // KDAQ_AI_PostTrig_Config (card, KDAQ_AI_ADCONVSRC_Int, KDAQ_AI_TRGSRC_ExtD| KDAQ_AI_TrgPositive, 0, 0, 1); KDAQ_AI_AsyncDblBufferMode (card, 1); // Double-buffered AI KDAQ_AI_ContBufferSetup (card, ai_buf, data_size, &BufId); KDAQ_A_ContBufferSetup (card, ai_buf2, data_size, &BufId); KDAQ_AI_ContMuxScan (card, BufId, data_size/(channel+1), ScanIntrv, SampIntrv, ASYNCH_OP); do { do { KDAQ_AI_AsyncDblBufferHalfReady(card, &HalfReady, &fstop); } while (!HalfReady);
//Handling the ready data … } while (!clear_op);
KDAQ_AI_AsyncClear(card, &startPos, &count); … KDAQ_Release_Card(card);
Pre-trigger mode/ middle-trigger mode non-double-buffered asynchronous continu­ous analog input programming scheme
This programming section describes the typical flow of pre-trigger and middle trigger mode double­buffered asynchronous analog input operation. A trigger is an event that occurs based on a specified set of conditions. An interrupt mode or DMA-mode Analog input operation can use a trigger to determine when acquisition stop. The trigger mode data acquisition programming is almost the same as the non-trigger mode asynchronous analog input programming. Using KDAQ­DRVR to perform pre-trigger or middle mode data acquisition, the SyncMode of continuous AI should be set as ASYNCH_OP.
A-30 Return to Section Topics KPXI-AO-901-01 Rev. A / January 2007
KPXI Analog Output Module Reference Manual Appendix A: KDAQ-DRVR User’s Guide
Figure A-15
All types of KDAQ-DRVR series
KDAQ_AI_CH_Config
KDAQ_AI_Config/KDAQ_AI_PreTrig_Config/KDAQ_AI_MiddleTrig_Config
KDAQ_AIO_Config
With SyncMode =ASYNCH_OP
KDAQ_AI_ContScanChannels/ KDAQ_AI_ContScanChannelsToFile
Yes
External Timer Base
KDAQ_AI_ContBufferSetup
Sample multiple continuous chans?
KDAQ_AI_AsyncCheck
No
Operation complete?
No
NoYe s
KDAQ_AI_ContReadChannel/ KDAQ_AI_ContReadChannelToFil
Yes
With SyncMode =ASYNCH_OP
e
KDAQ_AI_AsyncClear
Example code fragment
card = KDAQ_Register_Card(KPXI_SDAQ_4_2M, card_number); … KDAQ_AI_CH_Config (card, channel, range ) KDAQ_AI_Config (card, 0, KDAQ_AI_TRGMOD_PRE| KDAQ_AI_TRGSRC_ExtD| KDAQ_AI_TrgPositive, 0, 0, 0, 1); // or // KDAQ_AI_PreTrig_Config (card, KDAQ_AI_ADCONVSRC_Int, KDAQ_AI_TRGSRC_ExtD| KDAQ_AI_TrgPositive, 0, 0, 1); KDAQ_AI_AsyncDblBufferMode (card, 0); //non-double-buffered AI KDAQ_AI_ContBufferSetup (card, ai_buf, data_size, &BufId); KDAQ_AI_ContScanChannels (card, channel, BufId, data_size/(channel+1), ScanIntrv, SampIntrv, ASYNCH_OP); or KDAQ_AI_ContReadChannel(card, channel, BufId, data_size, ScanIntrv, SampIntrv, ASYNCH_OP)
do { KDAQ_AI_AsyncCheck(card, &bStopped, &count); } while (!bStopped); KDAQ_AI_AsyncClear(card, &startPos, &count);
… KDAQ_Release_Card(card);
KPXI-AO-901-01 Rev. A / January 2007 Return to Section Topics A-31
Appendix A: KDAQ-DRVR User’s Guide KPXI Analog Output Module Reference Manual
Figure A-16
Fills channel gain queue first
NOTE: Only the following models have the Fills channel gain queue first feature: KPXI-DAQ-
64-3M, KPXI-DAQ-64-500K, KPXI-DAQ-64-250K, KPXI-DAQ-96-3M
KDAQ_AI_MuxScanSetup
KDAQ_AI_Config/KDAQ_AI_PostTrig_Config/KDAQ_AI_DelayTrig_Config
KDAQ_AIO_Config
Ye s
External Timer Base
No
KDAQ_AI_ContBufferSetup
With SyncMode =ASYNCH_OP
KDAQ_AI_ContMuxScan / KDAQ_AI_ContMuxScanToFile
KDAQ_AI_AsyncCheck
No
Operation complete?
Ye s
KDAQ_AI_AsyncClear
Example code fragment
card = KDAQ_Register_Card(KPXI_DAQ_64_500K, card_number); … CHANNELCOUNT = 1; chans[0] = 0; ranges[0] = AD_B_10_V| AI_RSE; KDAQ_AI_MuxScanSetup(card, CHANNELCOUNT, chans, ranges); KDAQ_AI_Config (card, 0, KDAQ_AI_TRGMOD_MIDL| KDAQ_AI_TRGSRC_ExtD| KDAQ_AI_TrgPositive, POSTCOUNT, 0, 0, 1); // or // KDAQ_AI_MiddleTrig_Config (card, KDAQ_AI_ADCONVSRC_Int, KDAQ_AI_TRGSRC_ExtD| KDAQ_AI_TrgPositive, POSTCOUNT, 0, 0, 1); KDAQ_AI_AsyncDblBufferMode (card, 0); //non-double-buffered AI KDAQ_AI_ContBufferSetup (card, ai_buf, data_size, &BufId); KDAQ_AI_ContMuxScan (card, BufId, data_size/(channel+1), ScanIntrv, SampIntrv, ASYNCH_OP);
do { KDAQ_AI_AsyncCheck(card, &bStopped, &count); } while (!bStopped);
KDAQ_AI_AsyncClear(card, &startPos, &count); … KDAQ_Release_Card(card);
A-32 Return to Section Topics KPXI-AO-901-01 Rev. A / January 2007
KPXI Analog Output Module Reference Manual Appendix A: KDAQ-DRVR User’s Guide
Pre-trigger mode/ middle-trigger mode double-buffered asynchronous continuous analog input programming scheme
This programming section describes the typical flow of trigger mode double-buffered asynchronous analog input operation. A trigger is an event that occurs based on a specified set of conditions. An interrupt mode or DMA-mode Analog input operation can use a trigger to determine when acquisition stops. The trigger mode data acquisition programming is almost the same as the non-trigger mode asynchronous analog input programming. Using KDAQ-DRVR to perform trigger mode data acquisition, the SyncMode of continuous AI should be set as ASYNCH_OP. In addition, double-buffered AI operation is enabled by setting enable argument of KDAQ_AI_AsyncDblBufferMode function to 1.
Figure A-17
All types of KDAQ-DRVR series
KDAQ_AI_CH_Config
KDAQ_AI_Config/KDAQ_AI_PostTrig_Config/KDAQ_AI_DelayTrig_Config
KDAQ_AIO_Config
With SyncMode =ASYNCH_OP
yes
KDAQ_AI_ContScanChannels/ KDAQ_AI_ContScanChannelsToFile
KDAQ_AI_AsyncDblBufferHalfReady
No
External timer base?
KDAQ_AI_ContBufferSetup
KDAQ_AI_AsyncDblBufferMode
Sample multiple continuous chans?
Next Buffer ready for transfer? /
Operation Complete?
No
With Enable=TRUE
NoYe s
With SyncMode =ASYNCH_OP
KDAQ_AI_ContReadChannel/ KDAQ_AI_ContReadChannelToFile
Ye s
Handling the ready data or KDAQ_AI_AsyncDblBufferToFile
No
Want to stop operation ?
Ye s
KDAQ_AI_AsyncClear
KPXI-AO-901-01 Rev. A / January 2007 Return to Section Topics A-33
Appendix A: KDAQ-DRVR User’s Guide KPXI Analog Output Module Reference Manual
Example code fragment
card = KDAQ_Register_Card(KPXI_SDAQ_4_2M, card_number); … KDAQ_AI_CH_Config (card, channel, range ) KDAQ_AI_Config (card, 0, KDAQ_AI_TRGMOD_PRE|KDAQ_AI_TRGSRC_ExtD, 0, 0, 0, 1); // or // KDAQ_AI_MiddleTrig_Config (card, KDAQ_AI_ADCONVSRC_Int, KDAQ_AI_TRGSRC_ExtD| KDAQ_AI_TrgPositive, 0, 0, 1); AI_AsyncDblBufferMode (card, 1); Double-buffered AI KDAQ_AI_ContBufferSetup (card, ai_buf, data_size, &BufId); KDAQ_A_ContBufferSetup (card, ai_buf2, data_size, &BufId); KDAQ_AI_ContScanChannels (card, channel, BufId, data_size/(channel+1), ScanIntrv, U32 SampIntrv, ASYNCH_OP); or KDAQ_AI_ContReadChannel(card, channel, BufId, data_size, ScanIntrv, U32 SampIntrv, ASYNCH_OP) do { do { KDAQ_AI_AsyncDblBufferHalfReady(card, &HalfReady, &fstop); } while (!HalfReady && !fstop);
//handling the ready data … …
} while (!clear_op && !fstop);
KDAQ_AI_AsyncClear(card, &startPos, &count); … KDAQ_Release_Card(card);
A-34 Return to Section Topics KPXI-AO-901-01 Rev. A / January 2007
KPXI Analog Output Module Reference Manual Appendix A: KDAQ-DRVR User’s Guide
Figure A-18
Fills channel gain queue first
NOTE: Only the following models have the Fills channel gain queue first feature: KPXI-DAQ-
64-3M, KPXI-DAQ-64-500K, KPXI-DAQ-64-250K, KPXI-DAQ-96-3M.
KDAQ_AI_MuxScanSetup
KDAQ_AIO_Config
No
Ye s
KDAQ_AI_Config KDAQ_AI_PreTrig_Config or KDAQ_A I_MiddleTrig_Config
External timer base?
No
KDAQ_AI_ContBufferSetup
With Enable=TRUE
KDAQ_AI_AsyncDblBufferMode
With SyncMode =ASYNCH_OP
KDAQ_AI_ContMuxScan / KDAQ_AI_ContMuxScanToFile
KDAQ_AI_AsyncDblBufferHalfReady
Next Buffer ready for transfer? /
Operation Complete?
or
Ye s
Handling the ready data or KDAQ_AI_AsyncDblBufferToFile
Want to stop operation?
Ye s
No
KDAQ_AI_AsyncClear
Example code fragment
card = KDAQ_Register_Card(KPXI_DAQ_64_500K, card_number); … CHANNELCOUNT = 1; chans[0] = 0; ranges[0] = AD_B_10_V| AI_RSE; KDAQ_AI_MuxScanSetup(card, CHANNELCOUNT, chans, ranges); KDAQ_AI_Config (card, 0, KDAQ_AI_TRGMOD_RRE| KDAQ_AI_TRGSRC_ExtD| KDAQ_AI_TrgPositive, 0, 0, 0, 1); // or
KPXI-AO-901-01 Rev. A / January 2007 Return to Section Topics A-35
Appendix A: KDAQ-DRVR User’s Guide KPXI Analog Output Module Reference Manual
// KDAQ_AI_PreTrig_Config (card, KDAQ_AI_ADCONVSRC_Int, KDAQ_AI_TRGSRC_ExtD| KDAQ_AI_TrgPositive, 0, 0, 1); KDAQ_AI_AsyncDblBufferMode (card, 1); // Double-buffered AI KDAQ_AI_ContBufferSetup (card, ai_buf, data_size, &BufId); KDAQ_A_ContBufferSetup (card, ai_buf2, data_size, &BufId); KDAQ_AI_ContMuxScan (card, BufId, data_size/(channel+1), ScanIntrv, SampIntrv, ASYNCH_OP); do { do { KDAQ_AI_AsyncDblBufferHalfReady(card, &HalfReady, &fstop); } while (!HalfReady);
//Handling the ready data … } while (!clear_op);
KDAQ_AI_AsyncClear(card, &startPos, &count); … KDAQ_Release_Card(card);

Analog output programming hints

KDAQ-DRVR provides two kinds of analog output operation — non-buffered single-point analog output operation and buffered continuous analog output operation.
The non-buffered single-point AO uses a software polling method to write data to the device. The programming scheme for this kind of AO operation is described in the paragraph titled
analog output programming scheme.
The buffered continuous AO uses DMA transfer method to transfer data from the user's buffer to the device. The maximum number of count in one transfer depends on the size of initially allocated memory for analog output in the driver. Use the KDAQ_AO_InitialMemoryAllocated function to get the size of initially allocated memory before starting to perform continuous AO operation.
Refer to Continuous data transfer in KDAQ-DRVR later in this section for special considerations and performance issues for the buffered continuous analog output.
One-shot analog output programming scheme
The following examples describe the typical flow of non-buffered single-point analog output operations.
One-shot
A-36 Return to Section Topics KPXI-AO-901-01 Rev. A / January 2007
KPXI Analog Output Module Reference Manual Appendix A: KDAQ-DRVR User’s Guide
Figure A-19
One-shot analog output programming
NOTE: Figure A-19 (and the example code fragment immediately following the figure) details the
typical flow of the following models: KPXI-SDAQ-4-500K, KPXI-SDAQ-4-2M, KPXI-DAQ-64-3M, KPXI-DAQ-64-500K, KPXI-DAQ-64-250K
KDAQ_AO_CH_Config
Output voltage?
KDAQ_AO_WriteChannel/ KDAQ_AO_SimuWriteChannel
Yes
Another output value?
No
YesNo
KDAQ_AO_VWriteChannel
Example code fragment
card = KDAQ_Register_Card(KPXI_SDAQ_4_2M, card_number); … KDAQ_AO_CH_Config (card, 0, KDAQ_DA_BiPolar, KDAQ_DA_Int_REF, 10.0); KDAQ_AO_WriteChannel(card, chan, out_value); … KDAQ_Release_Card(card);
KPXI-AO-901-01 Rev. A / January 2007 Return to Section Topics A-37
Appendix A: KDAQ-DRVR User’s Guide KPXI Analog Output Module Reference Manual
Figure A-20
One-shot analog output programming
NOTE: Figure A-20 (and the example code fragment immediately following the figure) details the
typical flow of the following models: KPXI-AO-4-1M and KPXI-AO-8-1M.
KDAQ_AO_CH_Config KDAQ_AO_Group_Setup
YesNo
KDAQ_AO_Group_VUpdateKDAQ_AO_Group_Update
Yes
Output voltage?
Another output value?
No
Example code fragment
card = KDAQ_Register_Card(KPXI_AO_8_1M, card_number); da_ch = 0; KDAQ_AO_CH_Config (card, da_ch, KDAQ_DA_BiPolar, KDAQ_DA_Int_REF, 10.0); KDAQ_AO_Group_Setup (card, DA_Group_A, 1, &da_ch); KDAQ_AO_Group_VUpdate (card, DA_Group_A, &out_V); … KDAQ_Release_Card(card);
Continuous analog output (with initial default settings) programming scheme
This programming section describes the typical flow of synchronous analog output operation performed by the device in a default configuration. While performing continuous AO operation, the AO configuration function has to be called at the beginning of the application. In addition, the SyncMode argument in continuous AO functions has to be set as ASYNCH_OP.
Tab le A- 3
Initial default channel configuration
Channel Configuration
D/A Output Polarity KDAQ_DA_BiPolar D/A Reference voltage source KDAQ_DA_Int_REF D/A Reference voltage value 10.0
Tab le A- 4
Initial default DA configuration
Channel Configuration
D/A R/W source KDAQ_DA_WRSRC_Int
(Internal timer pacer)
D/A Trigger mode KDAQ_DA_TRGMOD_POST
(post trigger)
A-38 Return to Section Topics KPXI-AO-901-01 Rev. A / January 2007
KPXI Analog Output Module Reference Manual Appendix A: KDAQ-DRVR User’s Guide
Table A-4 (continued)
Initial default DA configuration
Channel Configuration
D/A Trigger source KDAQ_DA_TRGSRC_SOFT
(software trigger)
Auto buffer reset KPXI-AO-4-1M: TRUE
KPXI-AO-8-1M: FALSE
NOTE: Figure A-21 (and the example code fragment immediately following the figure) details the
typical flow of the following models: KPXI-SDAQ-4-500K, KPXI-SDAQ-4-2M, KPXI-DAQ-64-3M, KPXI-DAQ-64-500K, KPXI-DAQ-64-250K.
Figure A-21
Non-double-buffered asynchronous continuous analog output programming
KDAQ_AO_ContBufferSetup
With SyncMode =ASYNCH_OP
KDAQ_AO_ContW riteChannel
KDAQ_AO_AsyncCheck
No
Operation complete?
Yes
KDAQ_AO_AsyncClear
Example code fragment
card = KDAQ_Register_Card(KPXI_AO_8_1M, card_number); … KDAQ_AO_ContBufferSetup (card, ao_buf, data_size, &DaId); KDAQ_AO_ContWriteChannel(card, 0, DaId, data_size, iteration, samp_intrv, samp_intrv, ASYNCH_OP);
do { KDAQ_AO_AsyncCheck(card, &bStopped, &count); } while (!bStopped); KDAQ_AO_AsyncClear(card, &count, mode); … KDAQ_Release_Card(card);
NOTE: Figure A-22 (and the example code fragment immediately following the figure) details the
typical flow of the following models: KPXI-AO-4-1M and KPXI-AO-8-1M.
KPXI-AO-901-01 Rev. A / January 2007 Return to Section Topics A-39
Appendix A: KDAQ-DRVR User’s Guide KPXI Analog Output Module Reference Manual
Figure A-22
Non-double-buffered asynchronous continuous analog output programming
KDAQ_AO_Group_Setup
KDAQ_AO_ContBufferSetup
With SyncMode =ASYNCH_OP
KDAQ_AO_Group_WFM_Start
KDAQ_AO_Group_WFM_AsyncCheck
No
Operation complete?
Yes
KDAQ_AO_Group_WFM_AsyncClear
KDAQ_AO_ContBufferReset
Example code fragment
card = KDAQ_Register_Card(KPXI_AO_8_1M, card_number); KDAQ_AO_Group_Setup (card, DA_Group_A, 1, &da_ch); //DA channel 0 in group A KDAQ_AO_ContBufferSetup (card, ao_buf, data_size, &DaId); KDAQ_AO_Group_WFM_Start (card, DA_Group_A, Id, DaId, data_size/2, 10, samp_intrv, 1);
do { KDAQ_AO_Group_WFM_AsyncCheck(card, DA_Group_A, &bStopped, &count); } while (!bStopped); KDAQ_AO_Group_WFM_AsyncClear(card, DA_Group_A, &count, 0); KDAQ_AO_ContBufferReset (card); KDAQ_Release_Card(card);
A-40 Return to Section Topics KPXI-AO-901-01 Rev. A / January 2007
KPXI Analog Output Module Reference Manual Appendix A: KDAQ-DRVR User’s Guide
NOTE: Figure A-23 (and the example code fragment immediately following the figure) details the
typical flow of the following models: KPXI-SDAQ-4-500K, KPXI-SDAQ-4-2M, KPXI-DAQ-64-3M, KPXI-DAQ-64-500K, KPXI-DAQ-64-250K.
Figure A-23
Double-buffered asynchronous continuous analog output programming
KDAQ_AO_ContBufferSetup KDAQ_AO_ContBufferSetup
With Enable=TRUE
KDAQ_AO_AsyncDblBufferMode
With SyncMode =ASYNCH_OP
No
Sample multiple continuous chans?
KDAQ_AO_ContWriteChannelKDAQ_AO_ContWriteMultiChannels
KDAQ_AO_AsyncDblBufferHalfReady
Next half buffer Ready?
Ye s
Placing the output data into the ready buffer 
NoYe s
With SyncMode =ASYNCH_OP
No
Want to stop
the operation?
Ye s
KDAQ_AO_AsyncClear
KPXI-AO-901-01 Rev. A / January 2007 Return to Section Topics A-41
Appendix A: KDAQ-DRVR User’s Guide KPXI Analog Output Module Reference Manual
Example code fragment
card = KDAQ_Register_Card(KPXI_SDAQ_4_2M, card_number); KDAQ_AO_ContBufferSetup (card, ao_buf, data_size, &DaId); KDAQ_AO_ContBufferSetup (card, ao_buf2, data_size, &DaId); KDAQ_AO_AsyncDblBufferMode (card, 1); KDAQ_AO_ContWriteChannel(card, 0, DaId, data_size, 0, samp_intrv, samp_intrv, ASYNCH_OP); do { do { KDAQ_AO_AsyncDblBufferHalfReady(card, &HalfReady); } while (!HalfReady);
// Placing the output data into the ready buffer … … } while (!clear_op);
KDAQ_AO_AsyncClear(card, &count, mode); … KDAQ_Release_Card(card);
NOTE: Figure A-24 (and the example code fragment immediately following the figure) details the
typical flow of the following models: KPXI-AO-4-1M, KPXI-AO-8-1M.
A-42 Return to Section Topics KPXI-AO-901-01 Rev. A / January 2007
Loading...