KEITHLEY DATA ACQUlSlTiON - Keithley MetraSyWAsyst
440 Myles Slandiih Blvd., Taunton, MA 02780
RwisionA-FebntaylSS8
ParI Number: 24461
TEL 508/880-3000, FAX 508/880.0179
-3-
Warranty Information
All products manufactured by KeithIey Data Acquisition are warrantedagsinst defective materials and
workmanship foraperiodofone year from thedateof delivery to theoriginalpurchaser. Any product
that is found to be defective within the warranty period will, at the option of the manufacmrer, be
repaired or replaced. This warnutty does not apply M products damaged by improper use,
Warning
Keithley Data Acquisition assumes no liability for damages consequent
lo the use of tkii product. This product is not designed with
components of a level of reliability suitable for use io life support or
critical applications.
Information furnished by Keithley Data Acquisition is believed to beaccurateandreliable. However,
Keithley Data Acquisition assumes no responsibility for the use of such information nor for any
infringements of patents or other rights of third parties that may result from its use. No license is
granted by implication or otherwise under any patent rights of Keithley Data Acquisition.
Copyright
All tights reserved. No part of this publication may be reproduced, stored in a retrieval system, or
transmitted in any form by any means, electronic, mechanical, photoreproductive, recording, or
otherwise without the express prior written permission of Keithley Data Acquisition.
Note:
Keitkley MetraBy@‘, Trigger Mast@‘, and Trigger-LiokTM are trademarks of Keithley Data
Acquisition.
BASKI?’ is a trademark of Dsrtmouth College.
IBM@’ and Micro Channel Architecture’” are registered trademarks of International Business
Machines Corporation.
PC, XT, AT, and PSh sre trademarks of International Business Machines Corporation.
MicrosofttR’ is a registered trademark of Microsoft Corporation.
Turbo C’“’ and TurboPascal’*’ sre registered trademarks of Borland IntemationaI.
-4-
CHAPTER 1 - INTRODUCTION
Contents
1.1
1.2
1.3
1.4
CHAPTER 2 - INSTALLING Trigger
2.1
2.2
2.3
2.4
2.5 Installing Trigger Master
2.6 Running PLAYDOS.EXE or PLAYWIN.EXE
General Description
Distribution Software
Specifications
Trigger-Link
Master
Introduction
Inspecting the Boards
Setting Up the KPC-TM Board
Setting Up the KPC488.2TM Board
CHAPTER 3 - USING THE Trigger Master DRIVER
3.1
3.2
3.3
3.4
3.5
Introduction
Using the Driver
Using the Driver with BASICA
Accessing the Driver from C
Accessing the Driver from QuickBASIC and VisualBASIC
QuickBASIC
VisualBASIC
Accessing the Driver from TurboPascal
STCINIT
Calling STCINIT from BASICA
Calling STCINIT from C
Calling STCINIT from QuickBASIC and VisualBASIC
Calling STCINIT from TurboPascal and TurboPascal for Windows
STCSET
Calling STCSET from BASICA
Calling STCSETfmm C
Calling STCSET from QuickBASiC and VisualBASIC
Calling STCSET from TurboPascal and TurboPascal for Windows
STCCMD
Command Syntax
STCLOAD
Calling STCLOAD from BASICA
Calling STCLOAD from C
Calling STCLOAD from QuickBASIC and VisualBASIC
Calling STCLOAD from TurboPascal and
TurboPascal for Window
STCDUMP
Calling STCDUMP from BASICA
Calling STCDUMP from C
Calling STCDUMP from QuickBASIC and VisualBASIC
Calling STCDUMP from TurboPascal and
TurboPascal for Window
3-31
3-31 3-31
3-32
3-32
3-32
3-32
3-33
3-33
3-33
4.1
4.2 BASICA Language Example
4.3 C Language Example
4.4 QuickBASIC Example
4.5
CHAPTER 5 - CREATING PROGRAMS FOR Trigger Master MEMORY
5.1
CHAPTER 6 - CREATING A BACKGROUND DATA ACQUlSllION SYSTEM
FORDOS
6.1
6.2
6.3
6.4
6.5
Introduction
TurboPascal Example
Introduction 5-1
Introduction
The TSR Structure 6-2
NOKPC488 and MISSINGGPIBDEV 6-3
STCRUN
WAITONSTC and JMPWAITSTC 6-5
WAITONGPIB and WAITONAUX 6-5
STCFLAG 6-5
STCLOG 6-6
STCEXIT 6-6
A TSR Log 6-7
A TSR Example 6-8
Creating a TSR for C
4-1
4-2
4-7
4-11
4-15
6-1
6-4
6-11
- 7.
Contents
APPENDIXES
Appendix A - Trigger Master ERROR MESSAGES
Appendix 6 - COMMAND QUICK START
B.l
8.2
8.3
0.4
8.5
B.6
B.7
8.6
B.9
B.10
Appendix C -
C.1
c.2
c.3
c.4
C.5
C.6
c.7
Generate Trigger Outputs
Waft For Trigger Inputs
Enter Program Mode
Set Up and Terminate Program Loop (Program Mode Only)
Generate a Wait (Program Mode Only)
Track Program Execution and Generate interrupts
Exit Program Mode
lnftiate Program Execution
Halt Trigger Master Execution
Continue Execution of Halted Program
REQUEST QUICK START
Check Remaining Trigger Inputs Established by
ARM Command
Check Remaining Trigger Outputs Established by TRIG Command
Check the Actual State of the Trigger Lines
Check Time Remaining Before Next Trigger
Check Program Progress
Check Remaining Loop Count
Check Remaining Delay Time
B-1
B-l
B-2
B-2
0-2
B-2
B-3
B-3
B-3
B-3
C-l
C-l
C-l
C-l
c-2
c-2
c-2
-.s-
1.1 GENERAL DESCRIPTION
Trigger Masterm is a system trigger controller for instruments and data acquisition
boards with external triggering. Trigger Master supports a variety of trigger functions
occurring in data acquisition systems. Trigger Master monitors trigger inputs, creates
delays, and generates trigger outputs.
An outstanding feature of Trigger Master is its ability to run programs from its own
memory and to generate interrupts at appropriate steps of program execution. This
allows Trigger Master, with
autonomous data acquisition system in your personal computer (PC) while you use
your PC for other purposes,
Trigger Master is implemented on two boards:
some
Chapter 1
INTRODUCTION
adjunct data acquisition hardware, to operate as an
. The KPC-TM board provides Trigger Master as a stand-alone plug-in board for the
PCru/XTn’/ATn”’ computer.
. The KPC488.2TM board combines Trigger Master with the high performance
KPC488.2AT GPIB interface to provide a standard interface with GPIB instruments.
Note: This manual describes Trigger Master. For information on the IEEE-488
functions, refer to the manual IEEE 488 Interface Boards which accompanies the
KPC488.2TM board.
Figure l-1 is a block diagram of Trigger Master.
Physically, Trigger Master is equipped with an 8-pin MicroDIN connector which has 6
trigger lines and 2 ground lines. In addition to Trigger-Linkn’ introduced later in this
chapter, the MicroDIN can connect directly to standard BNC connectors using the 8502
Trigger-Link Adapter.
Chapter 2 describes configuring and installtng the boards.
Trigger Master employs proprietary chips containing state machines that run from an 8-
MHz clock. This allows Trigger Master to respond to a change of trigger inputs by
generating a trigger output within 1.25 us. The state machine coordinates all functions
including the interfaces to Trigger-Link and the PC bus.
A PC program controls Trigger Master using 11 SCPI-like commands which a driver
transforms to microcode instructions, sending them to Trigger Master. Trigger Master
supports three modes of operation:
INTRODUCTION l-1
Figure
.
l-1
Trigger Master Block Diagram
One mode of operation, Immediate Mode, allows some commands to be executed
immediately by Trigger Master.
. The second mode of operation, Progrum Mode, allows Trigger Master to store
commands in a 1-Kbyte program RAM as they are received for later execution.
Storing the program into RAM provides extremely powerful performance, since the
state machine can perform two level looping (one nested loop); for repeated
operations, the state machine uses available counters. This mode allows you to start
program storage and execution at any memory location, therefore allowing several
small programs to be resident in memory and allowing you to start them as
required.
. The third mode of operation, Run Mode, occurs while the Trigger Master executes a
program.
A user can generate trigger programs using any of the following methods:
Pass command strings from the user program to the Trigger Master driver.
.
. Write trigger programs using an ASCII-output word processor and then compile the
programs with STCCOMP.EXE.
Program interactively using PLAYWIN.EXE and PLAYDOSEXE, running,
.
respectively, from the Windows and DOS environments.
Any word processor that provides ASCII output allows you to write Trigger Master
programs, store them in ASCII, and then “compile” the output using the STCCOMP.EXE
program. Chapter 6 describes this procedure. The resulting “object” file is then easily
loaded into Trigger Master program memory and executed.
1 - 2 Trigger Master INTERFACES USER GUIDE
The Trigger Master driver supports up to four boards simultaneously. The driver
accepts the following commands:
ARM
Set trigger input condition and wait for trigger
BEGIN Enter program mode
CONT Restart a halted program at the next step
DO Mark the start of a program sequence that is to be performed as a loop
END
Mark the end of a program mode sequence with a HALT and return to
immediate mode
FLAG Write a value to a diagnostic flag register (to trace program execution)
HALT Halt Trigger Master operation
LOOP Mark the end of a program loop
TRIG Generate triggers
WALT Cause a program to execute a time delay
X Begin program execution
The program STCRUNCOBJ, described in Chapter 6, builds terminate-and-stay-resident
programs (TsRs) for programs written in C. These programs are driven by interrupts
generated by
the
Trigger Master; the programs can run in the background in a DOS
environment while you run other programs from DOS.
Chapter 3 describes the PLAYDOSEXE and PLAYWIN.EXE programs which allow you
to become familiar with the commands and requests, test your hardware without doing
any programming, and generate Trigger Master programs for future execution.
PLAYDOSEXE
runs in the DOS environment, while
PLAYWINEXE executes from
Windows. Refer to Appendix B for a quick start on the commands and Chapter 3 for a
detailed description of the commands.
In addition to sending commands to Trigger Master you can also request information
from Trigger Master. Trigger Master supports the following requests:
ARM
CONT
FLAG
LOOP
Return information about the trigger detect circuitry
Return the current Trigger Master program position
Read the value from the diagnostic flag register
Return the execution status of a Trigger Master program loop
STATUS Return the value from the Trigger Master status register
TRIG
WAIT
Return information about the trigger output circuitry
Return the remaining delay time
Refer to Appendix C for a quick start on the requests and see Chapter 3 for a detailed
description of the requests. Chapter 4 provides programming examples of the
commands and requests in the supported languages.
INTRODUCTION l-3
1.2 DISTRIBUTION SOFIWARE
This manual refers to Trigger Master software as the Di.dribution Software. The
Distribution Software contains utility files and driver files. Chapter 3 discusses these
1.3 SPEClFlCATlONS
Channels:
Basic Functions:
Micro Sequencer:
Modes:
Looping:
Loop Repeat:
Trigger Repeat:
Sequencer RAM:
Time Base Drift:
Trigger Input Pulse Width:
Trigger Output Pulse Width:
Detection Latency:
Async Trigger Latency:
Programmable Delay:
Trigger Connector:
Modes:
Power Consumption:
6 Input/Output
Trigger Detection
Trigger Generation
Delay Generation
PC Interrupts
Program, Immediate, or Run
2 Levels
1 - 4096
l-4096
1024 bytes
100 ppm max
4OOnsmin
5us
900 ns max
2.2 us max (trigger in to trigger out)
Range Resolution
1 us to 65.536 ms
10 us to 655.36 ms
100 us to 6.5546 set
1 ms to 65.536 set
1 us
1ous
100 us
1 ms
&pin microDIN
Sync, semi-sync (Trigger-Link), async
KPC-TM:
KPC488.2T2TM:
450 mA @5V max
1650 mA @5V max
Environmental:
Operating Temperature:
Storage Temperature:
Humidity:
oto+70c
-25 to +85 C
0 to 95%, non-condensing
Dimensions:
KPC-TM:
KPC488.2TM:
4.25 in H x 5.0 in. W (half-slot)
4.25 in. H x 13.25 in. W (ii.ilI slot)
Software:
Call Driver Languages:
Trigger Master DLL:
1 - 4 Trlgger Master INTERFACES USER GUIDE
BASICTM, QuickBASIC, C, Turbol’ascalsr’,
VisualBASIC for DOS.
Operation with Windows 3.x languages. Includes
VisualBASIC, Borland C++, C for Windows, and
TurboPascal.
1.4
Trigger-Link
Trigger Master supports Trigger-Liim,
accuracy, and throughput to test and instrumentation systems. This section introduces
the features of Trigger-Link
You can easily change the trigger paths between instruments using Trigger-Link with
GPIB commands. The precise trigger signals on Trigger-Link enhance the accuracy and
throughput of the system. Even systems which contain lnsbuments without Trlgger-
Link can benefit by using the 8502 Trigger-Link Adapter. The 8502 Trigger-Link Adapter
is the interface to Trigger-Link for conventional BNC trigger connections. Figure l-2
illustrates various Trigger-Link configurations.
Mechanically, Trigger-Link consists of a cable with six signal paths and two grounds
which can be permanently daisy-chained between a group of instruments. The signal
paths convey trigger signals between instruments. With GPIB commands, instruments
can be configured to use one or more of the signal paths in a variety of modes. Thus the
trigger configuration of a group of instruments can be easily altered by software to suit
the requirements of a particular test.
ElectricalIy, Trigger-Link provides paths for trigger pulses between instruments, thus
eliminating the late&es involved with coordinating trigger functions with the GPIB
interface. This greatly increases system throughput and measurement preciseness for all
instrument systems. Instruments, which completely embrace the Trigger-Link standard,
employ a fast-track link between the trigger input and function execution and between
function conclusion and acknowledge output. Today, many instruments service the
trigger/acknowledge connectors periodically using a microprocessor that performs
other functions. However, this procedure results in unknown and variable timing
latencles as well as slower response.
which brings a new dimension of flexibility,
Trigger-Link supports three trigger modes:
SYNC MODE A source sends a trigger pulse or sequence of pulses to synchronize
the activities of one or more receivers. There is no acknowledgement
from the receiver(s) that they have received a pulse and are
responding properly to the trigger(s).
ASYNC MODE
The conventional two-wire handshake protocol where triggers are
sent on one line and the receiver acknowledges on a second line.
Conceivably, multiple instruments could share a common trigger
source, but each instrument would require a separate
acknowledgement line.
SEMI-SYNC
An innovative extension of the async mode which allows a single
trigger source and multiple receivers to carry out a handshake on a
single line. The trigger source will pulse the trigger line to an active
state for about 5 us. Upon receipt of the bigger all receivers wlIl hold
the trigger line in the active state before the trigger source goes
inactive. Each individual receiver will continue to hold the line active
until that receiver is ready to acknowledge it has completed its task.
When the line goes inactive the trigger source will know that all
receivers have completed their tasks.
INTRODUCTION ‘I - 5
Figure l-2
I- 6 Trigger Master INTERFACES USER GUIDE
Trigger-Link Configuration Examples
Chapter 2
INSTALLING Trigger Master
2.1
INTFlODUCTlON
The installation of Trigger Master includes the following:
. inspecting the KPC-TM and KPC488.2TM boards.
. setting jumpers and switches on
. inserting the two boards into your PC.
attaching all cables to the boards.
.
. running the PLAYDOS.EXE and PLAYWINEXE programs to exercise and verify
proper operation of the boards.
2.2 INSPECTING THE BOARDS
Remove each board from their protective packaging by grasping the metal rear panel
and removing the board from the anti-static bubble package.
Note: You
should handle the boards only by their edges. A static electric
discharge can damage
the
KPC-TM and KPC488.2TM boards.
the
integrated circuits on the boards.
INSTALLING Trigger Master 2 - 1
2.3 SETTING UP THE KPC-TM BOARD
The KPC-TM board is a stand-alone system trigger controller which requires four byte-
wide I/O addresses. The board contains a switch to set up the base address in
increments of four bytes. This switch decodes address lines A9 to A2. The KPC-TM
board ships with a default setting of 3lO(hexadecimal) as
position OFF corresponds to a logical 1 and the position ON to a logical 0. Table 2-1 lists
the base addresses with the appropriate switch settings for each address.
shown in
Figure 2-l. The
Figure 2-l
You can configure
changing the jumper
KPC-TM Card Jumper and Switch Locations.
the
KPC-TM board to generate interrupts
on
jumper block J2. Trigger Master ships with the interrupts
on levels 2
through 7 by
disabled as shown in Figure 2-1.
Note: The KPC-TM Base Address switch settings are position values only. Refer to
Table 2-1 for the corresponding Address Line values.
Address
Decimal Hexadecimal
512
256
128
64
32
16
a a
4
200
100
80
40
20
10
4
&&e
9
a
7
6 4
5
4 6
3
2
Switch
m
1
2
3
5
7
a
Table 2-l
2 - 2 Trigger Master INTERFACES USER GUIDE
Base Address Switch Setdngs
2.4
SElllNG UP THE KPC488.2Thl BOARD
The KPC488.2TM board implements the trigger master control function and GPIB
control function on the same board. Both the trigger master and GPIEi functions can
generate interrupts. This manual describes the settings for the interrupt Jumpers and the
switch and jumper settings for the GPIB function. Refer to the accompanying user
manual, IEEE 488 Interface Boards, for further information. Figure 2-2 shows the locations
of the jumpers and switches on the KPC488.2Th4 card.
2-2 KPC-488.2TIM Card Jumper and Switch Locations
To prevent the same level from being used by both functions, use the interrupt three-
row jumper blocks to select the interrupt.
Use Jumper blocks J5 and J3, shown in Figures
3-2 and 3-3, to set the interrupts levels for the
GPIB and Trigger Master. The top and middle
rows of the jumper blocks set the GPIB
interrupt level, and the bottom and middle
rows set the Trigger Master level.
. Placing a lumper vertically on the upper
and middle rows enables an interrupt level
for the GPIB. Placing a jumper vertically
the middle and bottom rows enables an
interrupt level for Trigger Master.
. Placing the GPIB jumper horizontally on
the upper row disables the GPIB interrupt and placing the trigger master jumper
horizontally on the bottom row disables the bigger master interrupt.
Figure 2-3 illustrates enabling interrupt level 12 for the GPIB and enabling interrupt
level 15 for Trigger Master (note that level 13 is unavailable on the PC/AT bus).
on
F
3gurfs
r
%ampfe
29 Jumper Blocks J5 and J
INSTALLING Trigger Master
2 - 3
Trigger Master requires four byte-wide addresses; use switch SW3 to set the base
address in increments of 4. The switch decodes address lines A9 through A2. The
position OFF corresponds to a logical 1 and the position ON to a logical 0. The boards
ship with a default setting of 3lO(hexadecimal) as shown in Figure 2-2.
2.5 INSTALLING Trigger Master
Follow this procedure to install Trigger Master into your PC.
1. Turn the PC power switch to OFF. Unplug the power cord and disconnect all cables
from the rear of the system unit.
2. Remove the cover mounting screws from the rear of the system unit.
3. Slide the system unit cover forward. When the cover can go no further, tilt it up and
remove it from the base.
Note:
Install the KPC488.2TM board into a 16-bit slot; the KPC-TM board can
use an S-bit slot.
4. Remove the rear panel cover screw from one of the computers add-on slots.
5.
Press the board firmly into the main board expansion slot.
6. Seat Trigger Master cable in the Micro-DIN connector and align the board before
tightening the rear panel mounting screw.
7. Secure the board with the rear panel mounting screw.
8. Align the rear cover, sliding it back into place. Reinstall the mounting screws.
9.
Turn on the PC.
10. Make a backup of all application diskettes before copying the applications to your
PC’s hard disk.
11. Run the PLAYDOSEXE and PLAYWIN.EXE programs to exercise the boards.
Since the Trigger Master cable should seat completely in the MICRO DIN connector, you
may want to insert the cable and test the alignment of the card before tightening the
screw holding the bracket.
2.6 RUNNING PLAYDOSEXE or PLAYYVINEXE
Check the hardware and exercise Trigger Master after installation by running either the
PLAYDOSEXE or PLAYWIN.EXE program. PLAYDOSEXE runs from the DOS
environment and PLAYWIN.EXE executes in the Windows environment.
PLAYDOSEXE and PLAYWIN.EXE provide a menu interface to the standard Trigger
Master driver calls without requiring the use of a programming language. You can also
use these programs to create and document Trigger Master programs.
2
- 4 Trigger Master INTERFACES USER GUIDE
The driver supports the following calls, which are described in detail in Chapter 3:
STCCMD Sends Trigger Master commands to the active Trigger Master
either for immediate execution or storage in Trigger Master
program memory.
STCDUMP Saves the contents of the active Trigger Master program memory
to a binary file.
STCINIT Checks for the presence of a Trigger Master. If Trigger Master is
found, it is initialized and made active. The driver can
simultaneously control up to four boards in the same computer.
STCLOAD Loads the contents of a binary file into Trigger Master program
memory.
STCSET
Selects a different Trigger Master to become active (this Trigger
Master must have been initialized).
STCSTAT Requests status information from the active Trigger Master.
The PLAYDOSEXE and PLAYWIN.EXE programs operate by listing these calls in a
main menu. When you select a call from the main menu, a form appropriate to that call
appears. Windows or buttons are provided, where necessary, for entering data or
making selections specific to that call. After l3ling in any blanks on the form, press the
button for the call to start execution. Any error messages retumed
from
the driver are
displayed.
Each form contains a “Help” button that provides assistance on that form. Context-
sensitive help is also available. To enable context-sensitive help, you must first include
the files PLAYWIN.HLP or PLAYDOSHLP in the same directory as the executible files
PLAYWIN.EXE or PLAYDOSEXE. Access help by pressing cFl> in PLAYWIN.EXE or
Shift+<Flz from PLAYDOSEXE.
If you select the STCCMD co mmand
from the main menu, a new menu appears listing
all the possible commands you may include with STCCMD. When you select a
command, another form appears that is specific to the that command. When you push
the STCCMD button, a window displays the comman
d string sent to the driver. The
“Man” selection is an option that allows you to manually.enter your own command
string (the string can contain multiple commands). If an error occurs during execution of
the STCCMD command, the driver displays an error message and places the value “**”
into your command string at the point the driver detected the error.
The “Man” form has a button that enables the “Paste” option. With this option
commands sent without errors from other command forms will also appear in
on,
the
“Man”
form command window. This procedure allows you to document a Trigger Master
program as you create it. You can save the contents Trigger Master memory with the
STCDUMP command. Since the STCDUMP co
mmand creates a non-readable
binary file,
you can use the “paste” provision to save the contents of the command window to obtain
a file of the command sequence used to generate the program.
When you execute the STCSTAT command, the command normally returns the status
only once. When you make a status request from PLAYWIN.EXE or PLAYDOSEXE, a
form is created which continually reads and displays the status. This procedure allows
you to follow the status changes as Trigger Master executes a program or command.
INSTALLING Trigger Master 2 - 5
You can also watch the CONT STATUS request during program creation to determine
where the next program instruction will be loaded in memory.
The PLAYDOSEXE and PLAYWIN.EXE programs provide two methods of choosing a
different call or command and exiting a form:
Choose a new form without closing the current form. When you bring the current
.
form back up, the data you previously entered is still in the form. This procedure
simplifies the manual entry of commands, since you can recall the previous ten
commands by using the arrow keys at the side of the
entry
window. You can also
size and position forms to suit your needs.
. Click on the upper-lefthand button and choose the close option from the menu
displayed. When you next bring up the form, the data is reinitialized. To exit the
program, close the main menu (this automatically closes all forms).
2 - 6 Trlgger Master INTERFACES~USER GUIDE
Chapter 3
USING THE Trigger Master DRIVER
3.1
INTRODUCTION
The Trigger Master driver supports the following languages: BASICA, Microsofto’
QuickBASIC, VisualBASIC (for DOS and Windows), Microsof@ C, C++, and C for
Windows, and Borlando’ TurboPascal and TurboPascal for Windows.
. For Windows applications, a Trigger Master DLL is placed in your Windows
directory.
. For DOS environment applications in QuickBASIC, VisualBASIC, C, and
TurboPascal, a Trigger Master file is linked with the application program.
.
For BASICA, a Trigger Master binary file is loaded with the program.
For maximum efficiency with all languages, the application program makes a direct call
to the appropriate driver code using the following calls-z
STCINIT
STCSET
STCCMD Sends co mmands to Trigger Master.
Checks for and initializes a Trigger Master at a specified board
address and then sets the driver to control that board. The driver
can simultaneously control up to four boards.
Switches Trigger Master control to a different board. The board
must have been initialized.
STCSTAT
STCLOAD Loads a binary flle into Trigger Master program memory.
STCDUMP Saves Trigger Master program memory to a binary file.
Requests status from Trigger Master.
3.2 USING THE DRIVER
The following sections describe “instalhng” the driver in each of the supported
languages.
Using the Driver with SASICA
Run the following code segment to load the driver In BASICA:
260 CLBhR , 52-1024
270 DBP sxo = 0
’ leave a045 for interface.
USING THE Trigger Master DRIVER 3 - 1
Accessing the Driver from C
For Microsoft@’ C, compile your program and link the resulting object file with stcc.Zib
using a command such as the following:
You will need to include at least the function prototypes from stc.h in your program.
Note:
For C or C++ programs running under Windows, do
not link the
program to stcc.Zib. Instead, copy the file sfcIib.dll to your Windows
directory; the function prototypes in stcZib.dZl are identical to those in stc.h.
Accessing the Driver from QuickBASIC and VisualBASIC
QuickBASIC
Use one of the following methods when building an executable program from the DOS
prompt:
. If you use Version 4 or greater or Version 7 with near strings, link your program to
stcqb.lib.
. If you use Version 7 with far strings (compiled with /Fs), link your program to
stcqbzlib.
To run your program in the appropriate QuickBASIC environment, load the program
with one of the following files:
For Version 7, use the file stcqb7.qlb.
.
For Version 4.0 to version 7, use the file stcqb4.qlb.
.
In either case, you must include at least the function protocols from the file stcqb.bi in
your program.
3 - 2 Trigger Master INTERFACES USER GUIDE
VisualBASIC
Place VisualBASIC function declarations in the Global section.
. For DOS applications:
To run a program from the environment, use the command VBDOS
/LSTCVED.QLB to load
VisualBASIC
with the Quick Library STCVBD.QLB.
Include function prototypes for the Trigger Master calls by incorporating the
Trigger Master include files with the statement ‘INCLUDE stcvbd.bi. The file
STCVBD.BI also includes error code definitions and an array to hold error
message strings. If you do not need to display error messages, delete the array;
otherwise, use the code in STCVBDLBAS to initialize the srray. You can build an
executable file
from
the environment or from the co mmand line. To build the file
from the command line, first compile each form or BASIC module of your project
using the command line compiler. Then, from the command line, link the
resulting object modules with the Trigger Master VisualBASIC for DOS library
STCVBDJJB to produce the executable file. The following command line
example illustrates the production of the file EXVBDMAK:
Be axvBD.Pm
BC sxvsD.aAs
LIta sxvm BxvBDI,,,STcvBP.LIB;
. For Windows applications:
Copy the file STCUB.DLL to your Widows directory. You will need to include function
prototypes for the Trigger Master calls in your global data The file STCVBWJXT
includes function declarations appropriate for the Global section of a VisualBASIC for
Windows application. This file also defines error codes and an error array. If you wish to
use the error array, you must include code from STCVBHXT in the load procedure of
your first form. The diffarence between the STCVBWXXT file and the DOS program file
STCVBDJXT is in the function declarations which are appropriate to STCLJB.DU.
Accessing the Driver from TurboPascal
Access the driver from a TurboPascal program (version 6) by including the following
statements in your program.
Far TurboPascal for Windows, copy the file STCLIB.DLL to your Windows directory
and include the folIowing statement in your program.
The include files contain function prototypes for the calls and define error codes. If you
want to display error messages, include an array for error strings. The file STCTPIPAS
contains code that you can add to your program to initialize the error array.
USING THE Trigger Master DRIVER 3 - 3
3.3 STClNll
STCINIT checks for the presence of a board by writing to Trigger Master program
memory. STCINIT initially writes the value 0 and then increments this value through
255fdecimal). As the memory register is written, Trigger Master automatically
increments the on-board memory location so successive memory locations are loaded
with increasing values until reaching 255. At this point, STCINIT resets to 0 and repeats
the process until it writes to ail 1024 memory locations.
STCINIT then reads back the values. The process of reading the values automatically
increments the memory location.
cleared and STCINIT returns with no error.
If
the read
value
matches the write
value,
memory
is
If the board is present, it becomes “active” so that all subsequent cornman
ds or requests
to the driver will be sent to that board. Up to four boards can be initialized; as each
board is initialized, it becomes the “active” board. To reactivate an initialized board, use
the STCSET caIl.
Note:
Every time you run a program, you must initialize Trigger Master by
calling STCINIT before making any other calls. During initialization, only
Trigger Master program memory is deared; other registers may retain
values
from previous program execution.
STCINIT requires three arguments as follows:
STC~I'E~il9b,al%,i2%)
The variables definitions and ranges are as follows:
(refer to Appendix A for Trigger Master error messages.)
o-3
0-7FC
0 = suooessful
non0 = unsuccessful
Calling STCINIT from BASICA
Use the following BASICA code
segment
30fhex):
630 PRnm "mitialize board "2 m!mmm; *I It. address "i
610 PRINT Rsxs mmADDR%) t I' her"
650 ORLL STCIWITmsmmd%, RzamDDR%, -1
660 LF RMNON% THPN GOT0 2130
Note:
You must define ail arguments for the STCINIT call (BRDNUM%,
BRDADDR%, ERRNUM%) before making the call
3 - 4 Trigger Master INTERFACES USER GUIDE
to initialize a Trigger Master at address
Calling STClNlT from C
Use the following code segment to initialize Trigger Master in C:
In C you can send values to the driver by placing them directly in the call. For example,
you could use the following code:
stchit(0,
0x300, ierr);
Since the driver returns err, you must have a predeflned variable to receive its value.
Calling STUN/T from QuickBASE and VisualBASIC
Use the following code to call STCINIT from QuickBASIC and VisuaIBASE
DIN .rerr As INTBOBR
DIM B.rcLNum As INmaR
DIMbdAddr AsIwmeER
s-=0
brdMdr ii &a310
PaIm "Ildtialie.3 board "IBrdaumi" at address "i
PRX”‘,’ BgX$tbrdiuWrl; ” hex”
In QuickBASIC and VisualBASIC, you can send values to the driver by placing them
directly in the call. For example, you could use the following code:
CALL s+cinie(o. LH310, *err1
Since the driver rehms
rerr, you must have a predeflned variable to receive its value.
Calling STCINIT from TurboPascal and TurboPascal for Windows
The following code illustrates calling STCINIT from a TurboPascal or TurboPascal for
Windows program:
stcinir(1.$314,err~;
USING THE Trigger Master DRIVER 3 - 5
3.4
STCSET
Use STCSET in multiboard systems to switch the driver from one board to another. The
boards must have been previously initialized with the STCINIT command (described in
the
previous section). STCSET accepts two arguments as follows:
The argument il% is an integer in the range of 0 through 3 that identifies the
board.
The argument i2.% is an integer that receives an error code. A value of 0 indicates
no error (refer to Appendix A for a list of error messages).
3.6 Trigger Master INTERFACES USER GUIDE
Calling STCSET from QuickBASIC and VisualBASIC
The following code segment illustrates calling STCSET in QuickBasic and VisualBASIC.
BdM.UUEO
Calling STCSET from TurboPascal and TurboPascal for Windows
The following code illustrates calling STCSET from a TurboPascal or TurboPascal for
Windows program.
stcsetIl,*rr) i
3.5 STCCMD
STCCMD sends commands to a board. STCCh4D accepts three arguments as follows:
01 refers to a string that contains a command to be translated by the driver into
microcode. The translated microcode is then sent to Trigger Master either for execution
by the on-board state machine or for storage in the Trigger Master memory. The,driver
parses the command, checking for unknown commands, invalid syntax, or values out of
range.
ix% is an integer that receives an error code. The driver returns a value indicating the
sIatus of errors: a value of 0 indicates no errors; refer to Appendix A for a list of error
messages.
ia is an integer that receives the position of the last character the driver parsed. Since the
driver stops parsing the command line when it encounters an error, this value provides
assistance for ermr debugging.
Note: Trigger Master executes commands as they are parsed. IfTrigger Master
discovers an error in a multiple-command string, it executes the commands prior
to the error and then returns with an emlr code.
Refer to Appendix B for a quick introduction to the commands using examples. Run
PLAYDOS.EXB or PLAYWIN.EXB to experiment with the commands in a non-program
environment. See Appendix A for a description of the error messages.
USING THE Trigger Master DRIVER 3 - 7
Command Syntax
This section describes the syntax for the string argument (cl) in the STCCMD call. The
STCCMD call supports the following commands: ARM, BEGIN, CONT, DO, END,
FLAG, HALT, LOOP, TRIG, WAIT, and X.
General Information
The following rules apply to ail STCCMD commands:
. Spell out the commands in their entirety (abbreviations are not supported).
.
Complete each command with a semicolon (;l.
. Use any combination of uppercase and lowercase letters wlthin strings (the driver is
insensitive to the case of characters).
. Do not use embedded spaces wlthin a command. For example, the command “be
gin;’ is illegal.
Some examples of legal and illegal strings are as follows:
IIlerral Legal
beg;
Begin;
begin b&N;
In the example “beg”, the driver returns the position 3 and the error 3 which correspond
to the “Incomplete Command” error. As soon as the driver encounters an error it returns
You can group multiple commands together using blank spaces (spaces, tabs, carriage
returns, and line feeds) to improve readability. The following examples are equivalent:
bWfi.Wd;
begin ;
begin:
end;
6JUd;
The driver executes multiple commands contained in a single string when it encounters
a semicolon.
In
the previous example, the driver executes the “begin” command when
the driver parses the “;11 following “begin”. As a result, the driver executes commands
one at a time. When the driver encounters an error, the previous commands have
already been executed.
3 - 8 Trigger Master INTERFACES USER GUIDE
Line Numbers
The commands ARM and TRIG must be followed by one or more line numbers. The
line numbers indicate which of the six trigger lines are armed to look for trigger inputs
or will generate trigger outputs. When either command specifies multiple lines, the line
values must be separated by commas. The following examples illustrate legal and illegal
line values:
j&g@ gg&
trig 1, 5;
trig 1 5;
TRIG 6:
trig3,2,1;
Note: You may use the same number more than once in a command line. This
does not alter the operation and is not flagged as an error.
Extenslons
Certain commands accept extensions, which further define the command. You must
spell out the entire extension (abbreviations are not accepted) and each extension must
be preceded by a
colon.
The following example initiates Trigger Master program
execution with interrupts enabled:
For additional information on L, refer to the section “The Command Set”.
Commands can be followed by one or more integers. An integer cannot contain
embedded spaces, but the number may be separated from the command using one or
more spaces. The integers in the following example indicate the memory location where
program
storage
should start. The examples of legal and illegal command lines are:
&g& j&&
beginl23; begin 1 231
begin
133~
begin 123 ;
The driver checks the range of the number and returns an error if the value is out of
range.
USING THE Trigger Master DRIVER 3 - 9
Time Scales
Two commands require time arguments: WAIT and TRIG. The WAIT command
generates time delays in a program running from Trigger Master memory (for further
information on both commands, refer to the section “The Command Set”). The WAIT
command syntax is:
%.a is a floating-point number that specifies a magnitude of time.
t indicates a time scale using one of the following three values:
sorS seconds
m or M milliseconds
n or U microseconds
The magnitude of limes (a.=) that can be used with the WAIT command range from 1
microsecond through 65.535 seconds. You can write time values using any choice of milts. For
example, the minimum and maximum times may be entered as any of the following values:
Minimum
lu
.OOl
m
0.000001 s
Maximum
65535000~
65535 m
65.535 s
The magnitude of the time between any leading and trallmg zeros must fit in a 16-bit
counter; therefore, the range is between 1 and 65535. This limits the so-called resolution
of the time scale (how fine a time increment you may specify). This allows the use of up
to five digits for 1 to 65535, but only four digits for 6554 to 9999. For example, the values
0.06553400 s and 0.06553500 s are legal, but the value 0.06553600 s is illegal. The driver
allows an increase of 0.00000100 s from the value 0.06553400 s to 0.06553500 s. If we
attempt to increment the same amount to get to 0.06553600 s, the driver returns the error
“TIME OVER RESOLUTION”. This requires a rounding up to the next higher value in
the digit to the left; in this example, the next larger value of time that can bespecified is
0.06554000 s. This value represents an increment of 0.00000500; the next incremental
value would be 0.00001000 (to 0.06555000 s).
3 - 10 Trigger Master INTERFACES USER GUIDE
Loading...
+ 68 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.