Your IOtech warranty is as stated on the product warranty card. You may contact IOtech by phone,
fax machine, or e-mail in regard to warranty-related issues.
IOtech. No part of this product may be copied, reproduced or transmitted by any mechanical,
photographic, electronic, or other method without prior written consent of IOtech, Inc. TempBook,TempView, DaqView, and related product names are trademarks of IOtech, Inc. Other product names
are trademarks of their respective holders.
FCC Statement
IOtech devices emit radio frequency energy in levels compliant with Federal Communications
Commission rules (Part 15) for Class A devices. The following booklet, prepared by the FCC, may be
helpful: How To Identify and Resolve Radio-TV Interference Problems (stock no. 044-000-00345-4).
The booklet is available from the US Government Printing Office, Washington, DC 20402
CE Notice
Many IOtech products now carry the CE marker to indicate they comply with safety and emissions
standards as regulated by the European Community. Such products are shipped with a Declaration of
Conformity stating which specifications and operating conditions apply.
Safety/Caution Notice
The TempBook contains no user-serviceable parts other than expressed in this manual; refer all service
to qualified personnel. Perform system connections and all service (but not calibration) with the power
off to the device serviced and to all connected equipment. Using this equipment in ways other than
described in this manual can present serious safety hazards or cause equipment damage.
This warning symbol is used in this manual or on the equipment to warn of possible injury or death
from electrical shock under noted conditions.
This caution symbol is used to warn of possible personal injury or equipment damage under noted
conditions. Follow all safety standards of professional practice and recommendations in the manual.
This ESD caution symbol is used to urge proper handling of equipment or components sensitive to
damage from electrostatic discharge. Handling guidelines include properly grounded mats and wrist
straps, ESD bags and cartons, and related procedures.
Calibration Notice
IOtech products are factory-calibrated to published specifications, and associated trimpots have been
sealed in the calibrated position. Re-calibration in the warranty period is the responsibility of the user
and is covered under warranty at IOtech’s discretion.
Quality Notice
Certified to ISO 9001 standards since 1996, IOtech applies tests and procedures to assure the highest
quality in all aspects of our products. Prior to shipment, we thoroughly test the products and review the
documentation. In a spirit of continuous improvement, IOtech welcomes your suggestions.
This manual explains the setup and operation of the TempBook data acquisition system. This manual
is divided into a table of contents, 11 chapters, and 1 appendix as follows:
Chapter 1 - Introduction and Quick Start begins with an overview description and a listing of system
specifications. If you are generally familiar with this type of equipment, the Quick Start section
shows how to hook up a simple system; however, most users will prefer the more detailed startup
procedures in chapter 2.
connectors, hardware hookups, software installation, configuration, and calibration.
Chapter 3 - Using TempView (16-bit) explains the use and features of TempView. Screen prints
show you the pull-down menus, toolbars, charts, and parameter fields discussed in the text.
Chapter 4 - Using PostView discusses the independent PostView program. PostView allows you to
view waveforms recorded by TempView, after the acquisition.
Chapter 5 - Programmer’s Guide explains how to custom-program for your application. Various
concerns are discussed; e.g., a comparison of standard and enhanced APIs and language support.
Chapter 6 - Standard API Programming of the TempBook With C describes several example
programs using the standard API with the C language.
Chapter 7 - Software Calibration and Zero Compensation describes the commands and parameters
related to calibration and zero compensation. This chapter organizes and supplements related
sections of the tbkCommand Reference chapter.
Chapter 8 - Thermocouple Measurement describes the commands and parameters related to
thermocouple measurement. This chapter organizes and supplements related sections of the
tbkCommand Reference chapter.
Chapter 9 - tbkCommand Reference (Standard API) describes the commands and parameters of the
“standard” API including useful reference tables.
Chapter 10 - Programming Models for Enhanced API describes the fundamental building blocks for
TempBook data acquisition software. These programming blocks can then be arranged and
filled with your parameters to make your system do as you please. Program excerpts illustrate
the basic concepts and can often (with modifications) be used in your code.
Chapter 11 - daqCommand Reference (Enhanced API) describes the commands and parameters of
the “enhanced” API including useful reference tables.
Appendix A- Differential Measurement Configurations describes setups for “floating” and
“referenced” differential signal input connections.
CAUTION
CAUTION
CAUTIONCAUTION
Using this equipment in ways other than described in this manual can cause
personal injury or equipment damage. Before setting up and using your
equipment, you should read all documentation that covers your system. Pay
special attention to cautions and warnings formatted like this one.
Software Reference Note:
16-bit PC users can use TempView out-of-the-box (see chapter 3) or program their
own application. Programmers using 16-bit API should refer to chapters 5 through 9.
Chapters 6, 7, and 8 provide examples and explain how to perform common tasks with
the standard API (16-bit) detailed in chapter 9.
32-bit PC users can program their own application. Programmers using 32-bit API
should refer to chapters 5, 10, and 11; chapter 10 explains programming models for the
enhanced API detailed in chapter 11.
Signal Connection ----------------------------------------------------------------------------------------------- 1-3
PC Connection --------------------------------------------------------------------------------------------------- 1-3
Power Connection and Switch --------------------------------------------------------------------------------- 1-4
Software Installation -------------------------------------------------------------------------------------------- 1-4
2 Installation, Configuration, and Calibration
Inspection ------------------------------------------------------------------------------------------------------------------ 2-1
Panel Connectors and Indicators --------------------------------------------------------------------------------------- 2-1
Termination Card and I/O Connectors--------------------------------------------------------------------------------- 2-2
Internal Configuration---------------------------------------------------------------------------------------------------- 2-3
Digital I/O Window ------------------------------------------------------------------------------------------------ 3-4
Charts and the Spreadsheet's "Reading" column --------------------------------------------------------------------- 3-4
TempView Menu Items-------------------------------------------------------------------------------------------------- 3-5
A Programmer’s View of TempBook Operations -------------------------------------------------------------------- 5-1
Driver Options ------------------------------------------------------------------------------------------------------------ 5-3
Standard API (tbk…)-------------------------------------------------------------------------------------------- 5-3
Enhanced API (daq…) ------------------------------------------------------------------------------------------ 5-3
Language Support ----------------------------------------------------------------------------------------------- 5-3
6 Standard API Programming of the TempBook With C
Accessing TempBook from a Windows Program -------------------------------------------------------------------- 6-1
Accessing TempBook from a C for Windows Program ------------------------------------------------------------- 6-1
High-Level Analog Input ------------------------------------------------------------------------------------------------ 6-1
Low-Level Analog Input ------------------------------------------------------------------------------------------------ 6-2
Analog Input in the Background---------------------------------------------------------------------------------------- 6-2
General Purpose Digital I/O Functions -------------------------------------------------------------------------------- 6-4
High-Speed Digital Input ------------------------------------------------------------------------------------------------ 6-4
Counter/Timer Functions ------------------------------------------------------------------------------------------------ 6-5
High-Level Thermocouple Data Acquisition ------------------------------------------------------------------------- 6-6
Thermocouple Linearization -------------------------------------------------------------------------------------------- 6-7
Sample Programs --------------------------------------------------------------------------------------------------------- 6-8
High-Level Analog Input --------------------------------------------------------------------------------------- 6-8
Low-Level Analog Input---------------------------------------------------------------------------------------- 6-9
Analog Input in the Background------------------------------------------------------------------------------6-10
General Purpose Digital I/O----------------------------------------------------------------------------------- 6-11
High-Speed Digital Input-------------------------------------------------------------------------------------- 6-12
Counter Timer Functions -------------------------------------------------------------------------------------- 6-13
High-Level Thermocouple Measurement ------------------------------------------------------------------- 6-14
Low-Level Thermocouple Linearization -------------------------------------------------------------------- 6-15
Command Summary, C Language (Windows) ---------------------------------------------------------------------- 6-17
Initializing the Calibration Constants ------------------------------------------------------------------------- 7-1
Calibration Setup and Conversion----------------------------------------------------------------------------- 7-2
Calibration Example--------------------------------------------------------------------------------------------- 7-2
Zero Compensation------------------------------------------------------------------------------------------------------- 7-3
Zero Compensation Example ---------------------------------------------------------------------------------- 7-4
Automatic Zero Compensation -------------------------------------------------------------------------------- 7-5
Single-Channel Measurement (tbkRdTemp)--------------------------------------------------------------- 8-3
Multiple Measurements from a Single Channel (tbkRdTempN) ---------------------------------------- 8-4
Multiple Channel Measurement (tbkRdTempScan) ----------------------------------------------------- 8-4
Multiple Measurements from Multiple Channels (tbkRdTempScanN) ------------------------------- 8-4
9 tbkCommand Reference (Standard API)
Overview------------------------------------------------------------------------------------------------------------------- 9-1
Commands in Alphabetical Order -------------------------------------------------------------------------------------- 9-2
API Reference Tables ---------------------------------------------------------------------------------------------------9-32
A/D Channel Descriptions------------------------------------------------------------------------------------- 9-32
A/D Gain Definitions------------------------------------------------------------------------------------------- 9-32
A/D Trigger Source Definitions ------------------------------------------------------------------------------ 9-32
Pretrigger Functions Trigger Source Definitions----------------------------------------------------------- 9-33
Thermocouple Types------------------------------------------------------------------------------------------- 9-33
API Error Codes - C Languages ------------------------------------------------------------------------------ 9-33
API Error Codes - QuickBASIC------------------------------------------------------------------------------ 9-34
API Error Codes - Turbo Pascal ------------------------------------------------------------------------------9-35
API Error Codes - Visual Basic ------------------------------------------------------------------------------9-36
TempBook User’s Manual,
11-14-00
iii
10 Enhanced API Programming Models (TempBook)
Overview------------------------------------------------------------------------------------------------------------------ 10-1
Data Acquisition Environment----------------------------------------------------------------------------------------- 10-1
Application Programming Interface (API) ------------------------------------------------------------------10-1
Enhanced vs Standard API ------------------------------------------------------------------------------------ 10-1
Hardware Capabilities and Constraints ---------------------------------------------------------------------- 10-1
Signal Environment -------------------------------------------------------------------------------------------- 10-2
Initialization and Error Handling ----------------------------------------------------------------------------- 10-3
Foreground Acquisition with One-Step Commands ------------------------------------------------------- 10-5
Temperature Acquisition Using One-Step Commands ---------------------------------------------------- 10-7
Counted Acquisition Using Linear Buffers ----------------------------------------------------------------- 10-9
Indefinite Acquisition, Direct-To-Disk Using Circular Buffers---------------------------------------- 10-11
Multiple Hardware Scans, Software Triggering ---------------------------------------------------------- 10-14
Background Acquisition ------------------------------------------------------------------------------------- 10-16
Temperature Acquisition Using TC Conversion Functions--------------------------------------------- 10-18
Double Buffering --------------------------------------------------------------------------------------------- 10-21
Direct-To-Disk Transfers ------------------------------------------------------------------------------------ 10-23
Transfers With Driver-Allocated Buffers------------------------------------------------------------------ 10-26
Summary Guide of Selected Enhanced API Functions----------------------------------------------------------- 10-28
11 daqCommand Reference (Enhanced API)
Overview------------------------------------------------------------------------------------------------------------------ 11-1
Commands in Alphabetical Order ------------------------------------------------------------------------------------- 11-2
API Reference Tables ------------------------------------------------------------------------------------------------- 11-35
This chapter describes the TempBook in general terms including specifications. Also, a Quick Start can
help you get a simple system up and running (chapter 2 has more detailed installation inst ructions).
Description
1
TempBook/66 Block Diagram
The TempBook/66 adds voltage and thermocouple measurement capability to notebook PCs for portable
test applications. The TempBook also provides an effective alternative to plug-in boards for desktop PCs.
The TempBook provides 12-bit, 100 kHz data acquisition and can support up to 800 Kbyte/s data transfer
to a PC via an enhanced parallel port interface or PCMCIA link. The unit can also connect to a standard
parallel port and transfer readings directly to disk at up to 100K readings/s. As an external module with the
same footprint as a typical notebook PC, the TempBook can be attached directly under a notebook PC for
portability.
The TempBook has a built-in analog capability that permits it to measure 8 channels in a differential mode
or 16 channels in single-ended mode. Its on-board programmable-gain instrumentation amplifier can be set
to gains of ×1, 2, 5, 10, 20, 50, 100 or 200 on a per channel basis. Its A/D converter scans selected
channels at a constant 10 us/channel rate, minimizing the time skew between consecutive channels. The
time between the start of each scan sequence can be programmed to start immediately or at intervals of up
to 10 hours. The TempBook features a hardware-based digital/TTL trigger that minimizes trigger latency to
less than 10 us. The TempBook can also be triggered from a command from the PC.
The TempBook/66 can be powered by an included AC adapter, a standard 12V car battery, any +9 to 20
VDC source, or an optional rechargeable nickel-cadmium battery module (DBK30A). This makes it ideal
for field and remote data acquisition applications.
Software included with the TempBook includes TempView and PostView. TempView is a 16-bit
Windows-based program that allows you to set up your acquisition and save acquired data directly to disk.
The package also includes thermocouple linearization for direct readout of temperatures. PostView is a
Windows-based post application waveform display application that permits you to display previously
acquired data.
TempBook User’s Manual,
11-14-00
Introduction and Quick Start 1-1
In addition, the TempBook/66 includes DOS drivers for Quick Basic, C, and Pascal; Windows drivers for
Visual Basic and C for Windows. Several graphically analysis and control software packages also support
the TempBook/66. These include DASYLab, Snap-Master, LABTECH NOTEBOOK and LabVIEW.
Available Accessories
Additional accessories that can be ordered for the TempBook/66 include:
•
DBK35 PCMCIA interface card and cable
•
DBK30A Rechargeable battery module
Specifications
General
Connector
user signals are connected vi a screw terminals on a removabl e
screw-terminal card.
Thermocouple Types
Input Ranges
Unipolar
Bipolar
Analog Inputs
differential thermocouple inputs
Analog-to-Digital Converter
unsigned binary output format .
Cold Junction Sensor Output
Input Impedance
channel basis in parallel with 100 pF
Input RC Filter -3dB Frequency
per channel basis
Gain Accuracy
Maximum Input Voltage
CMRR (Input Stage)
Offset
Offset Drift
Channel Sequencer
Depth
Speed
Interval Between Scans
: Connects to a PC via an inc l uded paral l el port cable;
: J, K, S, T, E, B, R & N
:
: .05, 0.1, 0.2, 0.5, 1, 2, 5 V
: ±0.25, .05, 0.1, 0.25, 0.5, 1, 2.5, 5 V
: 8 differential or 16 single-ended vol tage or 8
: 12-bit with no missing codes,
: 100 mV/°C
: 100K/100M Ohm, Switch-sel ectable on a per-
: 15.9 kHz switch-selectable on a
: 0.1%
: ±15 V
: 90 dB typ, DC to 60 Hz
: Software-compensated
: Software-compensated
: 512 locations
: 10 µs per channel, f i xed
: 10 µs to 10 hours, software-
: Sequencer programmable on a per-channel basis.
: Sequencer programmable on a per channel
: Software programmable for al l
(°C )(°C )(<°C )(>°C )Type<0°C>0°C
Digital I/O
Inputs
Number
Outputs
Trigger Input
Counter/Timer Port
Device
Number
Clock
Usage
Type
Input High Voltage
Input Low Voltage
Output High Voltage
Output Low Voltage
Thermocouple
Resolution (°C)
: 8 fixed as inputs
Usage
: General-purpose register addressable or hi gh-speed
scanned via channel sequencer
Type
: TTL-compatible
High Voltage
Low Voltage
Number
Usage
Type
: TTL-compatible
High Voltage
Low
Voltage: 0.4V @ 2.5 mA sink
Type
: TTL-compatible
High Voltage
Low Voltage
: 8254 (P0 only)
: Internal 100 kHz or external up to 10 MHz
: Register addressable
: TTL compatible
: 2.0 V min
: 0.8 V max
: 8 fixed as outputs
: General-purpose register addressable
: 3.0 V @ 2.5 mA sourc e
: 2.0 V min
: 0.8 V max
: 1 gate input, 1 clock input & 1 output
: 2.0 V min
: 0.8 V max
: 3.0 V @ 2.5 mA sourc e
: 0.4 V @ 2.5 mA sink
1-2 Introduction and Quick Start,
11-14-00
TempBook User’s Manual
Quick Start
For those users who wish to get their TempBook up and running as quickly as possible, this section
provides a brief explanation of the steps required. Note: unless already familiar with this type of system,
most users will need to read chapter 2, Installation and Configuration.
Signal Connection
The thermocouple and volt age input signals are fed to the TempBook through a removable termination
card. To remove this card, rotate the ejector handle with your thumb or finger. Once removed, the
thermocouple or voltage connections should be made as shown in the figure.
PC Connection
Signal Connections, Differential and Single-Ended
Note: When connecting thermocouple or other low-level signals in addition to high-level signals, connect
the low-level signals to the lowest numbered channels with connections in ascending order of signal
magnitude.
The DIP switches located on the termination card connect optional biasing resistors as well as input filters.
•
For thermocouple or other differential inputs, these switches should be closed to provide the required
bias current path.
•
For single-ended inputs these switches can be optionally opened or closed.
For further details, refer to section Termination Card and I/O Connectors in chapter 2.
The TempB ook communicates with a lap t op or desktop computer through the paral lel printer port. Connec t
the supplied cable to the computer’s parallel port and the TempBook's parallel port.
TempBook User’s Manual,
11-14-00
PC-to-TempBook Connection
Introduction and Quick Start 1-3
Power Connection
The TempBook is typically powered from the supplied wall-mount converter or from an optional DBK30A
battery module. The wall-mount converter plugs into any standard 110 VAC wall outlet and its other end
plugs into the circular DIN5 receptacle on the TempBook's rear panel. If using the battery module, please
refer to the section Rechargeable Battery Module in chapter 2.
Software Installation
The TempBook/66 comes with a Microsoft Windows application (16-bit TempView) that provides the
easiest means to collect data from the TempBook. To install the software insert the installation CD into
your PC’s CD drive. After agreeing with the legal statement a master setup screen will appear (see
following figure).
TempBook Power Connection
Selecting TempBook Support from the Master Setup Screen
After selecting TempBook Support, click Start Install and follow the on-screen prompts.
Once the setup program has installed the software, a TempBook program group will appear within
Windows. To start TempView, click on its program icon. The main window will soon display a
spreadsheet of channels in rows and channel parameters in columns.
For information regarding the use of TempView, refer to chapter 3.
1-4 Introduction and Quick Start,
11-14-00
TempBook User’s Manual
Installation, Configuration, and Calibration
Inspection
The TempBook components were carefully inspected prior to shipment. When you receive your data
acquisition system, carefully unpack all items from the shipping carton and check for any obvious signs of
physical damage that may have occurred during shipment. Immediately report any damage to the shipping
agent. Retain all shipping materials in case you must return the unit to the factory.
Every TempBook is shipped with the following items:
•
TempBook Data Acquisition System
•
User's Manual
•
Installation CD
•
Calibration Constants Disk
•
Accessory Kit, including: CA-35-2 (2 ft parallel port cable) and an AC Adapter
Panel Connectors and Indicators
The TempBook front panel consists of 3 status-indicator LEDs. The rear panel consists of the power
switch, power input, two DB25s for parallel port connection and pass-thru, and a slot to accept the input
termination card. The function of each of these components is described below.
TempBook Panel Connectors and Indicators
POWER SWITCHThis rocker arm switc h t u rns on the DC power to the TempBook when the "1" si de
POWER INPUTThis input connector ac cepts +7 VDC to +20 VDC.
TO PARALLEL PRINTERThis parallel port can connect to any standard parallel pri nter. This allows the
FROM PC PARALLEL PORTThis parallel port connects directly to the PC's parallel printer port. This all ows
POWERThis LED is ON when power is applied to the TempB ook (and the power switch is
ON-LINEThis LED is ON when the TempBook is in an Active state. OFF, when the
A/D ACTIVEON during an A/D scan sequence. I f the sequence has a smal l number of steps
of the switch is depressed.
user to attach both the TempBook and a parallel printer to the s ystem
simultaneously.
the host system t o communicate with the TempBook.
in the ON position). OFF, if power is not pres ent.
TempBook is not enabled or in t he pri nter pass through mode.
and occurs infrequently, this indicator will only flash briefly.
2
TempBook User’s Manual,
11-16-00
TempBook Front and Rear Panels
Installation, Confi gurat i on, and Calibration 2-1
Termination Card and I/O Connectors
The TempBook/66 accepts all analog and digital I/O signals via a removable termination card (see figure).
This termination card has six screw terminal strips, a CJC temperature sensor, and input R/C filters which
also provide a bias current return path for the TempBook's instrumentation amplifier. The filters/bias
resistors are switch-selectable on a per channel basis.
TempBook Termination Card
Terminal strips J2 and J3 provide analog input signal connection. Note that the terminals are arranged in
differential pairs for easy thermocouple connection. These terminal strips also provide analog signal
common connections for convenient r eferencing of single -ended input signa ls.
Terminal strips J4 and J5 provide connections for the eight digital outputs and the TTL trigger input. These
terminal strips also provide ground connections for referencing digital signals. Terminal strips J6 and J7
provide connections for the eight digital inputs, the pacer clock output (OUT2), and the three counter/timer
(8254 P0) I/O signals.
The thermocouple or voltage connections should be made as shown in the following figure.
Analog Signal Connection
Note: When connecting thermocouple and other low-level signals in addition to high-level signals, the lowlevel signals should be connected to the lowest numbered channels with connections following in ascending
order of signal magnitude.
2-2 Installation, Confi gurat i on, and Calibration
11-16-00
TempBook User’s Manual
Each of the 16 analog input channels is configured as shown in the figure (also, refer to the appendix for
more information on wiring differential inputs).
The series resistance and shunt capacitance for m a singl e-pole
low-pass filter with a corner freque ncy of 15.9 kHz. The shunt
resistance provides the bias current path for the instrumentation
amplifier.
When reading thermocouples, these filters should be switched in.
If the filters are not used with thermocouples or any other
differential input, then the user must provide a bias current return
path to signal common. Note that for each differential
channel, two DIP switches need to be set.
Internal Configuration
To open the unit, place the TempBook on a flat surface. Remove
the screw on the top rear of the case, and slide out the top cover.
Reverse this procedure to assemble the unit.
The internal configuration of a TempBook/66 consists of setting
the following jumpers to reflect the desired mode of operation:
•
Time Base (JP9)
•
Watchdog Timer Enable (JP8)
The location of each jumper is shown in the figure.
Watchdog Timer Enable/Disable (JP8)
This 3-pin header allows the elective use of the TempBook watchdog timer
function. If using a printer with the TempBook, the watchdog timer should be
enabled to allow the TempBook to be most reliably reset by the host computer.
Note that enabling the watchdog timer might impede background
measurements. If the user is not going to attach a printer, the timer is optional.
The default setting is Watchdog Timer Disabled. To enable, place the shunt
jumper in the enabled position as shown in the figure. To disable, place the
jumper in the disabled position, as shown.
Time Base Selection (JP9)
This 2×2 header allows the user to select one of two oscillator derived
frequencies to be applied to the pacer clock (8254 P1 & P2). The pacer clock
sets the interval between scans in continuous trigger mode. The two frequencies
are 1 MHz and 100 kHz. The most useful range of clock output frequencies for
the average user would be provided by the 1 MHz setting (the default setting).
Hardware Installation
Connect the TempBook to any P C parallel p rinter por t (female DB25 ) by unplugging the pri nt er cable and
plugging the male end of the supplied cable (CA-35) into the computer and the fe male end into the mating
connector on the TempBook. Any printer port (LPT1, LPT2, or LPT3) may be used but should be noted
for use in software installation.
TempBook allows for LP T pass-through for simultaneous data acquisition and printer operation. When
using a printer in the system, attach the original printer cable male DB25 into the mating connector on the
TempBook.
The TempBook may be powered by the supplied AC adapter that plugs into any standard wall outlet or
from an isolated 7-20 VDC source of 1-2 A.
If using the power adapter, plug it into a 120 VAC outlet, and attach the low voltage end to the jack on the
TempBook. Turn ON the power switch, and the POWER LED should be on.
TempBook User’s Manual
11-16-00
Installation, Confi gurat i on, and Calibration 2-3
At power-on, the printer should behave normally and can be checked by issuing a
command (or any other convenient method of checking the printer). (Installation of the software will be
necessary before the TempBook can perform any functions.)
Rechargeable Battery Module (DBK30A)
For portable applications where external AC or DC power is not available, the DBK30A rechargeable
nickel cadmium battery module can be used with the TempBook/66. This module is housed in a r ugged
metal package that is the same size as the TempBook. It also comes with high-strength Velcro tabs that
allow convenient mounti ng underneath the TempBook/66.
The DBK30A is a revised combination of the DBK30 and DBK31 battery modules. There is an internal
slide switch which determines whether a DBK30A will act as a DBK30 or DBK31.
Note: Only the DBK30 mode should be used with the TempBook/66.
The DBK30 operating mode provides 14.4 VDC at 3.4 A-Hr. This setup can power the TempBook for 3 to
6 hours depending on the application. The battery module has built-in automatic battery-charging circuits,
which quickly and safely recharge the internal batteries when connected to the supplied AC adapters. The
only requirement for trouble-free operation is for the user to fully charge the battery module before
attempting to use it.
Charging the Battery Modules
The DBK30A package includes a charger for the intended line voltage (either 120 VAC or 230 VAC). To
charge the battery module, plug the output cable from the charger into the POWER IN connector on the
DBK30A, and plug the charger into an appropriate source of AC power (see figure). The charge cycle will
be initiated automatically, and the batteries will be fully charged after the charging cycle terminates.
Power
Source
PS-22 or PS-22E
START CHARGE
32:(5,1
729'&
32:(528772'DT%RRN
PRINT SCREEN
DBK30
Start Charge
Power In
Connecting the Charger
To initiate another charge cycle, depress the START CHARGE momentary rocker-arm switch. Subsequent
charge cycles applied to a fully charged DBK30A will have no ill effect because the DBK30A will sense
the fully-charged status of the batteries and revert to the trickle-charge state within a few minutes.
There 3 LED status indicators on the DBK30A provide information on the charge process or external load
as noted in the table.
Power In
Battery Charging
Power Out
Illuminated when the charger is connected to a source of AC power and to the bat tery
module.
Illuminated steadi l y while battery is in the high current (2-amp) charge mode.
Flashing briefly, one or two flashes at a time, when the internal batt eri es are fully charged.
Illuminated steadi l y when an external TempB ook product is connected and drawing current
from the battery modul es.
2-4 Installation, Confi gurat i on, and Calibration
11-16-00
TempBook User’s Manual
Battery Module Connection
The DBK30A package includes a short connecting cable (CA-115) to connect to the TempBook. This
cable connects the Power Out connector on the DBK30A to the Power In connector on the TempBook (see
figure).
The run time available from a DBK30A operating a TempBook will depend on what the TempBook is
doing. This time can be as little as 3 hours or as much as 6 hours.
The DBK30A must periodically be fully discharged or the cells may develop "lazy
chemistry" that may limit storage capacity. (This “memory” is characteristic for
nickel-cadmium batteries.) To manually discharge a battery pack, connect a
TempBook, and leave it turned on until the indicator lights go dark.
Connecting the TempBook to the Battery Module
&$87,21
Parallel Port Capabilities
The TempBook includes a test program which verifies your computer's parallel port, testing its standard and
enhanced capabilities.
•
Standard LPT ports on an IBM compatible computer have two modes to read data from the printer
port: 4-bit and 8-bit. The 8-bit mode is somewhat faster than the 4-bit, but not all printer ports support
this mode.
•
Enhanced parallel ports (EPP) are parallel p orts which include additional hardware that allows the
TempBook to communicate with the PC at 3 to 10 times the speed possible with standard parallel
ports. This greatly improves data acquisition performance.
Enhanced parallel ports require special hardware, and only certain computers are EPP capable. Most laptop
computers that use the Intel 386SL or 486SL chip set (which includes the 82360 I/O Controller) are EPP
capable. For those computers which have plug-in card slots, EPP adapter cards are available. You may
wish to contact your computer's manufacturer for details about your machine and possible adapter cards.
The TempBook test program, TEMPTEST.EXE (described in a later section) should be run to determine
the PC's printer port capabilities.
Note: To take a dvantage of the improved performance of EPP when using a programming language, you
must add the software command
the command description in the Command Reference section of this manual.
tbkSetProtocol
(standard API) to your program. For details, refer to
TempBook User’s Manual
11-16-00
Installation, Confi gurat i on, and Calibration 2-5
TempBook Configuration Under Windows 95/98
Note: The TempBook/66 software installation is discussed in chapter 1.
This section describes the configuration of TempBook devices under the Windows 95/98 operating systems.
A configuration utility is supplied via a control panel applet. The Daq Configuration applet allows you to
add a devic e, remove a devi ce, or change existing configurati on settings. Daq Configuration also has a
built-in test utility to test the device. The test utility provides feedback on the validity of the current
configuration se ttings as well as provi ding relevant performance summaries.
Daq Configuration can be found in the Windows 95/98 control
panels and can be executed any time that it is desirable to add,
remove or change device configur ation settings. Daq
Configuration may also be entered during driver installation.
The following description applies to either method.
The Daq Configuration/Device Inventory scre en at right will
display all currently configured devices. Displayed devices are
indicated by their name and an identifying icon which indicates
the device type. If no devices are currently configured, no
devices will appear in this field.
The 4 buttons across the bottom of the Daq Configuration
screen are used as follows:
•
Properties. Current configuration settings for a device
can be changed by bringing up the corresponding
properties screen. To do so, double-click the device icon
or single-click the device and then double-click the
Properties button.
•
Remove. The R
removed if it is no longer installed or if the device’s configuration no longer applies. Note: if a device
is removed, applications may no longer access the device. However, the device can be re-configured
at any time using the Add Device function described below.
•
Close. The C
•
Add. The A
configuration whenever a new device is added to the
system. Failure to perform this step will prevent
applications from properly accessing the device. Doubleclicking the Add Device button will display a window as
shown in the figure.
emove button is used to remove a device from the configuration. A device may be
lose button may be used at any time to exit the Daq Configuration applet.
dd Device button is used to add a device
Use the scroll bar to find the TempBook device type to be
configured. Once found, click the device t ype (the type should
then appear in the main edit box). Now double-click the OK
button.
The next screen displays the properties for the TempBook
device with the default configuration settings. Fields include:
•
The Device Name field is displayed with the default
device name. However, this field can be changed to any
descriptive name as desired. This device name is the name to be used with the
(see enhanced API chapter) to open the device.
•
The Device Type field should indicate the device type which was initially selected. However, it can
be changed here if necessary.
•
The Protocol field is used to set the parallel port protocol for communicating with the TempBook.
Depending on your system, not all protocols may be available.
Note: IRQ Setting and DMA Setting for the TempBook are currently not configurable. These fields are
reserved for future use.
2-6 Installation, Confi gurat i on, and Calibration
11-16-00
daqOpen
TempBook User’s Manual
function
When all fields have been changed to the desired settings,
you can click:
•
the Apply button to store the configuration.
•
the OK button to store the configuration and exit the
current property screen.
•
the Cancel button to exit the current device
configuration property screen without storing any
changes.
•
the Test Hardware tab to test the current stored
configuration for the device. This selection will bring
up the Test property screen. Note: the next figure
displays results from a previously run test. Initially, the
screen will show no test results.
Before testing the TempBook, make sure the device has been
properly installed and powered-on. Make sure the parallel
port cable is firmly in place on both the TempBook and the
proper LPT port in the computer.
Note: Testing the TempBook device may, in some cases, cause the system to hang. If test results are not
displayed in 30 seconds or the system does not seem to be responding, reboot the system. Upon
power-up, re-enter the Daq Configuration and change the configuration settings to those that work
properly. To test the current stored configuration for the device, click the Test button. Test results
should be displayed within a few seconds. The test results have 2 components: Resource Tests and
Performance Tests.
Resource Tests
The resource tests are intended to test system capability for the current device configuration. These tests
are pass/fail. Resource test failure may indicate a lack of availability of the resource or a possible resource
conflict.
Base Address Test
•
- This test will test the base address for the selected parallel port. Failure of this
test may indicate that the parallel port is not properly configured within the system. See relevant
operating system and computer manufacturer’s documentation to correct the problem.
Performance Tests
The performance tests are intended to test various TempBook
functions with the current device configuration. These tests
give quantitative results for each supported functional group.
The results represent maximum rates at which the various
operations can be performed. These rates depend on the
selected parallel port protocol and will vary according to port
hardware capabilities.
ADC FIFO Input Speed
•
maximum rate at which data can be transferred from the
TempBook’s internal ADC FIFO to computer memory
through the parallel port. Results are given in
samples/second (sample is 2 bytes in length
representing a single A/D count).
- This test will test the
TempBook User’s Manual
11-16-00
Installation, Confi gurat i on, and Calibration 2-7
Connection Troubleshooting
If communications cannot be established with the TempBook or if trying to connect causes the system to
hang or crash, then you should:
•
Check that TempBook’s power LED is ON. If not ON, verify power connection between the
TempBook and the power source.
•
Make sure the LPT cable is firmly attached to the computer’s proper LPT port and to the TempBook
port labeled “TO COMPUTER”.
•
Check that the desired LPT port has the proper resource configurations. The base address and IRQ
level must be properly configured and recognized by the operating system. The parallel port must be
capable of generating interrupts for proper operation. (This information may be obtained in the
Device Manager in the Control Panel of the operating system). More information on this subject can
be found in the
•
Check the BIOS settings for the LPT port. Make sure the BIOS LPT protocol settings are compatible
with the settings selected for the LPT port with the Control Panel applet.
•
Make sure the Daq Configuration Applet has been run and the proper LPT port and protocol have
been selected for the device. The Daq Configuration applet can be found in the Control Panel of the
operating system. The Test Hardware function in the control panel applet can be used to confirm
proper communication with the device.
readmew.txt
Calibration of TempBook
The TempBook/66 is factory calibrated for gain and offset. After calibration, the unit is characterized for
gain and offset errors, and software correction constants are calculated. For users who wish to use these
constants within their own programs, see the Software Calibration and Zero Compensation chapter.
file in the current software release.
Calibration Constants File Installation
Each TempBook is shipped with a disk containing a calibration constants text file. The file is named
serial_no.cal where serial_no is the serial number of the TempBook for which the constants were generated.
The default calibration constants filename assumed by TempView is tempbook.cal.
The following command can be used to copy and rename the file if executed from the floppy disk drive.
Since the TempBook is factory characterized after calibration, user recalibration is not recommended.
However, one exception to this recommendation is the calibration of the TempBook's internal 5V reference.
This 5V reference is used to level-shift the amplified analog input signal for unipolar measurements.
Reference-voltage drift is not compensated for with zero compensation; and therefore, periodic
recalibration can improve unipolar measurement accuracy.
The following char acteristics ca n be calibrated through po t entiometer adjustments on the TempBook main
board:
•
5V Reference Voltage
•
Instrumentation Amplifier Offset
•
Level Shift Amplifier Offset
•
ADC Offset
•
ADC Span
The TempBook includes a simple calibration program that can be used to perform these adjustments. If the
user is only performing the reference voltage adjustment, then only a 4-1/2 digit DMM is required. If the
user is performing the full TempBook calibration, then an adjustable voltage calibrator is also required.
A Microsoft Windows program, TEMPCAL.EXE, is provided to perform calibration of the TempBook. To
use this program, install the TempBook Windows support and launch the TEMPCAL program; follow the
on-screen instructions.
2-8 Installation, Confi gurat i on, and Calibration
11-16-00
TempBook User’s Manual
Using TempView
TempView is a 16-bit graphical Microsoft Windows application for operating TempBook hardware.
No programming knowledge is required to operate this application. TempView allows you to set up an
application to acquire data and save it directly to disk with the ability to transmit the data to other Windows
applications, such as spreadsheets and databases. TempView provides the following capabilities:
•
Set up all of the analog input parameters, then acquire and save the data to a disk file.
•
Exercise TempBook’s digital I/O section.
•
Exercise the counter/timer.
•
Launch PostView, an independent application to graphically view waveforms previously recorded by
TempView. PostView is discussed in chapter 4.
Application Startup
If you have not already installed TempView, refer to chapter 1 of this manual. To launch the application,
double-click the TempView icon. TempView holds many user-configured parameters which can be saved
to disk. The default configuration file name is “TEMPVIEW.CFG”. TempView will then proceed to
search the working directory for the TEMPVIEW.CFG configuration file. The following conditions may
apply:
•
If the default configuration file is found, all the required setup information will be extracted from it,
and the application's main window will open.
•
If the default configuration file is not found, TempView will try to connect with the TempBook
hardware with the following default parameters: Printer Port LPT1, Interrupt Level 7, and 4-bit
Standard Protocol.
•
If connection with the TempBook is established, the applications main window will open with default
setup.
•
If all of the above fails to establish communications with the TempBook, then a dialog box will appear
asking whether or not you want to open a different setup file. Answering “Yes” will open another
dialog box where you can select your file. If this is the first time you have used this application, no
saved setups will be available; select “No”.
•
If a configuration file is selected, no further dialog boxes will appear, all the required setup
information will be extracted from it, and the applications main window will open.
•
If no user configuration file is selected or found, or communications is not established, the next dialog
prompts the user to choose a real instrument or a simulated instrument. If the hardware is not
available and you just want to try out the software, select Simulated Instrument. The Simulated
Instrument mode allows you to exercise all the software functions without any hardware installed. If
the TempBook hardware is connected and switched on, select Real Instrument.
•
If Real Instrument was selected, an additional dialog box will appear, prompting you to select the LPT
port that the hardware is connected to, the interrupt level of that port, and the parallel port protocol to
use.
3
TempView will attempt to find the TempBook on the specified LPT port. If the hardware is found, the
application's main window will open. If no hardware is found, a message appears and the application will
open with the controls disabled.
To reconfigure the LPT port setting and try again, click Select LPT Port under the Select Port menu. If the
TempBook hardware still cannot be identified by the software, exit TempView and try the TEMPTEST
utility program.
TempBook User’s Manual,
11-16-00
Using TempView (16-bit) 3-1
TempView Components
The figure shows TempView’s main window that has areas for the following:
•
Analog input spreadsheet to summarize system configuration and show current readings
•
Trigger configuration, e v ent type and edge
•
Sequence repetition rate, number of scans, and averaging enable
•
Data destination (filename and data format)
•
High-speed digital input enable
•
Signal reference type
Analog Input Spreadsheet
The input spreadsheet allows the analog input channels to be configured and displayed. The spreadsheet
consists of rows and columns much like a standard accounting spreadsheet.
•
Each
•
The
The 7 columns for each row are used as follows:
CH
rows by the corresponding analog input channel to configure.
ON
corresponding input during an acquisition. An acquisition consists of reading data to disk, either to charts
or the input reading column of this spreadsheet. When a cell or block of cells in this column is selected, a
selection box will appear above the spreadsheet that allows a "Yes" or "No" choice to enable or disable the
channel. Double-clicking a cell in this column will toggle the channel status. The Make All Channels
Active and Make All Channels Inactive menu items under the Edit menu can be used to globally change all
channels to a "Yes" or "No".
Type
block of channels. Double-clicking a cell or block of cells in this column will select the next available gain
or type.
row
selected; or 8 rows if differential inputs are selected.
columns
cells to be altered simultaneously while others allow only one cell to be changed at a time. Clicking a
column header will select the entire column if possible.
- The channel-number column labeled "CH" is static and cannot be altered. This column identifies
- The column labeled "On" allows you to select whether or not data will be collected from the
- The "Type" column allows you to set the thermocouple or gain type for the selected channel or
TempView’s Main Window
configures a single analog input channel. There are 16 rows if single-ended inputs are
contain the configuration information for each channel. Some columns allow blocks of
3-2 Using TempView (16-bit)
11-16-00
TempBook User’s Manual
Pole - The "Pole" column shows the state of the channel polarity which can be either unipolar or bipolar.
The channel polarity can be programmed on a per channel basis. If a cell or block of cells in this column is
selected, a selection box will be displayed above the spreadsheet with the selections "Uni" and "Bi" when
the cell is selected. Double-clicking in one of these cells will toggle the polarity.
Label - The "Label" column contains a descriptive name for the input channel. By default it contains a
label similar to its channel number; however, you can enter a more relevant, descriptive label of 8
characters. This label will be used when selecting a specific channel in the analog trigger and chart
selection lists. This column does not have a selection list above the spreadsheet and does not allow
selecting blocks of cells.
Units - The "Units" column allows you to change the
engineering units of each channel and apply a linear equation to
the data read from the TempBook. When a cell or block of cells
in this column is selected, a selection box is displayed
containing mX+b as well as common engineering units (see
figure). Selecting mX+b will pop up a window that allows the
m and b of this equation and the engineering units label to be
defined. The engineering units will then be displayed in the
"Units" column, and the mX+b equation will be applied to the
reading from the TempBook before the reading is displayed or
written to disk. The X in this equation is the voltage or the degrees in Celsius read back from the
TempBook. For example, if a TempBook channel is configured as bipolar and unity (×1) gain, the default
voltage would be ±5 V. This corresponds to an m of 1, a b of 0 and an engineering unit of V. This could be
changed to millivolts by setting m to 1000 and units to mV. This column could also be used to perform a
software calibration of the TempBook. This is performed by reading known inputs at two different points
of the input voltage range (usually at 0 and full scale) and solving the equation y = mX+b. The full-scale
voltage, which changes according to the gain of the channel, is 5V/gain for bipolar channels and 10V/gain
for unipola r channels.
Reading - The "Reading" column can display the analog input readings of the TempBook. This column
cannot be altered by the user and is enabled by selecting Enable Input Reading Column under the
Acquisition menu. This column will update the readings as fast as the computer will allow. If data is being
written to disk while this column is enabled, it will be updated whenever possible. The spreadsheet cannot
be altered while the input reading column is enabled.
In addition to the analog inputs, there is one 8-bit digital input channel accessible on the termination card.
This high-speed digital input, which is read at the same rate as any analog inputs, can be enabled or disabled
by clicking the "ChanOn" checkbox in the lower right of the analog input spreadsheet.
Acquisition Configuration
The acquisition configuration section of TempView’s main window is just to the right of the analog input
spreadsheet. This section has 5 parts: the Trigger, Scan Frequency, Number of Scans, Signal Conditioning,
and Data Destination sections. These sections allow you to set up all of the acquisition parameters for the
analog inputs and the high-speed digital input channel. The analog acquisition configuration includes
parameters fo r setting up a tri gger source, the scanning frequenc y after the trigger i s satisfied, the numbe r of
scans to take after the trigger, and the file name for the collected data. These settings will be used when an
acquisition-to-disk is started by selecting "Go" under the acquisition menu.
Trigger - The Trigger section selects the source of the trigger. When the trigger is satisfied, the scans are
collected at the selected scan frequency and stored to disk. The sources are: Key Hit, which arms the
acquisition and waits for the user to hit a key; and External TTL, which waits for a falling or rising edge on
the 'trig' input terminal on the termination card.
Sequence Rep Rate - The scan frequency can be set in units of seconds, minute s and hours. Movi ng the
slide switch changes the rate. The cursor can also be placed in the numeric field and a number can be
entered directly. The maximum scan frequency is dependent on the number of channels that are enabled
and whether or not averaging is enabled. Enabling more channels or enabling averaging will lower the
maximum scan frequency.
Signal Cond Averaging - The Averaging checkbox enables or disables averaging of the analog input data.
Averaging can be used to increase the effective accuracy of a noisy signal. Averaging will increase the
TempBook User’s ManualUsing TempView (16-bit) 3-3
actual scan frequency and number of scans, but the perceived scan frequency and number of scans (which is
set by TempView) does not change.
No. of Scans - The number of scans can range from 1 to 100,000. A scan includes all of the channels that
are marked as "On" in the analog input configuration spreadsheet.
Data Destination - This section contains the file name and type of file(s) that exist after an acquisition-todisk is complete. A file name can be typed in directly or the Browse Files button can be pressed to open a
file-selection dialog box. The selected file will be placed directly into the filename field. During an
acquisition, a raw binary file is created and updated as data is read. After the acquisition is complete, an
ASCII text file and PostView binary file can be created if the appropriate checkbox is enabled. Both of
these files can be read by PostView (described later in this chapter). If the raw binary checkbox is not
enabled, the raw binary file will be deleted after creating the PostView or ASCII file.
After the acquisition is started, these parameters can not be altered.
Counter/Timer Window
The counter/timer window is displayed when ctr/tmr is selected under the Windows pull-down menu. This
window allows configuration of the 8254's counter 0. Counter 0 is configured by selecting its function,
clock source and initial count. When the Start Timer button is clicked, the counter configuration will take
place.
Counter/Timer Window
Digital I/O Window
The digital I/O window is displayed when digital I/O is selected
under the windows menu. This window provides interactive control
of the 8 digital input lines and 8 digital output lines on the
TempBook termination card. Select output values by clicking on the
output witches which toggle between 0 and 1—or you can enter the
hex value and <Enter>; the switch positions will update to reflect the
new setting. When the Execute button is pressed, all output lines
will be updated and all input lines will be read.
Charts and the Spreadsheet's "Reading" Column
Up to 4 charts can be displayed by selecting charts under the Window menu. Before the charts can be
enabled, at l east one chart must be assigned a channel t hrough the channel’s drop-down list. When a
channel is selected, you can change the minimum and maximum values displayed in the chart (see figure).
This can be done whether or not the charts are currently enabled.
The charts and the spreadsheet Readings column are independently enabled. The charts can be enabled
under the Charts menu of the Charts window. The Readings column can be enabled under the Acquisition
menu of the main TempView window. These windows provide instant feedback of the analog input
readings.
Data is read and displayed in the charts and Readings column as fast as the computer will allow. When an
acquisition to disk has b egun using the Go command under the Acquisition menu, the charts and the
spreadsheet Reading column take a lower priority, updating only when there is sufficient time in the
acquisition-to-disk task. Therefore, the data seen in the charts may not be an accurate reflection of the data
3-4 Using TempView (16-bit)
11-16-00
TempBook User’s Manual
that is being placed on the disk. As the scan rate is increased, the acquisition-to-disk task will take up more
processor time and the charts will be unable to keep up.
TempView Menu Items
File
The file menu provides four b asic functions:
NewSet all parameters to their startup setting.
SaveSave the existing configuration for later recall.
LoadLoad a saved configuration.
Convert Binary to ASCIIConvert a previously acquired binary file to an ASCII file that can be read by
Convert Binary to PostView BinaryConvert a previously acquired binary file to a binary file t hat can be read by
ExitLeave the TempView program.
Edit
The Edit menu includes the following functions:
Make All Channels InactiveThis command places a "No" in the On field of all of the channels. I f your channel
Make All Channels ActiveThis command places a "Yes" in the On f i el d of all of the channels.
Fill DownWhen multiple cells within a column are selected, this command takes the top-
TempView Display Charts
spreadsheets or other analysis programs.
the PostView application.
scan includes only a few channels, it may be easier to make all of the channels
inactive, then turn on only those few channels that you want.
most selected cell and copies its c ont ents in the selected cel l s below.
TempBook User’s ManualUsing TempView (16-bit) 3-5
Select Device
Window
Acquisition
The Select D evice menu includes the following functions:
Select LPT PortBrings up a dialog box prompting the user to select the LPT port on which the Tem pBook is
Simulated DeviceThis command opens a TempView session but does not attempt t o communicate with
connected. After an LPT port i s selected, TempVi ew opens a new sess i on with t he
TempBook hardware and attempts to communicat e with i t . If the hardware is found, the
main window is opened. If no hardware is found, the us er i s alerted and the application is
opened with the controls disabled. To rec onfigure the LPT port setting and t ry again, click
Select LPT Port under the Select P ort menu. If the TempBook hardware still can not be
identified by the software, exit TempView and try the TEMPTEST utility program.
TempBook hardware. Instead, the appl i cation simulates the interaction between the
software and the hardware. If TempView is presently attached to real TempBook
hardware, this command will close that session.
The Window menu includes the following functions:
PostViewThis command launches an i nstance of the PostV i ew applic at i on.
ChartsThis command displays the charts window.
Analog OutputThi s command displ ays the analog output window.
Digital I/OThis command displays the digital I/O window.
Ctr/TmrThis command displays the counter/timer window.
The Acquisition menu includes the following functions:
GoThis command arms the hardware for an acquisition to di sk. When the t ri gger i s satisfied,
Enable Input
Reading Column
the acquisition begins. All of the interactive I/O controls are disabled while the s ys tem is
armed. No acquisition parameters can be altered at t hi s time.
This command reads the analog inputs and puts the numeric values in the spreadsheet i n
the "Reading" column. I f it is already enabled, this command disables i t .
Charts
The Charts menu of the charts window includes the following function:
Enable ChartsThis command s t arts the scroll chart runni ng. If the chart is already runni ng, this command
stops it.
3-6 Using TempView (16-bit)
11-16-00
TempBook User’s Manual
Using PostView
Introduction
TempView uses a 16-bit version of PostView, an independent program that allows you to view
waveforms recorded by TempView. As the data file is being created, a descriptor file used by
PostView is also created.
4
The program can be started from a toolbar PostView icon, or from a pull-down menu.
PostView can also be started independent of TempView. Multiple sessions of PostView can be
invoked concurrently to view several data files. To view a data file from within PostView,
select Open under the File menu. When PostView is started from TempView, it automatically
opens the selected destination file. To view other files, use Open under the File menu for the
applicable program’s data files. To place channel waveforms into the window, select the
number of charts from 1 to 16 under the Number of Charts menu item. Selecting N number of
charts will automatically place the first N channels in the charts. Use the Channel Select ListBox (Upper right corner of each chart) to view the desired channel. The Channel Select List
Boxes contain labels that were assigned to the recorded channels by TempView.
The following table explains PostView toolbar items and is followed by a description of
PostView Menu items.
TempBook User’s Manual,
11-16-00
PostView Main Window
Using PostView (16-bit) 4-1
PostView Toolbar Items
OpenPrintZoom Out ><
Zoom In <>
AutoScale
Show
Grid
Show
Markers
PostView Toolbar Items
OpenAccesses the Open Data Fi l e window.
PrintSends the PostView chart(s ) to an assigned printer.
Zoom Out
(
)
><
Zoom In
(
)
<>
AutoscaleClicking the A ut o S cale button adjusts the Y-axis labels so that the visible waveform fills 90% of the
Y-axis AdjustThe Y-axis Adjust f i el ds show the chart’s minimum and maximum for visible charts i n the engineering
Show GridPlaces a grid on the chart (s), or removes t he gri d i f already present.
Show MarkersEach chart contains a cross-hair marker that shows the numerical values of t i me and magnitude at its
Trigger Event
Marker
Stop Event
Marker
The Scroll Bar at the bottom of the PostView window (see figure on previous page) al l ows t he waveforms to be scrolled
right or left in two ways:
The Zoom Out button doubles the visible timebase, s howing more of the waveform. For example, if 10
seconds of information is visible, clicking the Zoom Out button will show 20 seconds.
The Zoom In button halves the visible timebase, showing less of the waveform. For example, i f 10
seconds of information is visible, clicking the Zoom In button will show 5 seconds.
chart’s range.
units shown. Clicking the A uto Scale button automatically adjusts the Y-axis A dj ust fields. To adjust
any chart’s minimum or maximum, place the cursor in the desi red Y-axis Adjust field, and type in a
new value.
present location in the waveform . The Markers start out at t he f a r l ef t of every chart, showing the
time and magnitude of the first visible point .
•
Left mouse button allows the user to drag the marker of each chart
•
Right mouse button moves the markers from all
the charts
in unison
independently
.
.
The Options menu contains a function which allows you to turn markers on and off. W hen a check
appears in front of this it em, its associated indicator is on or visible. Selecting the menu item toggles
the indicator (and the check mark) on and off.
The Trigger Event Marker on the time axis shows the l ocation of the trigger point.
The Stop Event Marker on the time axis shows the location of the stop poi nt .
1.When clicked on, the small left and right arrow boxes scroll the waveforms approxim ately 20%.
2.The plain scroll button shows the rel ative location of the vis i bl e regi on of the waveforms and can be
dragged along the scroll bar to any locat i on desired.
4-2 Using PostView (16-bit)
11-16-00
TempBook User’s Manual
PostView Menu Items
The following tables pertain to functions allowed by the pull-down menus.
File
OpenOpens a data file that was created by TempView. PostView automat i cally detects whether the
Print WindowPrints the present PostV i ew window.
ExitExits the File menu.
Number of Charts
1-16After a data file has been opened, the number of desired charts can be selected. You can also
Go To
PercentageAutomatically scrolls to the desired percent of the data file. For example, sel ecting 50% would
Scan NumberAutomati cally scrolls the waveforms so the desired scan number is in view. This menu
TimeAutomatically scrolls the waveforms so the desired time is in view.
Trigger PointAutomatically scrolls the waveforms so the trigger point (t = 0) is in vi ew.
Options
Zoom OutAllows more of a chart(s) to be seen by decreasing the dimensi ons.
Zoom InZooms in on a chart(s), providing more detail to a smaller area of the chart(s).
AutoscaleAutomatically generates a scale, in contrast to manually assigning the scale.
Show Grid
(Ctrl+G)
Show Markers
(Ctrl+K)
Help
ContentsThe initial PostVi ew help screen provides an overview and listing of the help f i l e contents. A
SearchType a word or select one from the Show Topics l i st for quick acces s to help information.
Help on HelpProvides instructions on how to use a Windows Help system.
AboutProvi des the PostView version num ber, for example: Version 1.5.
file contains ASCI I or binary data.
use this menu selection to change the number of charts displayed.
display a waveform segment f rom the middle of the data file.
selection invokes a dial og box which displays the number of scans in the file.
Allows grids to be turned off and on for al l vi sible graphs. W hen a check appears in front of an
item, its indi cator is on or visible.
Allows markers to be turned off and on for all visible graphs. When a check appears in front of
an item, its indi cator is on or visible.
single topic can be selected for quick acces s to help information.
TempBook User’s Manual
11-16-00
Using PostView (16-bit) 4-3
The PostView Timebase
PostView automatically detects the timebase of the data file and shows the time in seconds in the X-axis
labels.
PostView can create files containing multiple timebases, pre-trigger and post-trigger data. In addition, with
TempView you can create files that include post-stop data.
The following comments apply to TempView.
•
Note that the trigger point (t = 0) is not necessarily the first point in the data file.
•
If pre-trigger scans are available, they will be shown prior to the trigger point and labeled with
negative time numbers.
•
If a dual timebase was used when collecting the data, PostView will show a discontinuity in the time
axis when the timebase changes. When a dual timebase is used, the post-trigger scans are collected at
one frequency while the pre-trigger and post-stop scans are collected at another.
•
If post-stop data is available (scans collected after the Stop Event), they are displayed after the Stop
Event marker.
Data File Accessibility
In regard to TempView applications, PostView can access the program files at any time, even during the
acquisition. If PostView reaches the end of a file while TempView is still collecting data, PostView will
automatically display the new data as it becomes available.
For the fastest display of waveforms, select binary data storage.
Note:
4-4 Using PostView (16-bit)
11-16-00
TempBook User’s Manual
Programmer's Guide
This and the following chapters are written for users who wish to write their own programs to control and
acquire data from the TempBook/66. This introductory chapter covers basic TempBook operation from a
programmer’s perspective and the options available for API drivers and language s. Further detai l i s
included through examples in the individual language support chapters, the command reference section, as
well as the chapters on thermocouple linearization and software calibration & zero compensation.
A Programmer’s View of TempBook Operations
The TempBook provides flexible, high-spe e d, multi-channel data acquisition capabilities through the use of
sophisticated analog and digital electronic circuitry. This circuitry allows up to 16 analog input channels to
be read at an aggregate 100 kHz sampling frequency. Each of these channels can be read as a unipolar (0 to
+V) or bipolar (±V) signal in one of 8 input voltage ranges. These ranges are determined by dividing the
standard 0 to 10V unipolar or ±5V bipolar input range by the available gains of ×1, 2, 5, 10, 20, 50, 100, or
200. Additionally, each input can be read as a single-ended or differential signal (selecting differential
limits the number of available channels to 8).
The conversion of these input signals to a digital code is accomplished by a high-performance 12-bit
analog-to-digital converter (ADC). (The resultant digital code can then be converted into a voltage via a
DAC). The output of the ADC is an unsigned value which is leftjustified within a 16-bit data word. In unipolar and bipolar modes,
the output code is related to the input voltage as shown in the table
(12-bit data format and standard input range shown).
The analog section of the TempBook consists of the following: channel select multiplexers, a single-ended /
differential selector, an instrumentation amplifier, programmable gain amplifiers, a unipolar / bipolar
selector, and the 12-bit ADC.
The analog electronics are controlled by a scan-sequencer and control registers. The scan sequencer is
implemented with a 16-bit × 512-location FIFO RAM. Each entry in the scan sequencer contains channel,
gain, and polarity information. The single-ended/differential selection is controlled by a static control
register entry. Once triggered, t he scan sequencer is stepped through at a constant ra te of 100 kHz until all
sequencer entries have been read. At each step, an ADC conversion is performed and the resultant output is
stored in a data buffer implemented with another 16-bit × 512-location FIFO RAM.
A scan is initiated by a trigger from a software command, a TTL input, or an internal pacer clock. In
addition to the source, a mode (one-shot or continuous-trigger) can be selected.
•
In one-shot mode, the scan sequencer is stepped through once (scanned) each time a trigger is
received.
•
In continuous mode, the scan sequencer waits for the selected trigger for the initial scan but
subsequent scans are initiated by the pacer clock.
Note: the selection of one-shot or continuous mode has no effect if the pacer clock is selected as the trigger
source.
TempBook User’s ManualProgrammer's Guide 5-1
The pacer clock is generated by dividing an internal 1 MHz or 100 kHz clock by a programmable 32-bit
counter. The pacer clock source selection is made by an internal jumper setting, and the counter is
implemented by cascading P1 and P2 of an 8254 counter/timer chip.
The scan sequencer must be loaded prior to any data acquisition. When using the high-level data
acquisition routines (as in the
adcex1
example programs), a single command can combine the scan
sequencer setup, trigger selection, pacer clock programming, and data collection. When using the low-level
data acquisition routines (as in
adcex2
and
adcex3
), these operations are broken out into separate
commands.
Note: When connecting thermocouple and other low-level signals in addition to high-level signals, the
low-level signals should be programmed first into the scan sequence with the high-level signals
following in ascending order of signal magnitude.
In addition to the 16 externally available analog input channels, two internal
channels are provided for offset correction and thermocouple cold junction
compensation. The external analog input channels are addressed as channels 0 15, the CJC channel is at address 16, and the internal shorted channel is at 18.
The CJC channel must be included in the scan group when reading
thermocouples. This channel reading is used by the thermocouple linearization
functions. The shorted channel, when read at the same gain as an analog input
channel, can be used to remove offset errors present at run time in the analog
electronics. These topics are covered in greater detail in the ThermocoupleLinearization and Zero Compensation chapters.
Besides zero compensation, software compensation can be used to improve
measurement accuracy. The offset and gain errors present after factory
calibration are characterized and recorded within a unit-specific calibrationconstants file. The calibration-constants file is read by the data acquisition
program at run time. The collected ADC data can then be corrected for offset
and gain errors. This topic is covered in greater detail in the SoftwareCalibration and Zero Compensation chapter.
In addition to analog input, the TempBook provides digital I/O and
counter/timer function. Eight bits each of digital I/O are provided which can be
accessed as register-addressable I/O ports. Additionally, the 8 bits of digital
input can be read as part of the scan group by programming the scan sequencer
with the appropriate channel definition. The digital inputs are then returned
within the ADC data buffer and are right justified within the 16-bit data words.
When the digital inputs are read in this way, the timing relationship between the
trigger event and the analog & digital data is fixed.
A user accessible counter / timer is provided through the P0 p ort of the 8254.
This port can be configured into one of several modes including one-shot and
pulse-train generation as well as event counting. The clock input to this counter
/ timer port can be taken from an external or internal 100 kHz source. These
topics are covered in greater detail in the Command Reference chapter under the
tbkConfCntr0
tbkSetTrig
and
commands.
The flowchart diagram shows the operation of a typical TempBook data
acquisition program.
Data Acquisition
Program Flowchart
5-2 Programmer's GuideTempBook User’s Manual
Driver Options
The install disks include several “drivers” to accommodate various programming environments. This
section is intended to help you decide which API and programming language to use in developing your
application.
TempBook applications can be written to either the Standard TempBook API or to the Enhanced Daq* API.
Standard API functions have the
generically used with the TempBook, WaveBook, DaqBook, DaqBoard, and Daq PC-Card product lines.
Enhanced API functions share the
•
•
tbk
… prefix. The Enhanced API is a new format which can be
daq
… prefix. Generally,
If starting with an existing TempBook Application written to Windows 3.1, the quickest port is to use
or re-write code to the Standard API.
If writing a new application, it is best to write code to the Enhanced API due to its improved
performance and enhanced feature set (see following).
Standard API (
tbk
The standard API was originally written for the TempBook’s Windows 3.1 driver. However, it can be used
under Windows 95 in 16-bit mode. The standard API is the only API option available for Windows 3.1 or
DOS applications. Use the Standard API:
•
•
Enhanced API (
daq
The Enhanced API for 32-bit systems has several features that are not present in the standard API:
•
•
•
•
•
•
Because of these new features and other improvements, we recommend you use the Enhanced API
whenever feasible. Use the Enhanced API:
•
•
•
Language Support
The following table shows language support for the standard and enhanced API drivers.
Standard API (16-bit) Supported LanguagesEnhanced API (or 32-bit Standard) Supported Languages
C/C++
Microsoft Visual C++
Borland C++ (v4.0 and greater)
BASIC
Microsoft Visual Basic (v4.0 and previous)
QuickBASIC
Pascal
Turbo Pascal
…)
When developing a new or existing D OS application
When developing a new or existing Windows 3.1 application
…)
Multi-device - can concurrently handle up to 4 devices (including WaveBooks, Daq* products, and/or
TempBooks)
Larger buffer - can handle up to 2 billion samples at a time
Enhanced acquisition and trigger modes
Direct-to-disk capabilities
Wait-on-event features
Uses multi-tasking advantages of Windows 95/NT
When developing new or existing Windows 95 applications
When developing new or existing Windows NT applications
When porting an existing Standard API application to 32-bit mode to take advantage of the Enhanced
API features
C/C++
Microsoft Visual C++ (v2.2 and greater)
Borland C++ (v4.0 and greater)
BASIC
Microsoft Visual Basic (v4.0 and greater)
Delphi
Borland Delphi (v2.0)
TempBook User’s ManualProgrammer's Guide 5-3
−
Notes
5-4 Programmer's GuideTempBook User’s Manual
Standard API Programming of the TempBook with C
Note: The enhanced API commands do not work exactly like the standard API commands; refer to chapters 10 and 11.
Accessing TempBook from a Windows Program
The structure of a Windows program generally dictates that actions take place in response to messages such
as an operator key-press, mouse action, menu selection, etc. This discussion covers the basic actions
needed to control the TempBook. How these actions are combined and coordinated in response to
Windows messages is up to the application designer.
Accessing TempBook from a C-for-Windows Program
There is one library and one header file located in the TEMPBOOK\WIN\C directory. The header file,
TEMPBOOK.H, must be included at the top of a C program using the
allow the compiler to know what TempBook functions and constants are available.
The library, TEMPBOOK.LIB, must be included in the application's makefile or project file so that the
linker will find the TempBook functions. This is a large memory model library; the appropriate compiler
and linker options for a large memory model program must be invoked. See the documentation for your
specific C compiler for a description on using header files, libraries, and memory models.
To use the example program located in the TEMPBOOK\DOS\C directory, create a makefile or project file
which consists of the TBKEX.C source file, TBKEX.RC resource file, TBKEX.DEF definition file,
TBKEX.ICO icon file and the TEMPBOOK.LIB library.
#include
command. This will
6
High-Level Analog Input
The following excerpt from TBKEX.C shows the usage of several high level analog input routines.
unsigned sample, buf [10], data[7], data2[80];
int i, scan, chan;
Set default operating mode to single-ended, bipolar. These parameters will affect all scanned channels.
tbkSetMode(0, 1);
Get one A/D sample from channel 0 at unity gain and print the unsigned integer that is returned. Since the
TempBook contains a 12-bit A/D converter, the least significant 4 bits are undefined. Shifting the value to
the right 4 times right justifies the 12 bit value in the 16 bit variable.
tbkRd(0, &sample, TgainX1);
sprintf(tempstr, "Result of tbkRd : %4d\r\n\r\n", sample>4);
Get 10 samples from channel 0, trigged by the pacer clock with a 1kHz sampling frequency at unity gain.
Once the data has been collected, print the 10 samples that were placed in the buffer.
The following excerpt from TBKEX.C shows the usage of background acquisition functions. These
functions setup the TempBook to collect data in the background while your program continues to process
new lines of code in the foreground.
unsigned int data[80], chans[8], i, scan, chan;
unsigned chargains[8], polarities[8], active;
unsigned longcount;
6-2 Standard API Programming of the TempBook with CTempBook User’s Manual
Initialize the TempBook on LPT1 with interrupt 7.
tbkInit(LPT1, 7);
Set the default operating mode to single-ended, bipolar. These parameters will affect all scanned channels.
tbkSetMode(0, 1);
The TempBook has a sophisticated channel-gain sequencer that allows every channel in the defined scan to
have a different gain and unipolar/bipolar setting. The following array assignment will be used to setup the
sequencer to sample channels 0 through 7 in bipolar mode at unity gain. If desired, each channel could
have been assigned a different gain and/or unipolar/bipolar setting.
for(i=0;i<8;i++){
chans[i] = i;
gains[i] = TgainX1;
polarities[i] = 1;
}
Once the arrays are loaded with the desired channel numbers and their associated gain and unipolar/bipolar
settings, the following function uses them to load the sequencer.
tbkSetScan(chans, gains, polarities, 8);
Set the Clock to 1 Hz. (This assumes that the time base selection jumper is in the default 1 MHz position)
tbkSetClk(1000, 1000);
Make the Pacer Clock the trigger source.
tbkSetTrig(TtsPacerClock, 1, 0, 0);
Setup the background acquisition of 10 scans. As the data is collected, place it into the array called data.
Regardless of the status of the acquisition, the program will immediately return from this function call and
proceed to the next line in our code. The data will be collected via interrupts and placed in the specified
buffer in the background.
tbkRdNBack(data, 10, 0, 1);
At any point in the program, you can check the status of the background acquisition. The next lines of code
poll the background status continuously until it is no longer active, then it exits the do loop and proceeds
through the remainder of the program.
/* Check if acquisition is complete */
do
{
tbkGetBackStat(&active, &count);
sprintf(tempstr"Transfer in progress : %2d scans acquired.\r",count);
strcat(response, tempstr);
}
while (active != 0);
sprintf(tempstr"\r\nAcquisition complete.\r\n\r\n");
Since the background acquisition is complete, print the data in the buffer.
Read the state of the digital input bit 3, and place its value in in_bit.
tbkRdBit(3, &in_bit);
Depending on its state, print a message.
if (in_bit) {
sprintf(tempstr, "Digital input #3 is set\r\n\r\n");
strcat(response, tempstr);
} else {
sprintf(tempstr, "Digital input #3 is clear\r\n\r\n");
strcat(response, tempstr);
}
Set the digital output bit 5 to a high state.
tbkWtBit(5, 1);
The following lines of code use the byte manipulation functions to perform a "walking-bit" test on the
digital output port.
for (bit=0 ; bit<8 ; bit++)
{
out_byte = 0x01<bit;// Put a 1 in the bit(th) location of a byte
tbkWtByte(out_byte);// Write that byte to the digital output port
sprintf(tempstr, "Digital output byte written 0x%2x\n", out_byte);
strcat(response, tempstr);
}
Read the value from the digital input port (DI0 - DI7 inclusive), then print the result.
tbkRdByte(&in_byte);
sprintf(tempstr, "Digital input byte is 0x%2x\r\n", in_byte);
strcat(response, tempstr);
High-Speed Digital Input
The following excerpt from TBKEX.C shows the usage of the high-speed digital input function calls.
The high-speed digital port can be specified as a channel in the analog scan sequence, just like an analog
input channel. In this way the high-speed digital port data is acquired synchronously with the analog input
data and is placed in the same data buffer as the analog input data. This program sets up a scan which
includes analog channels and the high speed digital port.
unsigned chans[9], data[9], i, chan;
unsigned char gains[9], polarity[9];
Configure a scan consisting of analog i nput channels 0 thr ough 7.
for (i=0 ; i<8 ; i++){
chans[i] = i; // Analog input channels 0 - 7
gains[i] = TgainX1; // Unity gain
}
Include the high speed port as the last channel in the scan. Note that the high speed channel can be placed
anywhere in the scan.
chans[8] = TchHighSpeedDig; // High speed digital inputs
gains[8] = TgainX1; // Put any gain, it doesn't matter
6-4 Standard API Programming of the TempBook with CTempBook User’s Manual
Initialize the TempBook on LPT1 with interrupt 7.
tbkInit(LPT1, 7);
Set the default operating mode to single-ended, bipolar. These parameters will affect all scanned channels.
tbkSetMode(0, 1);
Load the scan sequencer using a NULL pointer for the polarities array which indicates the use of the
default, global polarity.
The following excerpt from TBKEX.C shows the usage of the counter/timer functions.
The counter/timer port a vailable through the termination card is the P0 port af an 8254 counter/timer chip.
This port can be configured through software t o perform sever al functions which are d escribed in detail in
the command reference section under the tbkConfCntr0 command. This example demonstrates the usage of
three of the counter/timer modes. Altho ugh the invocation of these modes is demonstrated there is no way
to observe the function of the port without the connection of external test equipment or circuitry.
Configure CTR0 to use the internal 100 kHz clock.
tbkSetTrig(TtsSoftware, 0, 1, 0);
Configure CTR0 to mode 0, High on Terminal Count and write a count value of 100 to counter 0. After this
the counter 0 output (OUT0) will go high after 100 pulses are received on the counter 0 gate input (GAT0).
tbkConfCntr0(Tc0cHighTermCnt);
tbkWtCntr0(100);
Configure CTR0 to mode 1, Hardware Retriggerable One-Shot and write a count value of 1000 to counter
0. After this a rising edge on the counter 0 input (GAT0) will cause the output to go high for 10 msec.*/
tbkConfCntr0(Tc0cOneShot);
tbkWtCntr0(1000);
Configure CTR0 t o mode 3, Square Wave Generator and write a count value of 20 to counter 0 . After this a
square wave of 5kHz frequency should be present on the counter 0 output (OUT0).
tbkConfCntr0(Tc0cSquareWave);
tbkWtCntr0(20);
TempBook User’s ManualStandard API Programming of the TempBook with C 6-5
High-Level Thermocouple Data Acquisition
The following excerpt from TBKEX.C demonstrates the use of the TempBook's high-level thermocouple
temperature data acquisition routines. These functions have combined scan sequencer setup, ADC data
collection, and thermocouple linearization.
int i, temp, temps[10];
unsigned buf[1200];
Set the default operating mode to differential, bipolar. These parameters will affect all scanned channels.
tbkSetMode(1, 1);
Get one temperature sample from a type J thermocouple on channel 0, then print the result.
Get one temperature value from a type J thermocouple on channel 0 which is the average of 10 acquired
values, then print the result. This has the effect of reducing the noise content of your signal. The 10
readings will be taken at 1kHz, with only one temperature value returned by the function.
Get one temperature value from a type J thermocouple on channe l s 0 through 7, then print the re sul t.
tbkRdTempScan(0, 7, TbkTypeJ, temps);
sprintf(tempstr, "\r\nResults of tbkRdTempScan\r\n");
strcat(response, tempstr);
for (i=0 ; i<8 ; i++){
sprintf(tempstr, "Channel %d Temperature: %4.1f \r\n", i,
(float)temps[i]/10.0);
strcat(response, tempstr);
Get 8 temperature values from type J thermocouple on channels 0 through 7 which are the average of 10
acquired values, then print the result. This has the effect of reducing the noise content of your signal. The
10 readings will be taken at 1kHz, with only one temperature value for each channel returned by the
function.
6-6 Standard API Programming of the TempBook with CTempBook User’s Manual
Thermocouple Linearizati on
The following excerpt from TBKEX.C, demonstrates the use of the TempBook's thermocouple linearization
routines.
unsigned i, chans[11], data[1100];
unsigned char gains[11];
int temp[8];
The following lines of code assign channels and gains to the arrays that will be used to create a scan
sequence. The position of the CJC in the scan and the assignment of the gains for all of the channels must
conform to the conventions used by the linearization routines. See the command reference section for more
information on scan configuration.
/* Configure gains array */
gains[0] = TbkBiCJC; /* Bipolar CJC gain setting */
gains[1] = TbkBiTypeJ; /* Bipolar Type J Thermocouple gain setting */
gains[2] = TbkBiCJC; /* Bipolar CJC gain setting */
gains[3] = TbkBiTypeJ; /* Bipolar Type J Thermocouple gain setting */
gains[4] = TbkBiTypeJ; /* Bipolar Type J Thermocouple gain setting */
gains[5] = TbkBiTypeJ; /* Bipolar Type J Thermocouple gain setting */
gains[6] = TbkBiTypeJ; /* Bipolar Type J Thermocouple gain setting */
gains[7] = TbkBiTypeJ; /* Bipolar Type J Thermocouple gain setting */
gains[8] = TbkBiTypeJ; /* Bipolar Type J Thermocouple gain setting */
gains[9] = TbkBiTypeJ; /* Bipolar Type J Thermocouple gain setting */
gains[10] = TbkBiTypeJ; /* Bipolar Type J Thermocouple gain setting */
Set the default operating mode to differential, bipolar. These parameters will affect all scanned channels.
tbkSetMode(1, 1);
Configure the scan sequencer,with the desired channels and gains. A zero for the polarity argument forces
the use of the default polarity for all of the channels.
tbkSetScan(chans, gains, 0, 11);
Set the pacer clock for a 1 msec period.
tbkSetFreq(1000);
Use the Pacer Clock as the trigger source.
tbkSetTrig(TtsPacerClock, 0, 0, 0);
The following function tells all of the TbkTC functions to to use zero correction. Zero correction
compensates for offset drift in the electronics due to ambient temperature changes and/or age.
tbkTCAutoZero(1);
Read 100 scans and place the raw data in the supplied buffer.
tbkRdNFore(data, 100);
Reset the trigger to prevent a buffer overrun.
TempBook User’s ManualStandard API Programming of the TempBook with C 6-7
tbkSetTrig(TtsSoftware, 1, 0, 0);
Configure and perform Thermocouple Linearization with block averaging on the raw ADC counts. The raw
counts are in the data buffer, data. The converted temperature values will be returned in the buffer temp.
With block averaging enabled one temperature, the average of all 100 scans, will be returned for each
channel.
/***********************************************
File:Adcex1.c
Description:This example demonstrates the use of TempBook/66s highest level
ADC functions. These functions have combined scan sequencer setup and ADC
data collection.
Functions Used:tbkRd(unsigned chan, unsigned *sample, unsigned char gain)
tbkRdN(unsigned chan, unsigned *buf, unsigned count, unsigned char trigger,
unsigned char oneShot, float freq, unsigned char gain) tbkRdScan(unsigned
startChan, unsigned endChan, unsigned * buf, unsigned char gain)
tbkRdScanN(unsigned startChan, unsigned endChan, unsigned * buf, unsigned
count, unsigned char trigger, unsigned char oneShot, float freq, unsigned
char gain)
***********************************************/
unsigned sample, buf[10], data[7], data2[80];
int i, scan, chan; sprintf(response,"\r\nAdcex1.c\r\n\r\n");
/* Set the default operating mode to single-ended, bipolar */
tbkSetMode(0, 1);
/* Get 1 ADC sample from channel 0 at unity gain. */
tbkRd(0, &sample, TgainX1);
/* Print results using a 12 bit data format */
sprintf(tempstr,"Result of tbkRd : %4d\r\n\r\n", sample>4);
strcat(response,tempstr);
/* Get 10 samples from channel 0, trigged by the pacer clock with a */
/* 1000 Hz sampling frequency at unity gain. */
tbkRdN(0, buf, 10, TtsPacerClock, 0, 1000, TgainX1);
/* Print the results using a 12 bit data format */
sprintf(tempstr,"Results of tbkRdN:");
strcat(response,tempstr);
for(i=0;i<8;i++) {
sprintf(tempstr,"%4d ", buf[i]>4);
strcat(response,tempstr);
}
/* Get 1 sample from channels 0 through 7 at unity gain. */
6-8 Standard API Programming of the TempBook with CTempBook User’s Manual
tbkRdScan(0, 7, data, TgainX1);
/* Print the results using a 12 bit data format */
sprintf(tempstr,"\r\n\r\nResults of tbkRdscan:\r\n");
strcat(response,tempstr);
for(i=0;i<8;i++) {
sprintf(tempstr,"Channel: %2d Data: %4d\r\n", i, data[i]>4);
strcat(response,tempstr);
}
/* Get 10 samples from channels 0 - 7, triggered by the pacer clock
with a 1000 Hz sampling frequency and unity gain. */
/***********************************************
File: Adcex3.c
Description:This example demonstrates the use of the TempBook/66's
background transfer routines.
Functions Used:tbkRdNBack(unsigned _far *buf, unsigned count, unsigned char
cycle,
unsigned char updateSingle)
tbkGetBackStat(unsigned char _far *active, unsigned long _far *count)
***********************************************/
unsigned int data[80], chans[8], i, scan, chan;
unsigned char gains[8], polarities[8], active;
unsigned long count;
sprintf(response,"\r\nAdcex3.c\r\n\r\n");
/* Set the default mode of operation to single-ended bipolar */
tbkSetMode(0, 1);
/* Set channels, gains, & polarities arrays to channels 0-7,
bipolar, at unity gain. */
/* Read the state of digital input DI3 */
tbkRdBit(3, &in_bit);
if (in_bit) {
sprintf(tempstr,"Digital input #3 is set\r\n\r\n");
strcat(response,tempstr); } else {
sprintf(tempstr,"Digital input #3 is clear\r\n\r\n");
strcat(response,tempstr); }
/* Set digital output DO5 */
tbkWtBit(5, 1);
/* Perform a 'walking bit' test by setting each digital
output in order from DO0 to DO7 */
for (bit=0 ; bit<8 ; bit++)
{
out_byte = 0x01<bit;
// Put a 1 in the bit(th) location of a byte
tbkWtByte(out_byte);
// Write that byte to the digital output port
TempBook User’s ManualStandard API Programming of the TempBook with C 6-11
sprintf(tempstr,"Digital output byte written 0x%2x\r\n", out_byte);
strcat(response,tempstr);
}
/* Read the value from the digital input port (DI0 - DI7 inclusive) */
tbkRdByte(&in_byte);
/***********************************************
File: Digex2.c
Description:This example demonstrates the use of the TempBook's high speed
digital inputs.
Functions Used:tbkSetScan(unsigned *chans, unsigned char *gains, unsigned
char *polarity, unsigned count)
tbkRdNFore(unsigned _far *buf, unsigned count)
***********************************************/
unsigned chans[9], data[9], i, chan;
unsigned char gains[9], polarity[9];
sprintf(response,"\nDigex2.c\n\n");
/* Configure the channels and gains arrays for analog inputs 0-7 */
/* plus the high speed digital inputs */
chans[8] = TchHighSpeedDig; /* High speed digital inputs */
gains[8] = TgainX1; /* Put any gain, it doesn't matter */
polarity[8] = 1; /* Put any polarity, it doesn't matter */
/* Set default operation to single-ended, bipolar */
tbkSetMode(0, 1);
/* Load the scan sequencer, NULL pointer for polarities array */
/* indicates use default polarity */
/************************************
File: Ctrex1.c
Description: This example demonstrates the use of the TempBook's
counter timer functions.
Functions Used:
tbkConfCntr0(unsigned char config)
tbkWtCntr0(unsigned cntr0)
*************************************/
sprintf(response,"\r\nctrex1.c\r\n\r\n");
/* Configure CTR0 to use the internal 100kHz clock */
tbkSetTrig(TtsSoftware, 0, 1, 0);
/* Configure CTR0 to mode 1, Hardware Retriggerable One-Shot and write
a count value of 1000 to counter 0. After this a rising edge on the
counter 0 input (GAT0) will cause the output to go high
for 10 msec. */
tbkConfCntr0(Tc0cOneShot);
tbkWtCntr0(1000);
/* Configure CTR0 to mode 3, Square Wave Generator and write a count
value of 20 to counter 0. After this a square wave of 5kHz
frequency should be present on the counter 0 output (OUT0) */
tbkConfCntr0(Tc0cSquareWave);
tbkWtCntr0(20);
/* Configure CTR0 to use an external clock */
tbkSetTrig(TtsSoftware, 0, 0, 0);
/* Configure CTR0 to mode 0, High on Terminal Count and write a count
value of 100 to counter 0. After this the counter 0 output (OUT0)
will go high after 100 pulses are received on the counter 0 clock
input (CLK0) */
tbkConfCntr0(Tc0cHighTermCnt);
tbkWtCntr0(100);
SendDlgItemMessage(myDlg, 101, WM_SETTEXT, 0, (LONG)(LPSTR)response);
EmptyMessageQueue(myDlg);
}
TempBook User’s ManualStandard API Programming of the TempBook with C 6-13
High-Level Thermocouple Measurement
***********************************************
File:
Description:
This example demonstrates the use of the TempBook's high level
thermocouple temperature data acquisition routines. These
functions have combined scan sequencer setup, ADC data
collection, and thermocouple linearization.
Functions Used:
tbkRdTemp(unsigned chan, unsigned tcType, int * temp)
tbkRdTempN( unsigned chan, unsigned tcType, unsigned count, int *
temp,
unsigned * buf, float freq, unsigned avg ) tbkRdTempScan(unsigned startChan,
unsigned endChan,unsigned tcType, int * temp) tbkRdTempScanN(unsigned
startChan,
unsigned endChan, unsigned tcType, unsigned count, int * temp, unsigned *
buf,
float freq, unsigned avg)
****************************************************/
int i, temp, temps[10];
unsigned buf[1200];
sprintf(response,"\r\nTempex1.c\r\n");
/* Set the default mode of operation to differential bipolar */
tbkSetMode(1, 1);
/* Get 1 ADC sample from a type J thermocouple on channel 0 and
convert the reading to a temperature. Print the result. */
tbkRdTemp(0, TbkTypeJ, &temp);
sprintf(tempstr,"\r\nResults of tbkRdTemp\r\n");
strcat(response,tempstr);
/* Get 10 ADC samples from a type J thermocouple on channel 0 and
convert the readings to a single temperature using block averaging.
Print the results. */
tbkRdTempN(0, TbkTypeJ, 10, &temp, buf, 1000, 0);
sprintf(tempstr,"\r\nResults of tbkRdTempN\r\n");
strcat(response,tempstr);
/* Get 1 ADC sample each from type J thermocouples on channels 0
through
7 and convert the readings to temperatures. Print the results */
tbkRdTempScan(0, 7, TbkTypeJ, temps);
sprintf(tempstr,"\r\nResults of tbkRdTempScan\r\n");
strcat(response,tempstr);
for (i=0 ; i<8 ; i++) {
sprintf(tempstr,"Channel %d Temperature: %4.1f \r\n", i,
(float)temps[i]/10.0);
strcat(response,tempstr);
}
6-14 Standard API Programming of the TempBook with CTempBook User’s Manual
/* Get 10 ADC samples each from type J thermocouples on channels 0
through 7 and convert the readings to temperatures using block
averaging. Print the results */
/* Tell tbkTC.. functions to use zero correction */
tbkTCAutoZero(1);
/* Read 100 scans of ADC data */
tbkRdNFore(data, 100);
/* Reset the trigger to prevent a buffer overrun */
tbkSetTrig(TtsSoftware, 1, 0, 0);
/* Configure and Perform Thermocouple Linearization with block
averaging */
tbkTCSetup(11, 2, 8, TbkTypeJ, 1, 0);
tbkTCConvert(data, 100, temp, 8);
/* The converted temperatures can now be printed to the screen */
sprintf(tempstr,"\r\nThermocouple temperatures: Channels 0 through
7\r\n\r\n"); strcat(response,tempstr);
Establish communication with the TempB ook at the specified LPT
port and interrupt
Select an initialized Tem pB ook as the current TempBook
End communicat i on with t he TempBook
Specify a user-defined routine to call when error occurs
Default error handling routine
Get the current parallel port communication protocol
Set the parallel port com munication protocol
Issue a software trigger to the TempBook
Set the pacer clock f requency
Read the pacer clock frequency
Set the pacer clock f requency divider registers
Specify input signal t ype (s i ngl e-ended or differential)
Setup the scan sequencer for a range of channels at the sam e
gain
Read the scan sequencer content s
Setup the scan sequencer with specific channels, gai ns, and
polarities
Set the trigger source for analog data acquisition
Read a single ADC sample in t he foreground and increment the
scan sequencer
Read multiple scans i n the foreground
Read multiple scans i n t he background using interrupts
Determine is a background transfer is still in progress
Stop the background transfer
Read a single sample from the specified channel
Read multiple sampl es from the specif i ed channel
Read a single sample from the specified range of channel s
Read multiple sampl es from the specif i ed range of channels
Read the thermocouple temperature once from the spec i fied
channel
Read the thermocouple temperature from the specified channel
multiple tim es with optional averaging
Read the thermocouple temperature once from each channel i n a
range
Read the thermocouple temperature from each channel in a range
multiple tim es using optional averaging
Specify scan information used by tbkTCConvert
Perform thermocoupl e l i nearization on scan data
Combined tbkTCSetup and t bkTCConvert
Tell the thermocouple lineari zat i on functions that auto zeroing will
be used
TempBook User’s ManualStandard API Programming of the TempBook with C 6-17
Software Calibration and Zero Compensation Commands:
Read the calibration constants text file
Specify scan information used by tbkCalConvert
Perform software calibrat i on on scan data
Combined tbkCalSetup and t bkCalConvert
Specify scan information used by tbkZeroConvert function
Perform zero compens ation on scan data
Combined tbkZeroSetup and tb kZeroConvert
Set the operating mode of t he counter/timer
Write a value to t he counter/timer count down register
Read the counter/timer hol d regi ster
Read a specific digital i nput bit
Read all digital inputs
Write to a specific digital output bi t
Write to all di gi tal outputs
Setup the trigger source and level for a pretrigger operation
Read multiple scans f or a pretrigger operation in the foreground
Read multiple scans f or a pretrigger operation in the foreground
continuing until the trigger event occurs
Read multiple scans f or a pretrigger operation in the background
6-18 Standard API Programming of the TempBook with CTempBook User’s Manual
Software Calibration and Zero Compensation
Note: The enhanced API commands do not work exactly like the standard API commands used in this chapter.
This section describes how to use the TempBook's software calibration and zero compensation functions to
correct for gain and offset errors. To use the calibration constants shipped with the board, DaqView users
should follow the instructions given on the calibration document containing these constants. The program
will automatically use these constants.
Programmers wishing to use the TempBook’s thermocouple linearization functions with auto-zero
compensation (rather than calling the zero compensation functions manually) should refer to the
Thermocouple Linearization chapter of this manual.
Both software calibration and zero compensation increase the accuracy of the TempBook and its expansion
cards by correcting for gain and offset errors. For example, when using a TempBook with software
calibration, accuracy better than 1°C can be achieved. The calibration operation removes static gain and
offset errors that are inherent in the hardware. This operation uses calibration constants, usually measured
at the factory, to adjust for gain and optionally offset errors. The calibration constants do not change during
the execution of a program but are different for each card and programmable gain setting.
Zero compensation removes offset errors while a program is running. This is useful in systems where the
offset of a channel may change due to temperature changes, long-term drift or hardware calibration changes.
By reading a shorted channel on the same card at the same gain as the desired channel, the offset can be
removed at run-t ime. Note: The TempBook has channel 18 permanently shorted for performing zero
compensation.
7
Software Calibration
Software calibration functions are designed to adjust TempBook readings to compensate for gain and offset
errors. Calibration constants are calculated at the factory by measuring the gain and offset errors of a card
at each programmable gain setting. These constants are stored in a calibration text file which can be read
by a program at runtime. This allows new boards to be configured for calibration by updating this
calibration file rather than re-compiling the program.
The calibration process is divided up into three steps:
•
Initialization consists of reading the calibration file.
•
Setup describes the characteristics of the data to be calibrated.
•
Conversion does the actual calibration of the data.
All of the functions prototypes, return error codes and definitions are located in the TempBook.H header
file (C language) or similar header file (other languages).
Initializing the Calibration Constants
Each TempBook is shipped with a disk containing a calibration constants file. The file is named
serial_no.cal where serial _no is the serial number of the TempBook for which the constants were
generated. This file should be copied into the directory from which the user’s program will be run. For
convenience, this file can be renamed tempbook.cal which is the default calibration filename.
The initialization function for reading in the calibration constants from the calibration text file is
tbkReadCalFile
and operates as follows:
int tbkReadCalFile(char_*calfile)
char_*calfile
. The C language version of
calfile contains t he path (optional) and filename of t he calibration file. If calfile is NULL
or empty (""), the default calibration f ile TempBook.CAL will be read.
tbkReadCalFile
is similar to that o f other languages
This function, which is usually called once at the beginning of a program, will read all the calibration
constants from the specified file. If calibration constants for a specific channel number and gain setting are
not contained in the file, ideal calibration constants will be used—essentially performing no calibration for
that channel. If an error occurs while trying to open the calibration file, ideal calibration constants will be
used for all channels and a non-zero error code will be returned by the
TempBook User’s ManualSoftware Calibration and Zero Compensati on 7-1
tbkReadCalFile
function.
Calibration Setup and Conversion
Once the cal constants have been read from the cal file, they can be used by the
tbkCalConvert
calibrated. This function requires all data to be calibrated to be from consecutive channels configured for
the same gain, polarity and channel type. The calibration can be configured to use only the gain calibration
constant and not the offset constant. This allows the offset to be removed at runtime using the zero
compensation functions described later in this chapter.
The number of readings in a single s can.
The position of the readings to be c al i brated within the scan.
The number of readings to calibrat e.
The type of channel from which the readings to be calibrated are read. This
should be set to 1 when calibrating a CJC channel and 0 when reading any
other channel.
The gain setting of the channels to be calibrated.
Non-zero if the TempBook is configured for bipolar readings.
If non-zero, the offset cal c onstant will not be used to calibrate the readings.
function will configure the order and type of data to be
and
function performs the actual calibration of one or more scans according to the
function. This function will modify the array of data passed to it.
The raw data from one or more scans.
The number of scans of raw data in t he counts array.
. This is useful when the calibration needs to be performed multiple times
The number of readings in a single s can.
The position of the readings to be c al i brated within the scan.
The number of readings to calibrat e.
The type of channel/board from which the readi ngs to be calibrated are read.
This should be set to 1 when calibrati ng a CJC channel and 0 when reading
any other channel.
The gain setting of the channels to be calibrated.
Non-zero if the TempBook is configured for bipolar readings.
If non-zero, the offset cal c onstant will not be used to calibrate the readings.
The raw data from one or more scans.
The number of scans of raw data in t he counts array.
Calibration Example
In this example, several TempBook channels will be read and calibrated. This example assumes that the
calibration file has been created according to the initializing calibration constants section of this chapter.
Although all of the channe l s i n t his example are read at the same gain, the same principles apply to
calibration of channel readings at different gains. In that situation, channels to be read are grouped by gain
within the scan sequence. Then,
tbkCalSetup
would be called once for each group of channels at a particular gain.
void main(void)
{
unsigned sample, buf[10], data[8];
int i, scan, chan;
printf(“/nAdcex4.c/n”);
/* Set error handler and initialize TempBook*/
tbkSetErrHandler(myhandler);
tbkInit(LPT1, 7);
7-2 Software Calibration and Zero Compensati onTempBook User’s Manual
tbkCalConvert
and
tbkCalSetupConvert
(or
)
/*Read the calibration constants from the calibration constant text file
assuming the default name ‘tempbook.cal’*/
tbkReadCalFile(“”);
/* Set the default operating mode to differential, bipolar */
tbkSetMode(1,1);
/* Get 1 sample from channels 0 through 7 at unity gain */
tbkRdScan(0, 7, data, TgainX1);
/* Print the uncalibrated samples using a 12-bit format */
printf(“/nUncalibrated Results of tbkRdScan:/n”);
for(i=0; i<8; i++)
printf(“Channel: %2d Data: %4d/n”, i, data[i]>4);
/* Setup and perform offset and gain software calibration of data */
tbkCalSetup(8,/* 8 readings within a scan */
0,/* First reading to be cal’d at position 0 */
8,/* Calibrate 8 readings per scan */
0,/* Channel type is 0 for non-CJC */
TgainX1 /* Reading taken at X1 gain */
1,/* Readings are bipolar */
0);/* Perform zero as well as gain calibration */
tbkCalConvert (data, /*Pointer to array of readings */
1);/* 1 scan in that array */
/* Print the calibrated samples using a 12-bit format */
printf(“/nCalibrated Results of tbkRdScan:/n”);
for(i=0; i<8; i++)
printf(“Channel: %2d Data: %4d/n”, i, data[i]>4);
/* Close and exit */
tbkClose
}
Zero Compensation
The zero compensation functions require a shorted channel to be sampled at the same gain as the channels
to be compensated.
The
tbkZeroSetup
within a scan, the size of the scan and the number of readings to zero. This function does not do the
conversion. A non-zero return value indicates an invalid parameter error.
int tbkZeroSetup ()
uint nscan
uint zeroPosition
uint
readingsPosition
uint nReadings
The
tbkZeroConvert
tbkZeroSetup function
int tbkZeroConvert ()
uint *counts
uint scans
function configures the location of the shorted channel and the channels to be zeroed
The number of readings in a single s can.
The position of the zero reading within the scan.
The position of the readings to be zeroed within the scan.
The number of readings per scan to be zero compensate.
function compensates one or more scans according the previously called
. This function will modify the array of data passed to it.
The raw data from one or more scans.
The number of scans of raw data in t he counts array.
For convenience, both the setup and convert steps can be performed with one call to
tbkZeroSetupConvert
. This is useful when the zero compensation needs to be performed multiple
times because data was read from channels at different gains.
TempBook User’s ManualSoftware Calibration and Zero Compensati on 7-3
In this example, several TempB ook channels will be read and zero compensated. Although all of the
channels in this example are read at the same gain, the same principles apply to calibration of channel
readings at different gains. In that situation, channels to be read are grouped by gain within the scan
sequence. Also within the scan sequence, the TempBook’s internal shorted channel would be read once at
each gain used for channel measurement. Then,
tbkZeroSetupConvert
sure that the corresponding shorted channel reading for that gain is passed.
void main(void)
{
unsigned int data[9], chans[9], i;
unsigned char gains[9], polarities[9];
printf(“/nAdcex5.c/n”);
/* Initialize the channels, gains, and polarities arrays*/
chans[0] = 18;/* Shorted channel */
gains[0] = TgainX1/* Same gain as analog input channels */
polarities[0] = 1;/* Bipolar */
/* Print the uncompensated samples using a 12-bit format.*/
printf(“/nResults of tbkRdNFore before zero compensation:/n”);
for(i=0; i<8; i++)
printf(“Channel: %2d Data: %4d/n”, i, data[i]>4);
/* Setup and perform zero compensation of the data */
tbkZeroSetup(9,/* 9 readings within a scan */
0,/* Shorted channel at position 0 */
1,/* First reading to be compensated at position 1 */
8,/* Compensate 8 readings per scan */
tbkZeroConvert(data, /*Pointer to array of readings */
1);/* 1 scan in that array */
7-4 Software Calibration and Zero Compensati onTempBook User’s Manual
/* Print the compensated samples using a 12-bit format */
printf(“/nResults of tbkRdNFore after zero compensation:/n”);
for(i=0; i<8; i++)
printf(“Channel: %2d Data: %4d/n”, i, data[i]>4);
/* Close and exit */
tbkClose
}
Automatic Zero Compensation
The
tbkTCAutoZero
perform zero compensation. This is the easiest way to use zero compensation when making thermocouple
measurements. When enabled, the thermocouple conversion functions will require a CJC zero reading and
a TC zero reading to precede the actual CJC and TC reading.
int tbkTCAutoZero ()
uint zero
: See the thermocouple linearization section for a description and example of automatic zero
Note
compensation for thermocouple measurement.
function will configure the thermocouple linearization functions to automatically
If non-zero, will enable auto zero compensation in the tbkTC... functions
TempBook User’s ManualSoftware Calibration and Zero Compensati on 7-5
−
Notesc
7-6 Software Calibration and Zero Compensati onTempBook User’s Manual
Thermocouple Measurement
Note: The enhanced API commands do not work exactly like the standard API commands used in this chapter.
The TempBook software includes two groups of functions for o btaining thermocouple temperatures:
•
Low-level data conversion functions provide thermocouple linearization for previously acquired ADC
data. Functions include:
tbkTCAutoZero
•
High-level thermocouple measurement functions provide combined scan sequencer setup, triggering,
data collection, and linearization. Functions include:
tbkRdTempScan, tbkRdTempScanN
tbkTCSetup, tbkTCConvert, tbkTCSetupConvert,
.
tbkRdTemp, tbkRdTempN,
.
Both of theses function groups support types J, K, T, E, N28, N14, S, R and B thermocouples. The
TempBook accepts thermocouple attachment on differential input channels 0 thr ough 7. In addition, the
TempBook provides a cold-junction compensation circuit on channel 16 and a permanently shorted input on
channel 18 for performing zero compensation.
Two software techniques can be used to increase the measurement accuracy: software calibration and zero
compensation. Software calibration uses gain and offset calibration constants, unique to each unit, to
compensate for inherent errors. Zero compensation is a method by which offset voltages in the input
amplifier stages can be removed at run-time. This is done by measuring a shorted channel at the same gain
as the signal measurement to find the offset, and subtracting this from the actual reading. Both of these
methods are described in the Zero Compensation and Calibration chapter.
The thermocouple linearization functions have a special auto-zero compensation feature that will perform
zero compensation on the raw thermocouple data before linearizing. This auto-zero feature is enabled by
default but can be disabled using the
tbkTCAutoZero
function.
8
Low-Level Thermocouple Data Conversion Functions
The low-level thermocouple linearization functions are designed to convert ADC data which was collected
in a specific scan sequence format.
•
When not using the auto-zero feature, the scan sequence should consist of a CJC reading followed by
thermocouple readings. If different thermocouple types are being read, the readings should be
grouped by type with a CJC reading preceding each group. The thermocouple linearization functions
must then be called once for each thermocouple type.
•
When using the auto-zero feature, the scan sequence should consist of 2 shorted channel reading
followed by the CJC and thermocouple readings. The first shorted channel reading should be taken at
the CJC gain and the second at the thermocouple gain. If different thermocouple types are being read,
the reading should be grouped by thermocouple type with two shorted channel and one CJC readings
preceding each group. The thermocouple linearization functions must then be called once for each
thermocouple type.
The scan is not restricted to thermocouple measurements. The scan may include other signals such as
voltage or digital input. The linearization functions will ignore this other data within the scan group.
The gain settings for the CJC and thermocouple types depend on the bipolar/unipolar setting of the
TempBook as specified in the table below. Note: Unipolar operations are not recommended for
thermocouple measurement unless the temperatures to be measured are guaranteed to be greater than the
TempBook temperature.
TempBook Gain Codes
TypeUnipolar Gain CodeUnipolar GainBipolar Gain CodeBipolar Gain
The low-level te mperature conversion functions
take data from one or more scans from the
TempBook. They examine the CJC and
thermocouple readings within that scan and,
after optional averaging, convert them to
ScanReading
012345
CJC ZeroJ ZeroCJCJ1aJ1bJ1c
1
CJC ZeroJ ZeroCJCJ2aJ2bJ2c
2
CJC ZeroJ ZeroCJCJ3aJ3bJ3c
3
CJC ZeroJ ZeroCJCJ4aJ4bJ4c
4
temperatures which are stored as output. For
example, assume the readings in the table at right.
This shows that the first two readings of each scan are a CJC zero reading and a TC zero reading. The third
reading is from the CJC, and the remaining three readings are from three type J thermocouples. If the autozero feature is not used, the first two readings will be ignored. Otherwise, they
will be used to remove any offset errors in the CJC and thermocouple reading
before proceeding. When not using averaging, the CJC readings are combined
with the thermocouple readings to produce one temperature result for each
thermocouple reading. Reducing the 24 original readings to 12 temperatures
(see table at right).
ScanResult
012
J1aJ1bJ1c
1
J2aJ2bJ2c
2
J3aJ3bJ3c
3
J4aJ4bJ4c
4
The conversion process is divided into two steps: setup and conversion. The setup step describes the
characteristics of the temperature measurement, and the conversion step actually converts the data from raw
readings to temperatures. All of the functions return error codes which are defined in TempBook.H which
includes the function prototypes and definitions of the thermocouple type codes.
The setup function is
tbkTCSetup
. The C-language version of
the other programming languages and is de scribed below. Note:
The number of readings in a single s can of TempBook data. The
functions can convert several consecutive scans worth of data in a single
invocation.
Valid range: 2 to 512.
The position of the actual cold-junction compens ation circuit (CJC) reading within
each scan (not the CJC zero reading, i f any). The first reading of the scan is
position 0, and the last readi ng i s position nscan-1. Each scan of temperature
data must include a reading of the CJC. The CJC readings m ust be taken with
the appropriate unipolar or bipolar CJC gain setting.
Valid range: 0 to nscan-2 with no zero compensation; 2 to nscan-2 with zero
compensation.
The number of thermocouple readi ngs that are to be converted to temperature
values. The thermocouple s ignal readings must immediately follow the CJ C
reading in the scan data. The first thermocouple signal i s at scan position
cjcPosition+1, t he next is at cjcPosition+2, and so on.
Valid range: 1 to nscan-1-cjcPosition.
The type of thermocouples that generated the measurement s: J, K, T, E, N28,
N14, S, R, or B.
Valid range: One of the predefined values:
Non-zero if the TempBook is configured for bipolar readings.
The type of averaging to be performed.
Valid range: any unsigned integer.
Note: Since the therm ocouple voltage may be sm al l compared to the ambient
electrical noise, averagi ng may sometimes be necessary to yield a steady
temperature output.
0 specifies block averagi ng i n which al l of the scans are averaged together to
compute a single temperature measurement for each of the ntemp
thermocouples.
1 specifies no averaging. Each scan's readings are convert ed i nto ntemp
measured temperatures for a total of scans*ntemp results.
2 or more specifies moving average of the specifi ed number of scans. Each
scan's readings are averaged with the avg-1 precedi ng scans' readings before
conversion. The first avg-1 s cans are averaged with all of the preceding scans
because they do not have enough preceding scans. For example, if avg is 3,
then the results from the first scan are not averaged at all, the results f rom the
second scan are averaged with the first scan, the results from the third and
subsequent scans are averaged with the prec edi ng two scans as shown in the
: (Note: Further details in Command Reference chapter.)
tbkTCConvert( uint *counts, uint scans, int *temp, uint ntemp)
uint *counts
uint scans
int *temp
uint ntemp
For convenience both setup and conversion can be performed at once by
A array of one or more scans of raw data as received from the TempBook. The ADC
data bits are in the 12 mos t significant bits of the 16-bit integers.
Valid range: Each raw data item may be any 16-bit value.
The number of scans of data i n counts.
Valid range: 1 to 32768/nscan (c ounts is limit ed t o 64 Kbytes)
The converted temperature result s. The integer values are 10 tim es the temperatures
in degrees C; e.g., 50°C would be represented as 500 and -10 °C would be -100.
Valid range: Results range from -2000 (-200°C) to +13720 (+1372°C) depending on the
thermocouple type.
The number of entries in the t emp array. This is checked by the functions to avoid
writing past the end of the tem p array.
Valid range: If avg is 0, t hen ntc or greater.
If avg is non-zero, then scans * ntc or greater.
The auto-zero feature can be enabled disabled using the
tbkTCAutoZero
function: (Note: Further details
in Command Reference chapter.)
tbkTCAutoZero (uint zero)
uint zero
Non-zero to enable auto-zeroing;
zero (0) to disable auto-zeroing.
Note: see the tempex2 example programs in the i ndividual language support chapters fore examples of
using these functions.
High-Level Thermocouple Measurement Functions
The high-level thermocouple measurement functions are designed to provide combined scan sequencer
setup, triggering, data collection, and linearization. There are 4 functions in this group:
tbkRdTemp
tbkRdTempN
tbkRdTempScan
tbkRdTempScanN
Note: see tempex1 sample programs using these func tions in the individ ual language-support chapters.
Single-Channel Measurement (
tbkRdTemp
The
analog input channel. This function also collects CJC and shorted channel readings for linearization and
zero compensation. The CJC and thermocouple readings are then zero compensated and the thermocouple
reading is linearized. The converted temperature is placed in a variable supplied by the calling program.
(Note: Further details in Command Reference chapter.)
Read a single thermocouple channel once.
Read a single thermocouple channel multiple times.
Read a range of thermocouple channels once.
Read a range of thermocouple channels multiple times.
tbkRdTemp
)
function uses software triggering to immediately acquire one sample from the specified
The channel number to which the therm ocouple is attached.
The type of thermocouple attached.
A variable in which to store the measured temperature
Multiple Measurements from a Single Channel (tbkRdTempN)
The
tbkRdTempN
analog input channel and CJC and shorted channel readings for linearization and zero compensation. The
CJC and thermocouple readings are zero compensated and the thermocouple readings are linearized. The
converted temperatures are placed in an array supplied by the calling program. If block averaging is used, a
single temperature is returned; otherwise, a number of temperatures equal to the number of scans specified
are returned.
function uses pacer clock triggering to acquire multiple samples from the specified
: Further details in Command Reference chapter.)
(Note
The channel number to which the therm ocouple is attached.
The type of thermocouple attached.
The number of scans to read.
A variable in which to store the measured temperature.
An array for the temporary storage of raw scan data (must be at least 4*count in length).
The scan interval frequency.
Type of averaging to be used.
0 - block averaging
1 - no averaging
2 - moving averaging
Multiple-Channel Measurement (tbkRdTempScan)
The
tbkRdTempScan
specified range of analog input channels. All of these channels must be of the same thermocouple type,.
This function also collects CJC and shorted channel readings for linearization and zero compensation. The
CJC and thermocouple readings are then zero compensated and the thermocouple readings are linearized.
The converted temperatures are then placed in an array supplied by the calling program.
details in Command Reference chapter.)
tbkRdTempScan(uint startChan, uint endChan, uchar tcType, int * temp)
uint startchan
uint endChan
uint tcType
int *temp
function uses software t riggering to immediately acquire one sample from the
The starting channel number of t he range of thermocouple channels to read.
The ending channel number of the range of thermocouple channels to read.
The type of thermocouple attached.
An array in which to store the measured temperatures (must be at least endChan startChan + 1 in length).
(Note
: Further
Multiple Measurements from Multiple Channels (tbkRdTempScanN)
The
tbkRdTempScanN
specified range of analog input channels. All of these channels must be of the same thermocouple type.
This function also collects CJC and shorted channel readings for linearization and zero compensation. The
CJC and thermocouple readings are then zero compensated and the thermocouple readings are linearized.
The converted temperatures are placed in an array supplied by the calling program. If block averaging is
specified, then a single temperature is returned for each channel; otherwise, a number of temperatures equal
to the number of scans time the number of channels specified are returned.
Command Reference chapter.)
function uses pacer clock triggering to acquire multiple samples from the
: Further details in
(Note
The starting channel number of t he range of thermocouple channels to read.
The ending channel number of the range of thermocouple channels to read.
The type of thermocouple attached.
The number of scans to read.
A variable in which to store the measured temperature.
An array for the temporary storage of raw scan data (must be at l east [endChan startChan + 4] *count in length).
The scan interval frequency.
Type of averaging to be used.
0 - block averaging
1 - no averaging
2 - moving averaging
tbkCommand Reference (Standard API)
Overview
The first part of this chapter describes the TemBook/66 driver commands (this is the Standard API and is
not to be confused with the Enhanced API). The first table lists the commands by their function types as
defined in the driver header files. Then, the prototype commands are described in alphabetical order as
indexed below. At the end of the chapter (beginning on page 9-32), several reference tables define
parameters for: A/D Channel Descriptions, A/D Gain Definitions, A/D Trigger Source Definitions, PreTrigger Functions, Thermocouple Types, and the API Error Codes.
These TempBook software commands are described on the following pages:
Configure the counter 0 mode9-5
Read the status of a back ground A/D transfer9-6
Read the current pacer clock frequency9-6
Read the current scan configuration9-7
Configure an A/D acquisiti on and read one sample from a channel9-8
Read the current value of the counter 09-9
Read a single A/D sample and i ncrement the channel m ux9-10
Configure an A/D acquisiti on and read multiple scans f rom a channel9-10
Read count A/D scans in the background using interrupts9-11
Reads multiple A/ D scans, initiated by
the background
Read count A/D samples in the foreground (polled mode)9-12
Read multiple A/D s cans, initiated by
in the foreground
Read multiple A/D s cans, initiated by
in the foreground without returning until the acquisition comple t es
Configure an A/D acquisiti on and read one scan9-14
Configure an A/D acquisiti on and read multiple scans9-15
Take a single thermocouple readi ng from the given analog input channel9-15
Take multiple thermocouple readings from the gi ven anal og i nput channel9-16
Configure gain amp single-/di f ferential and polarity modes9-21
Take thermocouple readings f rom analog input channels 'startChan'
through 'endChan"
Take multiple thermocouple readings from analog input channels
'startChan' through 'endChan"
Set the pacer clock counters9-20
Configure the pacer clock frequency in Hz9-21
Configure a scan specifyi ng start and end channels9-22
Configure up to 512 channels mak i ng up an A/D or HS digital input scan9-24
Configure an A/D trigger9-25
Set the trigger of analog level tri ggeri ng & initiates the coll ection of pretrigger data acquisition
Send a software trigger command to the TempBook9-27
Stop a background A/D transfer9-27
Write a value to c ounter 09-30
Read a bit on a digital input port9-9
Read a byte from a digital input port9-9
Program a bit on a digital output port9-29
Output a byte to a digital output port9-30
Convert raw A/D readings to temperature readi ngs9-28
Set up parameters for subsequent temperature conversions9-28
Set up and convert raw A/D readings into t emperature readings9-29
tbkAdcSetrigPreT
tbkAdcSetTrigPretT
tbkAdcSetTrigPretT
command, in
command,
command,
9
9-12
9-13
9-14
9-17
9-18
9-26
TempBook User’s ManualtbkCommand Referenc e (
Standard
API) 9-1
Software Calibration and Zero Compensation Functions
Configure the thermocouple li neari zat i on functions to autom at i cally perform
zero compensation
Perform the actual c alibration of one or more scans9-3
Configure the order and type of data to be cali brat ed9-3
Perform both the setup and convert steps with one call9-4
Read all the calibration constants from the specified file9-19
Performs zero com pensation on one or more scans9-28
Configure data for zero compensation9-28
Perform both the setup and convert steps with one call9-29
End communicat i on with t he TempBook9-4
Returns the current parallel port communications protocol9-7
Initialize a single TempB ook9-8
Select an initialized Tem pBook/66 as the current Tem pBook9-19
Sets the handler that will be executed upon an error condition9-20
Specifies the type of paral l el -port i mplementation and protocol available on
the computer
9-27
9-23
9-6
Commands in Alphabetical Order
The following pages give the details for each TempBook/66 command listed in alphabetical order. Each
section starts with a table that summarizes the main features of the command. An explanation follows (and
in some cases a programming example or related information).
9-2 tbkCommand Referenc e (
Standard
API)TempBook User’s Manual
DLL Function
C
QuickBASIC
Visual Basic
Turbo Pascal
Parameters
function performs the actual calibration of one or more scans according to
tbkCalSetup
function. This function will modify the array of data passed
to it. See the Software Calibration and Zero Compensation chapter for a complete description of
calibration.
The number of readings in a single s can.
The position of the readings to be c al i brated within the scan.
The number of readings to calibrat e.
The type of channel from which the readings to be calibrated are read. This should be set to 1 when
calibrating a CJC channel and 0 when calibrat i ng any other channel.
The gain setting of the channels to be calibrated.
Non-zero if the readings are bipolar.
If non-zero, the offset cal c onstant will not be used to calibrate the readings.
function requires all data to be calibrated to be from channels configured for the same gain, polarity
and channel type. The calibration can be configured to only use the gain calibration constant and not
the offset constant. This allows the offset to be removed at runtime using the zero compensation
functions. See the Software Calibration and Zero Compensation chapter for a complete description
of calibration.
- Invalid parameter value
- No error
function will configure the order and type of data to be calibrated. This
For convenience, both the setup and convert steps can be performed with one call to
tbkCalSetupConvert
because data was read at different gains or polarities. See the Software Calibration and Zero
Compensation chapter for a complete description of calibration.
The number of readings in a single s can.
The position of the readings to be c al i brated within the scan.
The number of readings to calibrat e.
The type of channel from which the readings to be calibrated are read. This should be set to 1 when
calibrating a CJC channel and 0 when calibrat i ng any other channel.
The gain setting of the channels to be calibrated.
Non-zero if the readings are bipolar.
If non-zero, the offset cal c onstant will not be used to calibrate the readings.
The raw data from one or more scans.
The number of scans of raw data in t he counts array.
High on terminal count
Hardware retriggerable one-shot
Rate Generator
Square wave
Software triggered strobe
Hardware triggered strobe
tbkConfCntr0
tbkConfCntr0
programs the control register of Counter 0 in one of six modes. Counter 0 is a
general purpose counter with input, gate and output lines. The input of counter 0 can be configured
using the
ctr0mode
parameters of the
tbkSetTrig
command.
Mode 0, high on terminal count, is typically used to count events. After the initial count value (see
tbkWtCntr0
value at any time can be read using
) is set, the counter will decrement on each pulse of the Counter 0 input. The count
tbkRdCntr0
. Counter 0 output (pin 2 of P1), which is initially
low, will go high when the counter decrements to 0.
Mode 1, hardware retriggerable one-shot, is used to generate a pulse following the occurrence of a
rising edge of the Counter 0 gate. The output, which is initially high, will go low after the
hardware trigger is received until the count decrements to 0.
Mode 2, rate generator, acts as a divide-by-N counter. The output will be high until the counter
value decrements to 1, when the output goes low for 1 clock pulse before going high again.
Mode 3, square wave generator, is similar to mode 2 except for the duty-cycle. The output will be
high for half of the count value, and low for the other half. If the count value is odd, the
output will remain high for the extra clock pulse.
Mode 4, software triggered strobe, will strobe each time the count value is loaded. The output is
initially high. After the count value is written and has decremented to 1, the output will go
low for one clock pulse before going high agai n.
Mode 5, hardware triggered strobe, is similar to mode 4 except the strobe is initiated by a hardware
trigger (rising edge of Counter 0 gate).
TempBook User’s ManualtbkCommand Reference (
Standard
API) 9-5
tbkDefaultHandler
DLL Function
C
QuickBASIC
Visual Basic
Turbo Pascal
Parameters
tbkErrnum
Returns
See Also
Program References
tbkDefaultHandler
the TempBook library is loaded, it invokes the default error handler whenever it encounters an error.
The error handler may be changed with tbkSetErrHandler.
int tbkDefaultHandler( uchar tbkErrnum );
tbkDefaultHandler( int tbkErrnum );
BtbkDefaultHandler% (ByVal tbkErrnum%)
VBtbkDefaultHandler% (tbkErrnum%)
tbkDefaultHandler( tbkErrnum:integer );
The error code of the detected error.
Nothing
tbkSetErrHandler
None
tbkGetBackStat
DLL Function
C
QuickBASIC
Visual Basic
Turbo Pascal
Parameters
uchar *active
ulong *count
Returns
See Also
Program References
tbkGetBackStat
number of bytes acquired by the last or current background operation initiated by the
function.
A flag which will be returned non-zero if a background transfer is in progress, or 0 if not
The number of scans acquired by the last or current background t ransfer
displays an error message and then exits the application program. When
- Internal data buffer overrun
- ADC FIFO Overrun
- No error
determines if a background operation is still in progress. It also reads the
tbkRdNBack
tbkGetBackStat
FIFO in the TempBook/66 is filled before the user can read the data out. In which case, the data
read may be invalid. If the
can be returned. This means that the software is just fa st enough to read one buffer of data. If this
error occurs, the amount of data available (specified by 'count') is valid, but the transfer was stopped.
tbkGetFreq
DLL Function
C
QuickBASIC
Visual Basic
Turbo Pascal
Parameters
float *freq
Returns
See Also
Program References
tbkGetFreq
the 100 kHz/1 MHz jumper is set to the default position of 1MHz.
A pointer to a value that will be set to the current protoc ol chosen from the protocol c odes listed below
(additional EPP implementation codes may be described in the README file).
An array to hold up to 512 channel numbers or 0 i f the channel informati on i s not desired. See table
at end of chapter for valid values.
An array to hold up to 512 gain values or 0 if the channel gain information is not desired. See table at
end of chapter for valid values.
Zero value causes TempBook to default to Unipolar mode. Non-zero val ue causes default Bipolar
mode. All ADC convers i ons except those started with
A variable to hold the number of val ues returned in the chans and gains arrays .
TerrNoError
tbkSetScan, tbkSetMux
None
tbkGetScan
- No error
reads the current scan sequence consisting of up to 512 channels, gains and
polarities.
TempBook/66Communication Disabled0
8-bit I/O1
4-bit I/O2
Far Point F/Port EPP Interface10
82360 SL EPP Interface20
or
TbkProtocol4
tbkSetProtocol
tbkGetProtocol
tbkInit
, indicating either 8-bit or 4-bit
may be used to specify other protocols.
tbkGetScan
tbkSetScan
will use the default polarity.
initially
TempBook User’s ManualtbkCommand Reference (
Standard
API) 9-7
tbkInit
DLL Function
C
QuickBASIC
Visual Basic
Turbo Pascal
Parameters
unchar lptIntrThe LPT interrupt level (7 for LPT1)
uchar lptPortThe LPT port number (See table below for defini tions.)
Returns
See Also
Program References
tbkInit
communications with a TempBook unit, reset the TempBook hardware to power-on conditions, and
select the TempBook as the current TempBook.
TempBook only after the
TempBook.
is used to perform multiple functions: initialize subroutine library variables, establish
tbkInit
tbkClose
command is called to terminate communications with the
can be called to reinitialize the
tbkRd
DLL Function
C
QuickBASIC
Visual Basic
Turbo Pascal
Parameters
uint chan
unit *sample
unchar gain
Returns
See Also
Program References
tbkInit
•
•
•
•
Note:
tbkAdcRd
will perform the following tasks:
Stop any current acquisition
Set the scan group to channel 1 with a gain of 1
Set the pacer clock to 100 kHz
Reset the counter/timers
A single channel number (s ee t abl e at end of chapter for valid values).
A pointer to a value where an A/D sample is stored
The channel gain (see table at end of chapter for valid values)
The bit number of the specified digital I/O port to read
Valid values: 0 - 7
A variable to hold the value of the s pecified bit (non-zero if asserted, 0 if unasserted)
The value read back from the Counter 0 hol d regi ster
Valid values: 0 - 65535
If latch is non-zero, the count regis ter will be latched into the hold register before reading.
If latch is zero, the count regist er will be read directly.
Direct reading should only be performed when no clock pulses are present.
TerrNoError
tbkConfCntr0, tbkWtCntr0
None
tbkRdCntr0
counter 0 (see
tbkRdCntr0
- No error
reads the hold register of counter 0. This function is normally used with mode 0 of
tbkConfCntr0
) to read the current count value.
TempBook User’s ManualtbkCommand Reference (
Standard
API) 9-9
tbkRdFore
DLL Function
C
QuickBASIC
Visual Basic
Turbo Pascal
Parameters
uint *sample
Returns
See Also
Program References
tbkRdN
DLL Function
C
QuickBASIC
Visual Basic
Turbo Pascal
Parameters
unit chan
uint *buf
uint count
uchar trigger
uchar one shot
float freq
uchar gain
A single channel number (see table at end of chapter for valid values)
An array where the A/D scans will be returned
The number of scans to be taken
Valid values: 1 - 32767
The trigger source (see table at end of chapter for valid values)
A flag that if non-zero enables one-s hot trigger mode, otherwise enables continuous mode.
The sampling frequency in Hz (100000.0 to 0.0002)
tbkRdN
The channel gain (see table at end of chapter for valid values)
is used to take multiple scans from a single A/D channel. This function will configure the
- Buffer overrun
- Invalid gain
- Invalid channel
- Invalid trigger
- Invalid level
pacer clock, arm the trigger and acquire ‘count’ scans from the specified A/D channel.
9-10 tbkCommand Referenc e (
Standard
API)TempBook User’s Manual
DLL Function
C
QuickBASIC
Visual Basic
Turbo Pascal
Parameters
uint *buf
uint count
uchar cycle
uchar updateSingle
Returns
See Also
Program References
tbkRdNBack
return control back to the user’s program after initiating the background transfer. The user can then
monitor the status of the background transfer with the
transfer with the
can perform other tasks in the foreground. This function assumes that the A/D acquisition has
already been setup.
If the cycle flag is true, the background transfer will run continuously looping back to the beginning
of ‘buf’ after ‘count’ scans have been read. This allows the user to read large amounts of data
without calling
buffer and processes the data before it gets overwritten, the background transfer can run indefinitely.
In this mode, the user should get the total number of scans written into ‘buf’ using
tbkGetBackStat
difference between these two totals is the number of unprocessed valid scans in ‘buf’ that the user
can process.
An array where the A/D scans will be placed
The number of scans to be taken
Valid values: 1 - 32767
A flag that if non-zero will enable continuous operation, or if 0 will disable it
A flag that if non-zero will enable single scans to be read into buf or if 0 will enable buf to be updat ed in
a block of 256 scans
reads multiple A/D scans in the background using interrupts. This function will
tbkBackStop
tbkRdNBack
- Background read already in progress
- No error
tbkGetBackStat
function or stop the
function. Because the transfer occurs in the background, the user
multiple times. As long as the user monitors how much data is in the
and keep track of the total number of scans processed in a variable. The
Note: the Visual Basic chapter includes an example program which demonstrates how to use the
cycle mode of
The
updateSingle
tbkRdNBack
sample at a time or in blocks of 256 scans. Enabling
data during slow acquisitions as the data is acquired. Because the
.
flag allows the user to control whether the TempBook/66 updates ‘buf’ one
updateSingle
allows the user to read A/D
updateSingle
flag is directly
tied to the number of interrupts that will be generated on the computer, the flag should not be
enabled if the acquisition rate is greater than roughly 500 scans per second (sampling rate * # of
channels). For example, an a cquisition running at 1 Hz might enable the
updateSingle
flag so
that the data can be read each second rather than waiting for 256 seconds. An acquisition running at
10,000 Hz would disable the flag so the computer does not hang.
TempBook User’s ManualtbkCommand Referenc e (
Standard
API) 9-11
tbkRdNBackPreT
DLL Function
C
QuickBASIC
Visual Basic
Turbo Pascal
Parameters
uint *buf
uint count
uchar cycle
Returns
See Also
Program References
tbkRdNBackPreT
the background. This function will return control to the user's program after initiating the
background transfer. The user can then monitor the status of the background transfer with the
tbkGetBackStat
transfer occurs in the background, the user can perform other tasks in the foreground. This function
assumes that the pre-trigger acquisition has already been setup using the
command.
If the 'cycle' flag is true, the background transfer will run continuously looping back to the beginning
of 'buf' after 'count' scans have been read. Under this mode, the background transfer will continue
until the acquisition completes. This allows the user to collect large amounts of data without calling
tbkRdNBackPreT
processes the data before it gets overwritten, the background transfer can run until the acquisition
completes. In this mode, the user should get the total number of scans written into 'buf' using the
tbkGetBackStat
The difference between these two totals is the number of unprocessed valid scans in 'buf' that the
user can process.
int tbkRdNBackPreT(uint *buf, uint count, uchar cycle);
tbkRdNBackPreT(unsigned int _far *buf, unsigned int count, unsigned char
An array where the A/D scans will be placed.
The number of scans to be taken (1-32767)
A flag that if non-zero will enable continuous operation, or if 0 will disable it
several times. As long as the user monitors how much data is in the buffer and
function and keep track of the total number of scans processed in a variable.
If, however, the 'cycle' flag is false, the background transfer will only collect the number of scans
specified in 'count'. If this is the case, a number of
the data collected during the pre-trigger mode acquisition.
tbkRdNFore
DLL Function
C
QuickBASIC
Visual Basic
Turbo Pascal
Parameters
uint *buf
uint count
Returns
See Also
Program References
tbkRdNFore
does not use interrupts and does not return control immediately to the program. It will return only
when ‘count’ scans have been read. This function will not configure the A/D acquisition and
assumes that the A/D converter has already been configured to acquire data.
Note: If the A/D converter has not been configured to acquire data, this function may wait
indefinitely, hanging the computer.
An array where the A/D samples will be placed
The number of scans to be taken
Valid values: 1 - 32767
Pointer to an integer representing t he number of scans actual l y t aken
Pointer to a flag indicating whether or not the pre-trigger acquisition is still active
the foreground. Unlike the
does not return control immediately to the application program. It will only return when either the
specified count has been satisfied or the acquisition completes.
This function may be called subsequent to configuring a pre-trigger acquisition using the
tbkSetTrigPreT
two possible conditions are met: 1) The specified number of scans has been collected, or, 2) the
trigger has been detected and the acquisition has completed. In the latter case, the returned 'active'
flag will be 0 and the number of scans actually collected will be returned in 'retcount'.
- Buffer overrun
- No error
reads multiple A/D scans, initiated by the
tbkRdNBackPreT
command, this function does not use interrupts and
tbkSetTrigPreT
command, in
command. Once this command has been called, it will return only when one of
Note: If the A/D converter has not been configured to acquire data, this function may wait
indefinitely, hanging the computer.
TempBook User’s ManualtbkCommand Referenc e (
Standard
API) 9-13
tbkRdNForePreTWait
DLL Function
C
QuickBASIC
Visual Basic
Turbo Pascal
Parameters
uint *buf
uint count
uint *retcount
Returns
See Also
Program References
tbkRdNForePreTWait
command, in the foreground. Unlike the
return until the acquisition completes. It will only return when the specified trigger event has
occurred and the specified post trigger count has been satisfied.
This function may be called subsequent to configuring a pre-trigger acquisition using the
tbkSetTrigPreT
trigger has been detected and the acquisition has completed. The amount specified in the ‘count’
parameter specifies the length of the supplied buffer in scans. Unlike
command will not return when ‘count’ is satisfied; instead, it will continue acquiring by wrapping
the scans to the beginning of the buffer until the final post-trigger scan is collected and the
acquisition completes.
int tbkRdNForePreTWait(uint *buf, uint count, uint *retcount);
tbkRdNForePreTWait(unsigned int _far *buf, unsigned int count, unsigned int
An array where the A/D samples will be placed
The number of scans to be taken
Valid values: 1 - 32767
Pointer to an integer representing t he number of scans actual l y t aken
command. Once this command has been called, it will return only when the
tbkAdcRdNForePreT
this
tbkRdScan
DLL Function
C
QuickBASIC
Visual Basic
Turbo Pascal
Parameters
uint startChan
uint endChan
uint *buf
unchar gain
Returns
See Also
Program References
When the acquisition completes, control will be returned to the application program along with the
actual number of scans collected in the ‘retcount’ parameter.
Note: If the A/D converter has not been configured to acquire data or the trigger event never occurs,
this function may wait indefinitely, hanging the computer.
The starting channel of the s can group (see table at end of chapter for val i d val ues)
The ending channel of the scan group (see t abl e at end of chapter for valid values)
An array where the A/D scans will be placed
The channel gain (see table at end of chapter for valid values)
The starting channel of the s can group (see table at end of chapter for val i d val ues)
The ending channel of the scan group (see t abl e at end of chapter for valid values)
An array where the A/D scans will be placed
The number of scans to be read
Valid values: 1 - 65536
The trigger source (see table at end of chapter for valid values)
A flag that if non-zero enables one-s hot trigger mode
The sampling frequency in Hz
Valid values: 100000.0 - 0.0002
The channel gain (see table at end of chapter for valid values)
pacer clock, arm the trigger and acquire ‘count’ scans consisting of each channel starting with
‘startChan’ and ending with ‘endChan’.
- Invalid gain
- Invalid channel
- Invalid trigger
- Invalid Level
- Buffer Overrun
- No error
reads multiple scans from multiple A/D channels. This function will configure the
tbkRdTemp
DLL Function
C
QuickBASIC
Visual Basic
Turbo Pascal
Parameters
uint chan
uint tcType
int *temp
Returns
See Also
Program References
tbkRdTemp
The reading will be zero corrected, span corrected, and linearized to yield a temperature reading in
tenths of a degree Celsius. This function will use software triggering to immediately trigger and
acquire one sample.
If a calibration constant file with the default name, “
program then no span correction is performed.
Single channel number (see tabl e at end of chapter for valid values)
Thermocouple type (see table at end of chapter for valid values)
Pointer to a value where the converted tem perature is to be stored
The readings will be zero corrected, span corrected, and linearized to yield temperature reading(s) in
tenths of a degree Celsius. This function will use pacer clock triggering to acquire samples at the
rate defined in the parameter
averaging.
Single channel number (see tabl e at end of chapter for valid values)
Thermocouple type (see table at end of chapter for valid values)
Number of scans to read.
Pointer to a value where the converted tem perature is to be stored
Pointer to an array where the raw ADC counts are to be stored.
Sampling frequency in Hz
Valid values: 100000.0 - 0.0002
Type of averaging to be used.
0 - block averaging
1 - no averaging
2 - moving averaging
Single channel number (see tabl e at end of chapter for valid values)
Ending channel of the scan group (s ee table at end of chapter for valid values)
Thermocouple type (see table at end of chapter for valid values)
An array where the A/D scan will be placed.
through 'endChan'. The readings will be zero corrected, span corr ected, and lineariz ed to yield
temperature readings in tenths of a degree Celsius. This function will use software triggering to
immediately trigger and acquire one scan.
- Invalid Channel
- Invalid Thermocouple Type
is used to take thermocouple readings from analog input channels 'startChan'
If a calibration constant file with the default name "
program, then no span correction is performed.
tbkSetMode
must be called before this function to configure the TempBook for differential
‘startChan’ through ‘endChan’. The readings will be zero-corrected, span-corrected, and linearized
to yield temperature readings in tenths of a degree Celsius. This function will use pacer-clock
triggering to acquire samples at the rate defined in the parameter
to specify no, b lock, or moving averaging.
Single channel number (see tabl e at end of chapter for valid values)
Ending channel of the scan group (s ee table at end of chapter for valid values)
Thermocouple type (see table at end of chapter for valid values)
Number of scans to read.
Pointer to a value where the converted tem peratures are to be stored
Pointer to an array where the raw ADC counts are to be stored.
Sampling frequency in Hz
Valid values: 100000.0 - 0.0002
Type of averaging to be used.
is used to take multiple thermocouple readings from analog input channels
. The parameter
freq
avg
is used
A pointer to a buffer array must be provided for storage of the raw ADC counts. The array
dimension must be at leas t count * (endChan - star tChan + 4).
If a calibration constant file with the default name “
tempbook.cal
” is not visible to the calling
program, then no span correction is performed.
tbkSetMode
must be called before this function to configure the TempBook for differential
operation in either unipolar or bipolar mode.
9-18 tbkCommand Referenc e (
Standard
API)TempBook User’s Manual
DLL Function
C
QuickBASIC
Visual Basic
Turbo Pascal
Parameters
The file name with optional path information of the cali brat ion file. If calfi l e i s NULL or empty (""), the
default calibration file TEMPBOOK .CAL will be read.
calibration text file. This function, which is usually called once at the beginning of a program, will
read all the calibration constants from the specified file. If calibration constants for a specific gain
setting are not contained in the file, ideal calibration constants will be used, essentially performing
no calibration for that channel. If an error occurs while trying to open the calibration file, ideal
calibration constants will be used for all channels and a non-zero error code will be returned by the
tbkReadCalFile
See the Software Calibration and Zero Compensation chapter for a complete description of
calibration.
- No error
- Error occurred while opening or reading calibration f i le
is the initialization function for reading in the calibration constants from the
function.
DLL Function
C
QuickBASIC
Visual Basic
Turbo Pascal
Parameters
uchar lptPort
Returns
See Also
Program References
int tbkSelectPort(uchar lptPort);
tbkSelectPort(unsigned int lptPort);
BtbkSelectPort% (ByVal lptPort%)
VBtbkSelectPort% (lptPort%)
tbkSelectPort( lptPort:byte ):integer;
The LPT port number (see table below for definitions.)
selects an initialized TempBook. This function causes any subsequent function
calls to be performed on this TempBook. Because
tbkSelectPort
Note:
tbkInit
is only needed when using multiple TempBooks.
must be called with the corresponding LPT port before
select it.
tbkInit
tbkSelectPort
initializes then selects a TempBook,
tbkSelectPort
can
TempBook User’s ManualtbkCommand Referenc e (
Standard
API) 9-19
tbkSetClk
DLL Function
C
QuickBASIC
Visual Basic
Turbo Pascal
Parameters
uint ctr1
uint ctr2
Returns
See Also
Program References
tbkSetClk
pacer clock can be used to control the sampling rate of the A/D converter. The frequency is defined
to be xtal/ctr1*ctr2) where xtal is the frequency of the board crystal (either 1 MHz or 100 kHz).
This is a function that takes an integer (error code) and returns nothing, or NULL to disable.
TerrNoError
tbkDefaultHandler
automatically calls a default system error handler. This command allows the user to supply an
error handler that is automatically called when a system error is detected.
- Invalid clock
- No error
sets the frequency of the pacer clock using the two specified counter values. The
- No error, or an error number
*** For Visual Basic and QuickBASIC - If the driver det ects an error condition during its operation,
it will pass the error code as the return value of each function. This command allows the user to
set a BASIC error number which will be generated when an error occurs. The error can then be
handled using the standard ONERROR feature of BASIC.
9-20 tbkCommand Referenc e (
Standard
API)TempBook User’s Manual
DLL Function
C
QuickBASIC
Visual Basic
Turbo Pascal
Parameters
float freq
Returns
See Also
Program References
DLL Function
C
QuickBASIC
Visual Basic
Turbo Pascal
Parameters
The sampling frequency in Hz
Valid values: 100000.0 - 0.0002
TerrNoError
tbkGetFreq, tbkSetClk
None
tbkSetFreq
- No error
calculates then sets the frequency of the pacer clock using the specified frequency in
Hz. The frequency is converted to two counter values that control the frequency of the pacer clock.
In this conversion, some resolution of the frequency may be lost.
the exact frequency setting of the pacer clock.
tbkSetClk
can be used to explicitly set the two
tbkRdFreq
can be used to read
counter values of the pacer clock. The pacer clock can be used to control the sampling rate of the
A/D converter.
Zero value causes TempBook to go to single-ended mode (power-on default).
Non-zero value causes differenti al mode.
Zero value causes TempBook to default to Unipolar mode. Non-zero val ue causes default Bipolar
mode. All ADC convers i ons except those started with
TerrNoError
None
tbkSetMode
is used to program the gain amp for single-ended or differential operation and to set
the default polarity.
tbkSetScan
- No error
will use the default polarity.
Single-ended operation measures the voltage of the selected channel referred to analog ground.
Differential operation measures differences in voltage between a pair of selected channels.
Polarity is unipolar or bipolar:
•
Unipolar maximum voltage range is 0 to +10 V
•
Bipolar maximum voltage range is -10 to +10 V.
TempBook User’s ManualtbkCommand Referenc e (
Standard
API) 9-21
tbkSetMux
DLL Function
C
QuickBASIC
Visual Basic
Turbo Pascal
Parameters
The starting channel of the s can group (see table at end of chapter for val i d val ues)
The ending channel of the scan group (see t abl e at end of chapter for valid values)
The gain value for all channels (see t abl e at end of chapter for valid values)
specifies to the TempBook/66 driver the type of parallel-port implementation
and protocol that is available on the computer. The driver then attempts to configure the computer
and the TempBook/66 to communicate using the specified protocol. Since establishing the protocol
may affect the settings of the TempBook,
after
tbkInit
has established communications with and reset the TempBook. Switching protocols
during normal TempBook/66 operation is not recommended.
Two types of parallel port implementations are supported by the TempBook: standard and enhanced.
Standard parallel ports, using the TempBook/66 manufacturer’s proprietary protocols, are capable of
receiving data either 4 or 8 bits at a time. When possible, 8-bit operation is preferred (it is much
faster), but not all standard parallel ports support 8-bit data reception.
8-bit I/O1
4-bit I/O2
Far Point F/Port EPP Interface10
82360 SL EPP Interface20
SMC 37C666 EPP mode30
EPP bios mode40
WBK20/21 Fast EPP mode50
tbkSetProtocol
should only be invoked immediately
Enhanced parallel ports (EPP) include extra hardware that increases the rate of data transfer to 3 to
10 times the rate of a standard parallel port. Unfortunately, not every computer includes EPP
capability and attempting to use EPP on an incompatible computer may cause the TempBook/66
driver to access I/O locations which are not part of the printer port interface. Such accesses may
interfere with other operations and cause the computer to operate incorrectly. For this reason, EPP
operation must be explicitly requested by the program.
When the TempBook/66 is initialized by
tbkInit
port protocol: either 8-bit, if possible, or the slower 4-bit protocol. After
tbkSetProtocol
If
tbkSetProtocol
may be used to switch to another supported protocol.
is unable to establish communications using the specified protocol, then it
, it is initially configured for a standard parallel
tbkInit
has completed,
will try to establish communications using the standard port protocols, first 8-bit, then the slower 4bit. In such an event,
tbkSetProtocol
will not return an error indication unless it is unable to
establish any protocol.
In any case,
tbkGetProtocol
may be used to check the current operating protocol.
TempBook User’s ManualtbkCommand Referenc e (
Standard
API) 9-23
tbkSetScan
DLL Function
C
QuickBASIC
Visual Basic
Turbo Pascal
Parameters
uint *chans
uchar *gains
uchar polarities
uint count
Returns
See Also
Program References
tbkSetScan
corresponding gains. As many as 512 entries can be made in the scan configuration. Any analog
input channel at any gain can be included in the scan. Channels can be entered multiple times at the
same or different gain. The high-speed digital I/O port can also be includ ed although its gai n value
will be ignored.
An array of up to 512 channel numbers (see table at end of chapter for vali d val ues)
An array of up to 512 gain values (see table at end of chapter for valid values)
An array of up to 512 polarity values. Zero val ue causes TempBook/66 to select Unipolar mode. Nonzero values causes Bipolar mode.
The number of values in the chans and gai ns arrays
Valid values: 1 - 512
The trigger source (see table at end of chapter for valid values)
A flag that if non-zero enables one-s hot trigger mode, otherwise enables continuous mode
A non-zero flag selects an internal 100 kHz clock to be t he i nput to counter 0.
If the flag is zero, only t he external clock is the input t o counter 0.
See figure in
A flag that if zero, disabl es the external TTL Trigger from affecting the pacer clock.
If the flag is non-zero, any low-level on the TTL trigger will cause the pacer clock to pause.
sets and arms the trigger of the A/D converter. Eight trigger sources and several
mode flags can be used to generate a wide variety of acquisitions. The
will stop any current acquisitions, empty the TempBook/66 of any data previously acquired and arm
the TempBook/66 using the specified trigger source.
for detailed diagram.
- Invalid trigger
tbkSetTrig
command
The pacer clock trigger source can be used to acquire data at a constant frequency. The sampling
rate can be set using the
tbkSetClk
or
tbkSetFreq
functions. The one-shot flag has no
meaning when using this trigger source.
The software trigger source allows the user to trigger the A/D from software using the
tbkSoftTrig
function. When the one-shot mode is enabled, a single scan will be initiated by the
software trigger. In the continuous mode (one-shot disabled), sending a software trigger will cause
the A/D converter to sample at the rate of the pacer clock.
An external TTL pulse can be used to initiate a scan or start an acquisition when using the external
TTL rising or falling edge trigger source. The external TTL pulse should be applied to the trig
input. The pulse will initiate a single scan in one-shot mode and a continuous acquisition at the
pacer clock frequency in continuous mode.
Setting the counter 0 mode flag true will enable an onboard 100 kHz clock to be ANDed with the
counter 0 input to produce the input to counter 0. If nothing is connected to counter 0 input, the line
will float high essentially clocking counter 0 off the 100KHz clock. If this flag is false, counter 0
can only be clocked from the counter 0 input pin. Counter 0 can be used as an alternative trigger
source by connecting the counter 0 output to the trig input and choosing an external TTL trigger.
Counter 0 can also be used for general counter applications.
The pacer mode flag enables/disables operation of the pacer clock. If this flag is non-zero, the pacer
clock will be gated with the trig input. If it is zero, the pacer clock will be enabled.
trigger data acquisition. The
empty the TempBook/66 of any data previously acquired, arm the TempBook/66 using the specified
analog level trigger source and will immediately begin the collection of the specified amount of pretrigger data.
This command allows the configuration of a data acquisition that includes both pre-trigger and posttrigger data. The specified pre-trigger amount indicates the number of pre-trigger scans to be
collected before the trigger is armed. The trigger event will only be recognized after the specified
pre-trigger amount has been satisfied and the trigger is armed. This means that the specified pretrigger amount represents the minimum amount of pre-trigger data which will actually be collected.
The specified post-trigger amount represents the number of scans taken after the detection of the
trigger event. This amount represents the exact number of scans taken subsequent to the detection of
the trigger event.
int tbkSetTrigPreT(uchar trigger, uint channel, uint level, uint precount,
uint postcount);
tbkSetTrigPreT(unsigned char source, unsigned int channel, unsigned int
level, unsigned int preCount, unsigned int postCount);
BtbkSetTrigPreT% (ByVal source%, ByVal channel%, ByVal level%, ByVal
preCount%, ByVal postCount%)
VBtbkSetTrigPreT% (source%, channels%, level%, preCount%, postCount%)
The channel in the current scan group t o trigger on
The level for the specified c hannel at which to detect the trigger (0-4095)
The number of pre-trigger scans t o collect before arming t he trigger (1-32767)
The number of post-trigger sc ans to collect after the occurrence of the trigger (1-32767)
sets the trigger for analog level triggering and initiates the collection of a pre-
tbkSetTrigPreT
command will stop any current acquisition,
The pacer clock may be used to set up the sampling rate for the acquisition. The sampling rate can
best be set by using the
The four analog trigger sources, rising or falling slope with either a positive or negative level, can be
used with any one of the channels in the currently defined scan group. This channel parameter
represents the relative channel within the scan group. It does not necessarily represent the actual
physical channel number.
When setting up a pre-trigger acquisition, a specific command set must be used to retrieve the data.
This command set includes
tbkRdNBackPreT
for each specific command in this chapter.
9-26 tbkCommand Referenc e (
Standard
tbkSetClk
or
tbkSetFreq
tbkRdNForePreT, tbkRdNForePreTWait
commands.
and
. For more information on these commands, refer to the command description
API)TempBook User’s Manual
DLL Function
C
QuickBASIC
Visual Basic
Turbo Pascal
Parameters
Returns
See Also
Program References
tbkSoftTrig
int tbkSoftTrig(void);
tbkSoftTrig(void);
BtbkSoftTrig% ()
VBtbkSoftTrig% ()
tbkSoftTrig:integer;
None
TerrNoError
tbkSetTrig
- No error
is used to send a software trigger command to the TempBook. This software
trigger can be used to initiate a scan or an acquisition from a program after configuring the software
trigger as the trigger source.
DLL Functionint tbkStopBack(void);
C
QuickBASIC
Visual Basic
Turbo Pascal
Parameters
Returns
See Also
Program References
function will configure the thermocouple linearization functions to
automatically perform zero compensation. This is the easiest way to use zero compensation with the
TempBook. When enabled, the thermocouple conversion functions will require a CJC zero reading
and a TC zero reading to precede the actual CJC and TC reading.
tbkTC
… functions
TempBook User’s ManualtbkCommand Referenc e (
Standard
API) 9-27
tbkTCConvert
DLL Function
C
QuickBASIC
Visual Basic
Turbo Pascal
Parameters
uint *counts
uint scans
int * temp
uint ntemp
Returns
See Also
Program References
tbkTCConvert
degrees Celsius. Note: Total number of conversions (scan * chans/scan) must be less than 32 K.
Number of readings in a scan.
Valid range: 1- 512
Position of CJC reading within a scan.
Valid range: 0 - (nscan-1)
2 -(nscan-1), if auto-zeroing is used.
Number of thermocoupl es immediately f ollowing CJC.
Valid range: 1 - (nscan-cjcposition-1)
Type of thermocouple (see tabl e at end of chapter for valid types)
Zero for unipolar, non-zero for bipolar.
Type of averaging to be used.
The number of readings in a single s can.
Valid range: 1- 512
The position of the CJC reading within the scan.
Valid range: 0 - (nscan-1)
2 -(nscan-1), if auto-zeroing is used.
The number of thermocouple readi ngs that immediately follow the CJC reading within the scan.
Valid range: 1 - (nscan-cjcposition-1)
The type of thermocouples being measured (see table at end of c hapter for valid types)
Non-zero if the TempBook/66 is configured for bipolar readings.
The type of averaging to be performed: block, none or moving.
The raw data from one or more scans.
The number of scans of raw data in counts.
The converted temperatures in t enths of a degree C.
The number of elements provi ded i n the temp array (for error check i ng).
function compensates one or more scans according the previously called
function. This function will modify the array of data passed to it. See the
Standard
API)TempBook User’s Manual
DLL Function
C
QuickBASIC
Visual Basic
Turbo Pascal
Parameters
uint nscan
uint zeroPosition
uint
readingsPosition
uint nReadings
Returns
See Also
Program References
The
zeroed within a scan, the size of the scan and the number of readings to zero. This function does not
do the conversion. A non-zero return value indicates an invalid parameter error. See the Software
Calibration and Zero Compensation chapter for a complete description of zero compensation.
function configures the location of the shorted channel and the channels to be
DLL Function
C
QuickBASIC
Visual Basic
Turbo Pascal
Parameters
uint nscan
uint zeroPosition
uint
readingsPosition
uint nReadings
uint *counts
uint scans
Returns
See Also
Program References
For convenience, both the setup and convert steps can be performed with one call to
tbkZeroSetupConvert
multiple times because data was read from channels at different gains or polarities. See the Software
Calibration and Zero Compensation chapter for a complete description of zero compensation.
The number of readings in a single s can.
The position of the zero reading within the scan
The position of the readings to be zeroed within the scan.
The number of readings immediately following the zero reading that are sampled at the sam e gai n as
the zero reading.
The raw data from one or more scans.
The number of scans of raw data in t he counts array.
. This is useful when the zero compensation needs to be performed
TempBook User’s ManualtbkCommand Referenc e (
Standard
API) 9-31
API Reference Tables
These tables provide information for programming with the TempBook/66 Application Programming
Interface. The tables are organized as follows:
API Parameter Reference Tables
Table Tit lePage
A/D Channel Descriptions9-32
A/D Gain Definitions9-32
A/D Trigger Source Definitions9-32
Pretrigger Functions Trigger Sourc e Def i ni tions9-33
Thermocouple Types9-33
API Error Codes - C Languages9-33
API Error Codes - QuickBASIC9-34
API Error Codes - Turbo Pascal9-35
API Error Codes - Visual Basic9-36
A/D Channel Descriptions
A/D ChannelSource
0 to 15*Analog input channels 0 t o 15
16CJC Channel
18Shorted Channel
272High-speed digital Inputs
*Note: In differential mode only channels 0 to 7 are valid.
0x00No error
0x01Specified LPT c hannel was out -of-range
0x02Requested TempBook is not on-line
0x03TempBook is not on the requested channel
0x04Bad function addres s
0x05FIFO Full detected, possible data corruption
0x10Invalid analog input c hannel
0x11Invalid count parameter
0x12Invalid trigger source parameter
0x14Invalid channel gain parameter
0x17Invalid port param et er
0x18Invalid chip parameter
0x1AInvalid bit number parameter
0x1BInvalid clock parameter
0x1CInvalid time-of-day parameter
0x20Invalid gate control parameter
0x21Invalid output control parameter
0x22Invalid interval parameter
0x23An integer was passed to a function requiring a character
0x24A second back ground t ransfer was requested
0x25Invalid Fout divis o r
0x26TC type out-of-range
0x27Temperature out-of-CJC-range
0x28Voltage out-of-TC-range
0x29Unspecified parameter value error
0x2A
0x2CA buffer overrun occ urred
0x2DInvalid zero com pensation parameter
0x2E
0x2FCannot open the specified calibration f i l e
0x30Cannot lock allocated memory from Windows
0x31Cannot get a memory handle from Windows
0x32No pre-trigger configured
&H00No error
&H01Specified LP T channel was out-of-range
&H02Requested TempBook is not on-line
&H03TempBook i s not on the requested channel
&H04Bad functi on address
&H05FIFO Full detect ed, possible data corruption
&H10Invalid
&H11Invalid count parameter
&H12Invalid trigger source parameter
&H14Invalid channel gai n parameter
&H17Invalid port parameter
&H18Invalid chip parameter
&H1AInvalid bit number parameter
&H1BInvalid clock parameter
&H1CInvalid time-of-day parameter
&H20Invalid gate c ont rol parameter
&H21Invalid output control parameter
&H22Invalid interval parameter
&H23An integer was passed to a function requiring a charact er
&H24A second background transfer
&H25Invalid Fout divi sor
&H26TC type out of range
&H27Temperature out-of-CJC-range
&H28Voltage out-of-TC-range
&H29Unspecifi ed parameter value error
&H2A
&H2CA buffer overrun occurred
&H2DInvalid zero compensation parameter
&H2E
&H2FCannot open the specified calibrati on file
&H30Cannot lock al l ocated memory from Windows
&H31Cannot get a memory handle from Windows
&H32No pre-trigger confi gured
0No error
1Specified LPT channel was out-of-range
2Requested TempBook is not on-l i ne
3TempBook is not on the requested channel
4Bad function address
5FIFO Full detected, possible data corruption
16Invalid
17I nval i d count parameter
18I nval i d trigger source parameter
20I nval i d channel gain parameter
23I nval i d port parameter
24I nval i d chip parameter
26I nval i d bi t number parameter
27I nval i d clock parameter
28I nval i d time-of-day parameter
32I nval i d gate control parameter
33I nval i d output control parameter
34I nval i d i nterval parameter
35A n i nt eger was pas sed to a function requiring a character
36A second background transfer was request ed
37I nval i d Fout divisor
38TC t ype out -of -range
39Temperature out-of-CJC-range
40V ol t age out-of-TC-range
41Uns pecified parameter value error
42
43TempBook not capable of func tion
44A buf fer overrun occurred
45I nval i d zero compensation paramet er
46
47Cannot open t he specified calibration file
48Cannot l ock allocated memory from W i ndows
49Cannot get a memory handle from Windows
50No pre-t ri gger configured
tbkTCConvert
tbkZeroConvert
called before
tbkTCSetup
called before
tbkZeroSetup
TempBook User’s ManualtbkCommand Referenc e (
Standard
API) 9-35
API Error Codes - Visual Basic
Error Name
Global Const TerrNoError%
Global Const TerrBadChannel%
Global Const TerrNotOnLine%
Global Const TerrNoTempBook%
Global Const TerrBadAddress%
Global Const TerrFIFOFull%
Global Const TerrInvChan%
Global Const TerrInvCount%
Global Const TerrInvTrigSource%
Global Const TerrInvGain%
Global Const TerrInvPort%
Global Const TerrInvChip%
Global Const TerrInvBitNum%
Global Const TerrInvClock%
Global Const TerrInvTod%
Global Const TerrInvGateCtrl%
Global Const TerrInvOutputCtrl%
Global Const TerrInvInterval%
Global Const TerrTypeConflict%
Global Const TerrMultBackXfer%
Global Const TerrInvDiv%
Global Const TerrTCE_TYPE%
Global Const TerrTCE_TRANGE%
Global Const TerrTCE_VRANGE%
Global Const TerrTCE_PARAM%
Global Const TerrTCE_NOSETUP%
Global Const TerrOverrun%
Global Const TerrZCInvParam
Global Const TerrZCNoSetup
Global Const TerrInvCalFile
Global Const TerrMemLock
Global Const TerrMemHandle
Global Const TerrNoPreTActive
Error
CodeDescription
&H00No error
&H01Spec i f i ed LPT channel was out-of-range
&H02Request ed TempBook is not on-line
&H03Tem pBook is not on the requested c hannel
&H04Bad f unction address
&H05FIFO Full det ected, possible data corrupt ion
&H10Invalid
&H11Invalid count parameter
&H12Invalid trigger source parameter
&H14Invali d channel gain parameter
&H17Invalid port parameter
&H18Invalid chip parameter
&H1AInvalid bit number parameter
&H1BInvalid cl ock parameter
&H1CInvalid time-of-day param eter
&H20Invali d gate control parameter
&H21Invali d output control parameter
&H22Inval i d i nterval parameter
&H23An integer was passed to a function requiring a character
&H24A s econd background transfer
&H25Inval i d Fout divisor
&H26TC type out-of-range
&H27Tem perature out-of-CJC-range
&H28Voltage out-of-TC-range
&H29Unspecified parameter value error
&H2A
&H2CA buffer overrun occurred
&H2DInvalid zero compensation parameter
&H2E
&H2FCannot open the specified c al i bration file
&H30Cannot lock allocated memory from Windows
&H31Cannot get a memory handle from Windows
&H32No pre-trigger configured
tbkTCConvert
tbkZeroConvert
called before
tbkTCSetup
called before
tbkZeroSetup
9-36 tbkCommand Referenc e (
Standard
API)TempBook User’s Manual
Enhanced API Programming Models (TempBook)
Overview
The enhanced Application Programming Interface (API) allows you to create custom software to satisfy
your TempBook data acquisition requirements. Two chapters explain the enhanced API: this chapter gives
you the basic concepts needed to write effective programs, and chapter 11 describes the API functions in
detail. This chapter explains how to combine the API functions into useful routines and is divided into 3
parts:
•
Data Acquisition Environment outlines related concepts and defines system capabilities the
programmer must work with (the API , hardware features, and signal management).
•
Programming Models explains the sequence and type of operations necessary for data acquisition.
These models provide the software building blocks to develop more complex and specialized
programs. The description for each model has a flowchart and example program excerpt.
•
Summary Guide of Selected API Functions is an easy-to-read table that describes when to use the
basic API functions.
10
Note: The TempBook enhanced API is a subset of the
32-bit data acquisition applications (TempBook, WaveBook, DaqBook, DaqBoar d, Daq PC-Card,
etc). This manual describes the commands that pertain to the TempBook.
Data Acquisition Environment
In order to write effective data acquisition software, programmers must understand:
•
Software tools (the API documented in this manual and the programming language—you may need to
consult documentation for your chosen language)
•
Hardware capabilities and constraints
•
General concepts of data acquisition and signal management
Application Programming Interface (API)
The API includes all the software functions needed for building a data acquisition system with the hardware
described in this manual. Chapter 11 (daqCommand Reference—Enhanced API) supplies the details about
how each function is used (parameters, hardware applicability, etc). In addition, you may need to consult
your language and computer documentation.
Enhanced vs Standard API
Major differences between the enhanced and standard APIs were described in the introductory chapter
(Programmer’s Guide). Language support varies as follows:
•
The enhanced API (32-bit only) accommodates C, Visual Basic, and Delphi.
•
The standard API (16-bit only) accommodates C, QuickBASIC, Visual Basic, and Turbo Pascal 7.
Note: Coding for the enhanced and standard API cannot be used together; enhanced and standard models
are slightly different (this chapter is for the enhanced API models; chapters 6 to 8 demonstrate examples
using the standard AP I).
DaqX
API which provides a common interface for
Hardware Capabilities and Constraints
To program the system effectively, you must understand your hardware capabilities. Obviously you cannot
program the hardware to perform beyond its design and specifications, but you also want to take full
advantage of the system’s power and features. You may need to refer to sections that describe your
hardware’s capability. In addition, you may need to consult your computer documentation. In some cases,
you may need to verify the hardware setup, use of channels, and signal conditioning options (some
hardware devices have jumpers and DIP switches that must match the programming, especially as the
system evolves).
TempBook User’s Manual
Enhanced
API Programming Models (TempBook) 10-1
Signal Environment
Several data acquisition concepts are listed here; you must apply these concepts as needed in your situation.
Some of these concepts include:
•
•
•
•
Parameters in the various A/D routines include: number of channels, number of scans, start of conversion
triggering, timing between scans, and mode of data transfer. Channels sampled in a scan can be consecutive
or non-consecutive with the same or different gains. The scan sequence makes no distinction between local
and expansion channels.
Device and parameter identification
Scan rates and sequencing
. With multiple scans, the time between scans becomes a parameter.
. Refer to the related reference tables in chapter 11.
This time can be a constant or can be dependent upon a trigger.
Triggering options
. Triggering starts the A/D conversion. The trigger can be an external analog or
TTL trigger or a program-controlled software trigger. Refer to the trigger functions in chapter 11.
Foreground/background
. Foreground transfer routines require the entire transfer to occur before
returning control to the application program. Background routines start the A/D acquisition and
return control to the application program before the transfer occurs. Data is transferred while the
application pro gram is running. Data will be transferred to the user memory buffer during program
execution in 1 sample or 2048 sample blocks, depending on the configuration. The programmer must
determine what tasks can proceed in the background while other tasks perform in the foreground and
how often the status of the background operations should be checked.
Basic Models
This section outlines basic programming steps commonly used for data acquisition. Consider the models as
building blocks that can be put together in different ways or modified as needed. As a general tutorial,
these examples use Visual Basic since most programmers know BASIC and can transla t e to other languages
as needed. The enhanced API programming models discussed in this chapter include:
Model TypeModel NamePage
Configuration
Acquisition
Data Handling
Initialization and Error Handling10-3
Foreground Acquisition with One-Step Commands
Temperature Acquisiti on Using One-Step Commands
Counted Acquisition Usi ng Li near Buffers
Indefinite Acquisi tion, Direct-To-Disk Using Circular Buffers
Multiple Hardware Scans, Software Triggering
Background Acquisit i on
Temperature Acquisiti on Using TC Conversion Functions
Double Buffering
Direct-to-Disk Trans fers
Transfers With Driver-Allocated Buffers
10-5
10-7
10-9
10-11
10-14
10-16
10-18
10-21
10-23
10-26
10-2
Enhanced
API Programming Models (TempBook)TempBook User’s Manual
Initialization and Error Handling
This section demonstrates how to initialize the Daq* and use
various methods of error handling. Most of the example
programs use similar coding as detailed here. Functi ons
used include:
•
VBdaqOpen&(daqName$)
•
VBdaqSetErrorHandler&(errHandler&)
•
VBdaqClose&(handle&)
All Visual Basic programs should include the DaqX.bas file
into their project. The DaqX.bas file provides the necessary
definitions and function prototyping for the DAQX driver
DLL.
The Daq* device is opened and initialized with the
daqOpen
function.
daqOpen
takes one parameter—
the name of the device to be opened. The device name information can be accessed or changed via the
Daq* Configuration utility located in the operating system’s Control Panel. The
daqOpen
call, if
successful, will return a handle to the opened device. This handle may then be used by other functions to
configure or perform other operations on the device. When operations with the device are complete, the
device may then be closed using the
daqOpen
will return -1.
daqClose
function. If the device could not be found or opened,
The DAQX library has a default error handler defined upon loading. However; if it is desirable to change
the error handler or to disable error handling, then the
daqSetErrorHandler
function may be used to
setup an error handler for the driver. In the following example the error handler is set to 0 (no handler
defined) which disables error handling.
ret& = VBdaqSetErrorHandler&(0&)
If there is a Daq* error, the program will continue. The function’s return value (an error number or 0 if no
error) c an help you debug a program.
If (VBdaqOpen&(“TempBook0”) < 0) Then
“Cannot open “TempBook0”
Daq* functions return
Print “daqErrno& : ”; HEX$(daqErrno&)
End If
daqErrno&
.
The next statement defines an error handling routine that frees us from checking the return value of every
Daq* function call. Although not necessary, this sample program transfers program control to a userdefined routine when an error is detected. Without a Daq* error handler, Visual Basic will receive and
handle the error, post it on the screen and terminate the program. Visual Basic provides an integer variable
(ERR) that contains the most recent error code. This variable can be used to detect the error source and
take the appropriate action. The function
daqSetErrorHandler
tells Visual Basic to assign ERR to a
specific value when a Daq*error is encountered. The following line tells Visual Basic to set ERR to 100
when a Daq*error is encountered. (Other languages work similarly; refer to specific langua ge
documentation as needed.)
The
than the standard error handler that Visual Basic uses automatically. The program uses
to transfer program control to the label ErrorHandler if an error is encountered.
Daq* errors will send the program into the error handling routine. This is the error handler. Program
control is sent here on error.
TempBook User’s Manual
On Error GoTo
ErrorHandler:
command in Visual Basic allows a user-defined error handler to be provided, rather
On Error GoTo
Enhanced
API Programming Models (TempBook) 10-3
errorString$ = "ERROR in ADC1"
errorString$ = errorString$ & Chr(10) & "BASIC Error :" + Str$(Err)
If Err = 100 Then errorString$ = errorString$ & Chr(10) & "DaqBook Error
: " + Hex$(daqErrno&)
MsgBox errorString$, , "Error!"
End Sub
10-4
Enhanced
API Programming Models (TempBook)TempBook User’s Manual
Loading...
+ hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.