ATEasy 2.0 Reference Manual

Transcription

ATEasy 2.0 Reference Manual
ATEasy  2.0
Reference Manual
GEOTEST, INC.
If You Need Help
If you need help at any time with the installation or use of ATEasy, please call
ATEasy Technical Support at:
(800) 886-1201 or (714) 263-2222.
Disclaimer
In no event shall Geotest or its representatives be liable for any consequential
damages whatsoever (including, without limitation, damages for loss of
business profits, business interruption, loss of business information, or other
loss) arising out of the use of or inability to use ATEasy, even if Geotest has
been advised of the possibility for such damages.
Copyright and Version
Copyright  1991-1995 Geotest, Inc. All rights reserved. No part of this
document can be reproduced, stored in a retrieval system, or transmitted, in
any form or by any means, electronic, mechanical, photocopying, recording, or
otherwise, without prior written consent of Geotest, Inc.
This manual was updated to ATEasy version 2.02.
Trademarks
ATEasy is a registered trademark of Geotest, Inc.
IBM, IBM-PC, IBM-AT; International Business Machines.
Microsoft Mouse, MS-DOS and Microsoft Windows; Microsoft Visual C++,
Microsoft Corp.
Borland C++, Borland Pascal; Borland International
PCII/PCIIA and GPIB-AT; National Instruments.
Fluke; John Fluke Mfg. Co., Inc.
Table Of Contents
INTRODUCTION
Language Elements
Statements
Expressions
Data Types
Variables
Constants
Literals
Internal Variables
Internal Constants
Automatic Subroutines
Functions
Drivers Information Functions
Dynamic Data ExchangeDDE Functions
File I/O Functions
GPIB Functions
Interrupt Functions
Log File / Information Functions
Math Functions
PC Ports / COM Functions
String Functions
VXI Functions
Miscellaneous Functions
REFERENCE SECTION
Abort (statement)
_AbortProgram (automatic subroutine)
Abs (function)
ACos (function)
ASin (function)
Assignment (statement)
ATan (function)
CalcChecksum (function)
Chr (function)
ClearLog (subroutine)
1
1
2
3
5
6
8
8
10
10
11
12
12
13
14
15
16
17
19
20
21
22
23
24
24
25
26
27
28
29
30
31
33
34
ComClose (function)
ComFlush (function)
Command (statement)
Comment (statement)
ComOpen (function)
ComReceive (function)
ComSend (function)
ComSetup (function)
Continue (statement)
Cos (function)
CosH (function)
DdeExecute (function)
DdeInitiate (function)
DdePoke (function)
DdeRequest (function)
DdeTerminate (function)
DdeTimeout (function)
Delay (subroutine)
DisableInterrupt (function)
Dupl (function)
EnableAbortPause (function)
EnableInterrupt (function)
_EndProgram (automatic subroutine)
_EndTask (automatic subroutine)
_EndTest (automatic subroutine)
ERR (constant)
_ErrorProgram (automatic subroutine)
Exit (statement)
Exitloop (statement)
ExitTask (statement)
ExitTest (statement)
Exp (function)
FAIL (constant)
FALSE (constant)
FileClose (function)
FileCreate (function)
35
36
37
39
40
41
43
45
47
48
49
50
51
52
53
54
55
56
57
58
59
60
62
64
65
67
68
70
71
72
73
74
75
76
77
78
FileEOF (function)
FileFind ( function )
FileOpen (function)
FilePrint (function)
FileRead (function)
FileRemove (function)
FileRename (function)
FileSeek (function)
FileTell (function)
FileWrite (function)
For..Next (statement)
Format ( function )
Function Call (statement)
GetDir (function)
GetDriverAddress (function)
GetDriverModule (function)
GetDriverName (function)
GetDriverType (function)
GetErrorMsg (function)
GetErrorNum (function)
GetLogString (function)
GetProfileName (function)
GetProfileNum (function)
GetProgramLastUpdate (function)
GetProgramName (function)
GetProgramSerialNum (function)
GetProgramTasks (function)
GetProgramUut (function)
GetProgramVersion (function)
GetTaskName (function)
GetTaskNum (function)
GetTaskTests (function)
GetTestMask (function)
GetTestMax (function)
GetTestMin (function)
GetTestName (function)
80
82
84
86
87
89
90
92
94
95
96
98
100
102
104
106
108
110
111
113
115
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
GetTestNum (function)
GetTestPin (function)
GetTestRef (function)
GetTestType (function)
GetTestUnit (function)
GetUserLevel (function)
GetUserName (function)
GetUutStatus (subroutine)
Goto (statement)
GpibClear (function)
GpibCommands (function)
GpibIFC (function)
GpibLLockout (function)
GpibLocal (function)
GpibPPoll (function)
GpibPPollC (function)
GpibPPollU (function)
GpibReceive (function)
GpibRemote (function)
GpibSend (function)
GpibSpl (function)
GpibStatus (function)
GpibTrig (function)
FormatLogString (function)
If..Then (statement)
Ignore (statement)
_InitProgram (automatic subroutine)
_InitTask (automatic subroutine)
_InitTest (automatic subroutine)
Int (function)
INT_xxx (constants)
InterruptMask (internal variable)
LCase (function)
Left (function)
Len (function)
Log (function)
133
134
135
136
138
139
140
141
143
144
146
148
149
151
153
155
157
159
161
163
165
167
169
171
176
178
179
181
182
183
184
186
188
189
190
191
Log10 (function)
Loop..Endloop (statement)
Mid (function)
NONE (constant)
PASS (constant)
Pause (statement)
PI (constant)
PortInByte (function)
PortInWord (function)
PortOutByte (subroutine)
PortOutWord (subroutine)
Pos (function)
Print (statement)
PrintLog (subroutine)
Randomize (subroutine)
Repeat..Until (statement)
_ResetDriver (automatic subroutine)
_ResetProgram (automatic subroutine)
_ResetSystem (automatic subroutine)
Retry (statement)
Return (statement)
Right (function)
Rnd (function)
Run (statement)
SaveLog (subroutine)
SDate (function)
SetLogOff (function)
SetLogOn (subroutine)
SetTestMask (subroutine)
SetTestMax (subroutine)
SetTestMin (subroutine)
SetTestRef (subroutine)
Sin (function)
SinH (function)
Spaces (function)
Sqrt (function)
192
193
194
195
196
197
198
199
200
201
202
203
204
206
207
208
209
210
212
213
215
216
217
218
219
220
221
222
224
225
226
227
228
229
230
231
STime (function)
Str (function)
Subroutine Call (statement)
Tan (function)
TanH (function)
Task (statement)
Test (statement)
TestRefResult (internal variable)
TestResult (internal variable)
TestStatus (internal variable)
Tick (function)
TRUE (constant)
UCase (function)
VAL (function)
VxiClear (function)
VxiCommand (function)
VxiGetDevInfoNum (function)
VxiGetDevInfoStr (function)
VxiIn (function)
VxiInRegister (function)
VxiMove (function)
VxiOut (function)
VxiOutRegister (function)
VxiReceive (function)
VxiSend (function)
VxiTrig (function)
While..Endwhile (statement)
WinExec (function)
INDEX
232
233
235
237
238
239
241
243
244
245
247
248
249
250
252
253
255
257
259
261
263
265
267
269
271
273
274
275
278
ATEasy® 2.0 Reference Manual
Introduction
The ATEasy Programmer's Reference Guide contains an alphabetical
reference to the following elements of ATEasy:
•
Language elements (statements, expressions, operators, etc.)
•
Functions and Subroutines
•
User Commands
Each of these elements of ATEasy is introduced briefly here. The
alphabetical listing of commands and functions starts on page 24.
Language Elements
ATEasy language elements consist of:
Statements
Expressions
Operators
Data Types
Variables
Constants
Literals
Internal Variables
Internal Constants
Automatic Subroutines
These language elements are described on the following pages.
1
2
ATEasy® 2.0 Reference Manual
Statements
ATEasy statements are the program elements that control how, and in
what order, data is manipulated. Most ATEasy statements are one-line
statements that must be ended with a new-line character. The If...,
While..., Repeat..., and Loop... statements are the only exceptions to this
rule.
ATEasy statements can be categorized as basic (assignments,
function/subroutine calls, and commands), flow control, and
miscellaneous statements.
The flow control statements are:
Abort
Continue
Exit
Exitloop
For..Next
Goto
If..Then
Ignore
Loop..Endloop
Pause
Repeat..Until
Retry
Return
Run
Task
Test
While..Endwhile
The miscellaneous statements are:
Comment
Print
For complete details on any of these statements, refer to the
alphabetical reference in this manual.
ATEasy® 2.0 Reference Manual
3
Expressions
Expressions are made up of operators and operands.
Operands are of the following types:
Literals
Variables
Function calls
Operators specify an evaluation to be performed on one (unary) or two
(binary) operands. Operators follow a strict precedence which defines
the evaluation order of expressions containing these operators.
ATEasy operators are shown below in order of precedence from highest
to lowest. Please refer to the ATEasy User's Guide for more information
on operators.
Operator
Name/Syntax
.
Scope resolution Owner
[]
Array element
-
Arithmetic negation (unary)
not
Bitwise complement not integer-exp
*
Multiplication
/
Float Division numeric exp
div
Integer Division
mod
Remainder
+
Addition
-
Subtraction
shl
Arithmetic left shift
shr
Arithmetic right shift (signed)
<
Less than
>
Greater than
<=
Less than or equal to
>=
Greater than or equal to
4
ATEasy® 2.0 Reference Manual
Operator
Name/Syntax
=
Equality
<>
Inequality
and
Bitwise AND
or
Bitwise inclusive OR
xor
Bitwise exclusive OR
=
Assignment
Expressions are calculated according to the following rules of
precedence:
1.
An operand between two operators of different precedence is
bound to the operator with higher precedence.
2.
An operand between two equal operators is bound to the one on
its left.
3.
Expressions within parentheses are evaluated prior to being treated
as a single operand.
Expressions can be of the following types:
1.
integer-expExpression with integer operands (Byte, Int, Long, or
String cell).
2.
numeric-expExpression with numeric operands (Byte, Int, Long,
Float, or String cell).
3.
string-expExpression with a one-dim string or one of the strings
in a two-dim string.
ATEasy® 2.0 Reference Manual
5
Data Types
ATEasy data elements can be either numeric or string.
Numeric Data Types
Numeric data types are always treated as signed numbers. They can be
declared as one- or two-dimensional arrays with maximum sizes of 32K
bytes. Numeric data types can also be declared as constant numbers
(Const). Constant arrays are not allowed.
Numeric data types, ranges, and sizes are shown below:
Type
Range
Size (bytes)
Byte
-128 - +127
1
Int
-32768 - +32767
2
Long
-2,147,483,648 - +2,147,483,647
4
Float
+/-1.7E+/-308
8
Strings
A String is a sequence of zero or more characters with a dynamic length,
and a constant maximum size.
Strings can be one- or two-dimensional (one is the default), and their
size must not exceed 32K bytes. When calculating the size of a string
array, add 2 bytes to the total number of bytes.
6
ATEasy® 2.0 Reference Manual
Variables
ATEasy supports the following variable types. (The maximum array
index number is shown for single dimension arrays.)
FloatA floating point variable (8 bytes long), allowable values are
between -1.7E+308 and -1.7E-308, and between 1.7E-308 and 1.7E+308.
Maximum array index = 4096.
LongA long integer (4 bytes long), allowable values are between
-2,147,483,648 and 2,147,483,647.
Maximum array index = 8192.
IntA short integer (2 bytes long), allowable values are between 32,768 and 32,767.
Maximum array index = 16384.
ByteOne byte (character), allowable values are between -128 and 127.
Maximum array index = 32768.
StringA string of characters. Strings are actually arrays of bytes
(single dimension) with a maximum size of 32K long.
The variable types Float, Long, Int, and Byte can also be declared as
arrays of one or two dimensions. Variables of type String must always
be declared as a one-dimensional array but can also be declared as a
two-dimensional array. Elements of such arrays, however, can only
contain a single character. Arrays can have a maximum size of 32K
bytes, regardless of the type.
Variables may also be declared as constants and have a fixed value.
Variable Owners
Each variable is defined as a part of a program segment. The segment
containing the variable is called the owner.
There are several possible owners for ATEasy variables:
Program—These variables are defined by you as a part of the test
program (Tests/Subroutines).
Driver—These variables are a part of the instrument driver which is
currently being edited. The instrument driver must be loaded into the
Driver Editor in order for these variables to be edited.
ATEasy® 2.0 Reference Manual
7
System—These variables are defined for system subroutines and are
part of ATEasy system file. The displayed list relates to the system file
currently loaded (e.g. ATEASY.CFG).
Internal—These variables are pre-defined, and are provided as a part of
the ATEasy structure.
Global Variables
Global variables are the most commonly specified ATEasy variables.
Global variables can be stored along with their owners (Program, Driver,
or System).
Local Variables
Local variables are those that are defined specifically for subroutines.
They are not visible to the caller. For example, an ATEasy program
cannot access any of it’s subroutine’s local variables.
Variables’ Hierarchy
ATEasy searches for variables using the following sequence:
From a Program Sub:
•
The Sub’s local variables (if the sysmbol is in a
subroutine)
•
Program global variables
•
System global variables
•
Configured Drivers global variables (by order of
appearance in the setup driver table)
From a System Sub:
•
The Sub’s local variables (if the sysmbol is in a
subroutine)
•
System global variables
•
Configured Drivers global variables (by order of
appearance)
8
ATEasy® 2.0 Reference Manual
From a Driver Sub:
•
The Sub’s local variables (if the sysmbol is in a
subroutine)
•
The Driver global variables (where the symbol is used)
Constants
Constants are Variables which have read-only access rights. Only
numeric constants can be defined, and they can't be defined as arrays.
Literals
Literals are constant values defined in the program.
ATEasy provides three types of literal:
1.
Integer
2.
Floating-point
3.
String
Integer Literals
Integer Literals can be any of the following:
A sequence of on or more decimal digits (0-9).
Example: 4356
0x combined with one or more hexadecimal digits (0-9, A-F, a-f).
Example: 0xFF331
A single ASCII character or Escape Sequence surrounded by single
quotation marks (').
Examples: 'a', '\n', '\x0A'
ATEasy always treats integer literals as 4 bytes signed numeric values.
The value must be within the range of Long Data Type.
ATEasy® 2.0 Reference Manual
9
Floating-Point Literals
Floating-point literals can be any of the following:
Fixed Point : A sequence of one or more decimal digits (0-9), a dot, and a
sequence of one or more decimal digits.
Example: 123.45
Fixed Point , [E|e], [+|-] and a sequence of 1 to 3 decimal digits.
Example: 123.45E+6
The value must be within the range of Float Data Type.
String Literals
String literals can be a sequence of zero or more ASCII characters or
escape sequences surrounded by double quotation mark (").
Examples: "First line\nSecond Line\n", "\x00ASurounded by line
feeds\x00A"
The maximum length of string literals is 255 characters.
An escape sequence represents a single character (one byte), and can
be any of the following:
Escape Sequence
Character Name
Value
\n
Newline (Linefeed)
10 or 0xa
\r
Carriage return
13 or 0xd
\\
Backslash
92 or 0x5c
\"
Double quotation mark
34 or 0x22
\'
Single quotation mark
39 or 0x27
\xhhh
Hexadecimal number
0xhhh
Decimal number
ddd
character
c
\ddd
\c
10
ATEasy® 2.0 Reference Manual
Internal Variables
ATEasy internal variables are predefined. Their Owner is INTERNAL
and they are reserved words. These variables can be used in the same
way as any other user-defined variable, but they can't be deleted.
The following internal variables are defined:
TestStatus
TestResult
TestRefResult
InterruptMask
Internal Constants
ATEasy internal constants are predefined. Their Owner is INTERNAL
and they are reserved words.
The following constants are defined:
Name
Value
Used With
PI
3.14159265358979
Math functions
NONE
0
TestStatus
PASS
1
TestStatus
FAIL
2
TestStatus
ERR
3
TestStatus
FALSE
0
USER Driver
TRUE
1
USER Driver
HWND_ATEASY
variable
USER Driver
HWND_CONTROL
variable
USER Driver
INT_TIMERx
10-11
Interrupts
INT_COMx
12-20
Interrupts
INT_GPIBx
22-23
Interrupts
INT_USERx
24-31
Interrupts
ATEasy® 2.0 Reference Manual
11
Automatic Subroutines
Automatic subroutines control the behavior of ATEasy when certain
processing events occur. When defined by the user, these subroutines
intervene to control the test program flow, to change default Log output
format, to initialize instrument drivers, and to respond to errors. If the
automatic subroutine is not defined, ATEasy performs the normal
behavior for the event.
Automatic subroutines have predefined names. They cannot be
declared with parameters. The name of each automatic subroutine
describes the condition or event for which it is called. Automatic
subroutines may be declared as Program or System or as the currently
configured driver's subroutine. ATEasy searches for them in that order,
and only the first subroutine found is executed when the event occurs.
The only exception to this rule are the _ResetSystem that must be
defined in the system file and the _ResetDriver that can be defined in
every driver (ATEasy every _ResetDriver defined in each configured
driver).
The automatic subroutines are:
_AbortProgram
_EndProgram
_EndTask
_EndTest
_ErrorProgram
_InitProgram
_InitTask
_InitTest
_ResetProgram
_ResetDriver
_ResetSystem
Note: Automatic subroutines are not called by ATEasy when program
code is running in DoIt! or Loopit! modes.
12
ATEasy® 2.0 Reference Manual
Functions
ATEasy provides the following types of functions:
Drivers Information
Dynamic Data Exchange - DDE
File I/O
GPIB
Interrupts
Log File / Information
Math
PC Port/COM
String
VXI
Miscellaneous
Each of these is described on the following pages.
Drivers Information Functions
The Drivers Information functions allow ATEasy to retrieve information
about the currently configured Drivers.
The Drivers Information functions are:
GetDriverAddress
GetDriverType
GetDriverModule
GetDriverName
ATEasy® 2.0 Reference Manual
13
Dynamic Data ExchangeDDE Functions
Through its DDE functions, ATEasy exchanges data with other
Windows applications. In DDE terms, a conversation is the interaction
between a client and a server application. . Conversations are always
initiated by the client application. ATEasy is a client application, and its
DdeInitiate function initiates DDE conversations. The DDE Server
application must be running before any conversation is initiated. After
initiating a conversation, the client application can issue DDE
transactions. For ATEasy, DDE transactions involve sending a
command to the Server via DdeExecute, sending data to the Server via
DdePoke, or accepting data from the Server via DdeRequest. After the
DDE Transactions are completed, DdeTerminate is called to terminate
the conversation.
ATEasy's DDE functions are:
DdeExecute
DdeInitiate
DdePoke
DdeRequest
DdeTerminate
DdeTimeout
14
ATEasy® 2.0 Reference Manual
File I/O Functions
The file handling functions let ATEasy create, manipulate, open, read,
write and delete files. These functions may also be used in conjunction
with the File I/O Tables commands. (See the GetDriverAddress function
for more information on this.)
The following functions are defined:
FileClose
FileCreate
FileEOF
FileFind
FileOpen
FilePrint
FileRead
FileRemove
FileRename
FileSeek
FileTell
FileWrite
ATEasy® 2.0 Reference Manual
15
GPIB Functions
The GPIB functions let ATEasy control GPIB instruments directly with
low-level GPIB commands. GPIB instruments are usually controlled by
their Driver I/O Table commands, and the low-level functions are only
required in the event that the instrument does not conform to IEEE
standard 488.1 or 488.2, and cannot be controlled with regular I/O table
operations.
The following functions are defined:
GpibClear
GpibCommand
GpibIFC
GpibLLockout
GpibLocal
GpibPPoll
GpibPPollC
GpibPPollU
GpibReceive
GpibRemote
GpibSend
GpibSPL
GpibStatus
GpibTrig
16
ATEasy® 2.0 Reference Manual
Interrupt Functions
The Interrupt functions let ATEasy respond to events such as GPIB
SRQ or Timer events. The EnableInterrupt function installs an ATEasy
user-defined interrupt subroutine which is called when an interrupt
occurs. The DisableInterrupt function is used to stop responses to an
interrupt call. The variable InterruptMask is used to invoke an ATEasy
Interrupt, each bit in that variable representing an Interrupt. This
variable can be passed as an argument to a DLL so that ATEasy
interrupts will be invoked by the DLL at a later time. ATEasy currently
supports RS-232, GPIB, TIMER, and user-defined interrupts.
The following internal functions, variables, and constants are defined:
Functions:
DisableInterrupt
EnableInterrupt
Variables:
InterruptMask
Constants:
INT_COM1-9
INT_GPIB1-2
INT_TIMER1-2
INT_USER1-8
ATEasy® 2.0 Reference Manual
17
Log File / Information Functions
The interrupt functions let ATEasy customize Log output and retrieve
information about the currently running program, Task, and Test.
The following internal functions, variables, and constants are defined:
Functions:
ClearLog
GetTestName
FormatLogString
GetTestNum
GetDir
GetTestPin
GetErrorMsg
GetTestRef
GetErrorNum
GetTestType
GetLogString
GetTestUnit
GetProfileName
GetUserLevel
GetProfileNum
GetUserName
GetProgramLastUpdate
GetUutStatus
GetProgramName
PrintLog
GetProgramSerialNum
SaveLog
GetProgramTasks
SetLogOff
GetProgramUut
SetLogOn
GetProgramVersion
SetProfileNum
GetTaskName
SetTestMask
GetTaskNum
SetTestMax
GetTestMask
SetTestMin
GetTestMax
SetTestRef
GetTestMin
18
ATEasy® 2.0 Reference Manual
Variables:
TestStatus
TestResult
TestRefResult
Constants:
NONE
PASS
FAIL
ERR
ATEasy® 2.0 Reference Manual
Math Functions
The math functions allow you to perform common mathematical
calculations.
The following internal functions and constants are defined:
Functions:
Abs
ACos
ASin
ATan
Cos
CosH
Exp
Int
Log
Log10
Randomize
Rnd
Sin
SinH
Str
Sqrt
Tan
TanH
Val
Constants:
PI
19
20
ATEasy® 2.0 Reference Manual
PC Ports / COM Functions
The PC Ports functions allow you to perform I/O to a PC Port. The
ComSetup function allow you to change the COM port setup of the
currently configured RS232 Driver.
The following internal functions are defined:
ComClose
ComFlush
ComOpen
ComReceive
ComSend
ComSetup
PortInByte
PortInWord
PortOutByte
PortOutWord
ATEasy® 2.0 Reference Manual
String Functions
The String functions allow you to manipulate strings, and include
functions for conversion of strings to numeric values.
The following internal functions are defined:
Chr
Dupl
Format
LCase
Left
Len
Mid
Pos
Right
SDate
Spaces
STime
Str
UCase
Val
21
22
ATEasy® 2.0 Reference Manual
VXI Functions
The VXI functions let ATEasy control VXI instruments directly. VXI
instruments are usually controlled by their Driver I/O Table commands,
and the functions below are typically required only for controlling
register-based devices.
The following functions are defined:
VxiClear
VxiCommand
VxiGetDevInfoNum
VxiGetDevInfoStr
VxiIn
VxiInRegister
VxiMove
VxiOut
VxiOutRegister
VxiReceive
VxiSend
VxiTrig
ATEasy® 2.0 Reference Manual
Miscellaneous Functions
The miscellaneous functions are as follows.
CalcChecksum
Delay
EnableAbortPause
SDate
Stime
Tick
WinExec
For more information about these or any other functions, refer to the
alphabetical reference that begins on the next page.
23
24
ATEasy® 2.0 Reference Manual
Reference Section
Abort (statement)
Purpose
Stops program execution.
Syntax
Abort
Comments
This statement may be used to abort program execution when
hazardous conditions occur or when testing cannot be completed due
to a critical failure. The Abort statement does not cause the
_AbortProgram or any other automatic subroutine to be called prior to
program termination. You can, however, call this subroutine explicitly.
Example
If TestResult > 29 then
Abort
Endif
See Also
_AbortProgram
ATEasy® 2.0 Reference Manual
25
_AbortProgram (automatic subroutine)
Purpose
Provides a way to execute a user-defined subroutine when a user aborts
the program.
Syntax
_AbortProgram ( )
Parameters
None.
Returns
Nothing.
Comments
This user-defined subroutine is automatically executed by ATEasy
when the Abort option is selected by the user. This can happen when
the user selects Abort (or Reset, if a program is not running) from the
Run menu, from the Test-executive Control Bar, or by pressing the <F9>
key.
After the _AbortProgram returns, ATEasy aborts the program by
executing the Abort statement.
The _AbortProgram subroutine may be useful to clear the system
(reset instruments and shut-off power supplies) when program
execution is aborted.
See Also
Abort, Automatic Subroutines, EndProgram
ATEasy® 2.0 Reference Manual
26
Abs (function)
Purpose
Returns the absolute value of the expression x.
Syntax
f = Abs ( x )
Parameters
x
VAL Float
Function input
Float
Result
Returns
f
Comments
x must be a numeric expression (float/integer). Abs also operates on
Integer and as floating point variables.
Example
X = -5.1
f = Abs(fX)
! now x is -5.1 and f is 5.1
ATEasy® 2.0 Reference Manual
27
ACos (function)
Purpose
Returns the arccosine of x.
Syntax
f = ACos ( x )
Parameters
x
VAL Float
Input Value
Float
Result
Returns
f
Comments
This function returns the arccosine of x in radians in the range of 0 to
PI. To convert from radians to degrees, multiply by 180/PI. Legal values
for x are 0 or between -1 and 1.
Example
x = 0
f = ACos(x)*180/PI
! now f is 90.0... and x is 0
See Also
PI, Sin, Cos, Tan, ASin, ATan, SinH, CosH, TanH
ATEasy® 2.0 Reference Manual
28
ASin (function)
Purpose
Returns the arcsine of x.
Syntax
f = ASin ( x )
Parameters
x
VAL Float
Function input
Float
Result
Returns
f
Comments
This function returns the arcsine of x in radians in the range of 0 to PI.
To convert from radians to degrees, multiply by 180/PI. Legal values for
x are 0 or between -1 and +1.
Example
x = 0.5
f = ASin(x)
! now f is 0.5235987755 and x=0.5 and
See Also
PI, Sin, Cos, Tan, ACos, ATan, SinH, CosH, TanH
ATEasy® 2.0 Reference Manual
29
Assignment (statement)
Purpose
Assignment statements assign a value to a variable.
Syntax
numeric-lvalue=numeric-exp
string-lvalue=string-exp
Parameters
None.
Returns
Nothing.
Comments
The left operand (the variable) must be an l-value expression. An l-value
expression is a variable (not a constant variable) which can have a
string type or numeric (not array) type.
Example
i = 1
s = s+"ABCD"
as[i] = s
af[i, j] = fX*PI+1
See Also
Expressions
ATEasy® 2.0 Reference Manual
30
ATan (function)
Purpose
Returns the arctangent of x.
Syntax
f = ATan ( x )
Parameters
x
VAL Float
Function input
Float
Result
Returns
f
Comments
This function returns the arctangent of x in radians in the range -PI/2 to
+PI/2. To convert from radians to degrees, multiply by 180/PI.
Example
x = 3
f = ATan(x)
! now x is 3 and f is 1.2490457723
See Also
PI, Sin, Cos, Tan, ASin, ACos, SinH, CosH, TanH
ATEasy® 2.0 Reference Manual
31
CalcChecksum (function)
Purpose
The function returns the Checksum value of a string or a file.
Syntax
iStatus = CalcChecksum ( sStr, iType, lResult )
Parameters
sStr
VAL String [ ]
String or file name
iType
VAL Int
Checksum type
lResult
VAR Long
Return checksum value
Int
Status
Returns
iStatus
Nothing.
Comments
The Return value is 1 for success and 0 for an error while accessing the
file.
The iType can be 8, 16 or 32 for calculating 8, 16 or 32 bits addition of
the available bytes in the given string, setting the first bit of iType to '1'
(9, 17 or 33) indicates that sStr contains a file name.
The lResult is always 32 bit result (Long) of the sum of the Bytes, Ints
or Longs in the file.
The CalcChecksum function can be used to ensure validity of data in
communication transfers or files.
32
ATEasy® 2.0 Reference Manual
Example
if CalcChecksum(GetDir(1)+"\\ateasy.exe", 9, lCS)=0
Error("Unable to CalcChecksum on ATEASY.EXE.
Aborting...")
abort
elseif lCS<>CS_ATEASY
Error("Corrupted ATEASY.EXE. Aborting...")
endif See Also
ATEasy® 2.0 Reference Manual
33
Chr (function)
Purpose
The function returns a one byte length string whose ANSI code is the
argument.
Syntax
s = Chr ( bData )
Parameters
bData
VAL Byte
ANSI code
String [ ]
Result string
Returns
s
Example
s=chr(65)
s=chr('A')
See Also
Dupl
! s="A"
! s="A"
34
ATEasy® 2.0 Reference Manual
ClearLog (subroutine)
Purpose
Clears the ATEasy Log window.
Syntax
ClearLog ( )
Parameters
None.
Returns
Nothing.
Comments
The outcome of this subroutine is equivalent to using the Clear option
from the Log menu ( ATEasy main window). If SetLogOff is called
before ClearLog, the Log window becomes empty. Otherwise the
default Log output is displayed.
Example
ClearLog( )
See Also
SetLogOff, SetLogOn, SaveLog, PrintLog
ATEasy® 2.0 Reference Manual
35
ComClose (function)
Purpose
The function ocloses a previously opened COM port.
Syntax
iStatus = ComClose ( iPort )
Parameters
iPort
VAL Int
COM Port number (1-9 : COM1-COM9)
String [ ]
Status, -1 on failure, 0 on sucsess
Returns
iStatus
Comments
The iPort must be open or else the function returns -1.
Example
If ComClose(1) < 0
Abort
Endif
See Also
ComSetup, ComOpen
36
ATEasy® 2.0 Reference Manual
ComFlush (function)
Purpose
The CommFlush function flushes all characters from the transmiting or
receiving queue of the specified COM port.
Syntax
iStatus = ComFlush ( iPort , iFlags )
Parameters
iPort
VAL Int
COM Port number (1-9 : COM1-COM9)
iFlags
VAL Int
1 for Output buffer, 2 for Input buffer, 3
for both
Int
Status, -1 on failure, 0 on sucsess
Returns
iStatus
Comments
The iPort must be open or else the function returns -1.
Example
FlushComm(1, 3)
See Also
ComOpen, ComClose
ATEasy® 2.0 Reference Manual
37
Command (statement)
Purpose
Provides user-defined statements.
Syntax
One of the following:
AnalogKeyword Owner [ Word... ] [ ( Arguments ) ]
DigitalKeyword Owner [ Word... ] [ ( Arguments) ]
Owner InstrumentsKeyword [ Word... ] [ ( Arguments ) ]
Owner SpecialKeyword [ Word... ] [ ( [ Arguments ] ) ]
Comments
The command statement is defined in an Owner. This can be one of the
following:
System
The current system (.CFG)
Driver
Refers to the current driver (.INS); used with
commands that belong to the current driver in the
driver subroutine.
DriverName
The driver name defined in Setup Drivers dialog
(.INS).
When the command executes, an I/O Table or Subroutine is actually
executed. This is defined in the Owner Editor: Driver Editor or System
Editor.
The xxxKeyword can be any Word (sometimes referred to as Menu-Item
or Item) defined in the Owner under a pre-defined Item. The pre-defined
Item can be Analog, Digital, Instruments, or Special. Words can be a
pre-defined word, such as 'Set' or 'Measure' (under the Analog menu), or
a user-defined keyword, such as 'MessageBeep'.
The Word can be zero or more Words (Items) as defined in the Owner.
The Arguments are zero or more expressions separated with commas
passed to the subroutine or to the I/O Table (as defined).
38
ATEasy® 2.0 Reference Manual
Example
In the following statement, Set is an AnalogKeyword, DMM is the
DriverName, and Function and VDC are Words.
Set DMM Function VDC
In the following statement, MessageBox is a SpecialKeyword and
USER is the DriverName.
USER MessageBox ( "Hello", "World!!!", 0, iStatus)
See Also
Statements, Driver Editor, System Editor
ATEasy® 2.0 Reference Manual
39
Comment (statement)
Purpose
Allows explanatory remarks to be entered into programs.
Syntax
!
Comments
The text following a comment (until the end of the line) is ignored by the
ATEasy compiler during program execution.
Comments may be entered at the beginning of a line or at the end of a
statement.
Example
! This Test verifies the voltage output of the UUT
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Measure DMM VDC at_J1_1 ! Measure output
40
ATEasy® 2.0 Reference Manual
ComOpen (function)
Purpose
The function opens a COM port for I/O.
Syntax
iStatus = ComOpen ( iPort )
Parameters
iPort
VAL Int
COM Port number (1-9 : COM1-COM9)
Int
Status, < 0 if failure.
Returns
iStatus
Comments
The iPort must be close or else the function returns -1.
Windows 3.1 or less standard COMM driver does not support more
than four COM ports. However, the communications driver that ships
with Windows for Workgroups version 3.11 does support more than
four communications ports. Also, some of the third-party
communications drivers, do support up to nine communications ports.
Example
FlushComm(1, 3)
See Also
ComClose, ComSetup
ATEasy® 2.0 Reference Manual
41
ComReceive (function)
Purpose
The function read characters from the specified iPort COM port number.
Syntax
iStatus = ComReceive ( iPort , sEOS, iTimeoutmSec, iMode, sStr,
iByte)
Parameters
iPort
VAL Int
COM port number
sEOS
VAL String [ ]
End Of Sequence string
iTimeout
VAL Int
Timeout in milliseconds
iMode
VAL Int
Reserved - should be 0
iStopBits
VAL Int
Receive data buffer
iHandshake
VAL Int
Handshake type
Int
Number of bytes received
Returns
iStatus
Comments
The iPort must be open by calling ComOpen function or by configuring
a RS232 driver in the System.
The sEOS can be 0-2 bytes long and specifies the data bytes that signal
the end of data.
The function returns 0 if no characters received(timeout), a value of -1
indicate an error has occured.
42
ATEasy® 2.0 Reference Manual
Example
If ComReceive(2, "\r\n", 1000, sBuf, 100) <= 0
Abort
Endif
See Also
ComFlush, ComSend, ComSetup
ATEasy® 2.0 Reference Manual
43
ComSend (function)
Purpose
The function write characters to the specified iPort COM port number.
Syntax
iStatus = ComSend ( iPort , sEOS, iTimeoutmSec, iMode, sStr, iByte)
Parameters
iPort,
VAL Int
COM port number
sEOS
VAL String [ ]
End Of Sequence string
iTimeout
VAL Int
Timeout in milliseconds
iMode
VAL Int
Reserved - should be 0
iStopBits
VAL Int
Send data buffer
iHandshake
VAL Int
Handshake type
Int
Number of bytes sent
Returns
iStatus
Comments
The iPort must be open by calling ComOpen function or by configuring
a RS232 driver in the System.
The sEOS can be 0-2 bytes long and specifies the data bytes that signal
the end of data.
A value of -1 indicate an error has occurred.
44
ATEasy® 2.0 Reference Manual
Example
If ComSend(2, "\r\n", 1000, "AT", 4) <= 0
Abort
Endif
See Also
ComFlush, ComReceive, ComSetup
ATEasy® 2.0 Reference Manual
45
ComSetup (function)
Purpose
Sets the specified serial port characteristics.
Syntax
iStatus = ComSetup ( iPort , lBaudRate , iDataBits , iParity , iStopBits
, iHandshake )
Parameters
iPort,
VAL Int
1-9 = COM1-9, depends on the current
Windows COM driver
lBaudRate
VAL Long
Baud Rate Number: 110, 300, 600,
1200,2400, 4800, 9600, 19200, 38400, 56000
iDataBits
VAL Int
Number of data bits: 6-8
iParity
VAL Int
Parity type: 0-4 = none, odd, even, mark,
space
iStopBits
VAL Int
Number of stop bits: 0-2 = 1, 1.5, 2
iHandshake
VAL Int
Handshake type0-2 = none, hardware,
Xon / Xoff
Long
Status of setup operation. 0 = OK, -1 =
operation failed.
Returns
lStatus
Comments
The specified port must be open before this function is called. This
could occur when an RS-232 Driver configured with the specified iPort
address is in the Setup Drivers dialog.
46
ATEasy® 2.0 Reference Manual
Example
!Set COM2: to 9600 baud, 8 data bits, even parity, one
stop bits and hardware handshake
LStatus=ComSetup (2,9600,8,2,0,1)
See Also
Setup Drivers Dialog, RS-232 Interface Dialog, GetDriverAddress
ATEasy® 2.0 Reference Manual
47
Continue (statement)
Purpose
Passes control to the next iteration of the smallest enclosing For, Loop,
Repeat, or While statement in which it appears.
Syntax
Continue
Comments
Program statements between the Continue statement and the EndLoop,
Next, EndWhile, and Until are skipped.
Example
for i=0 to 3 do
print i,
if i > 1 then
continue
endif
print i,
next
! The output is: 0 0 1 1 2 3
See Also
ExitLoop, Loop..EndLoop, For..Next, While...EndWhile, Repeat...Until
ATEasy® 2.0 Reference Manual
48
Cos (function)
Purpose
Returns the cosine of x.
Syntax
f = Cos ( x )
Parameters
x
VAL Float
Function input
Float
Result
Returns
f
Comments
x should be expressed in radians. To convert from degrees to radians,
multiply by PI/180.
Example
x = 3
f = Cos(x)
! now x is 3 and f is -0.9899924966
See Also
PI, Sin, Tan, ASin, ACos, ATan, SinH, CosH, TanH
ATEasy® 2.0 Reference Manual
CosH (function)
Purpose
Returns the hyperbolic cosine of x.
Syntax
f = CosH ( x )
Parameters
x
VAL Float
Function input
Float
Result
Returns
f
Comments
x should be expressed in radians. To convert from degrees to radians,
multiply by PI/180.
Example
x = 3
f = CosH(x)
! now x is 3 and f is 10.0676619957
See Also
PI, Sin, Cos, Tan, ASin, ACos, ATan, SinH, TanH
49
50
ATEasy® 2.0 Reference Manual
DdeExecute (function)
Purpose
Sends a command to a DDE server application.
Syntax
lStatus = DdeExecute ( hConv, sCmd )
Parameters
hConv
VAL Long
Handle of the DDE conversation
sCmd
VAL String[]
Commands
Long
Status
Returns
lStatus
Comments
Returns TRUE for success and FALSE for failure. This function is used
to send a command or series of commands to the server. The hConv can
be retrieved by calling the DdeInitiate function. The Timeout for the
server response can also be set by calling the DdeTimeout function.
Example
s="[ACTIVATE(\"SHEET1\")]"
s=s+"[SELECT(\"R1C1:R5C2\")]"
If DdeExecute(hConv, s) = FALSE Then
Abort
Endif
! now the first 2 cells in the first 5 rows are
selected in Excel
See Also
DdePoke
ATEasy® 2.0 Reference Manual
51
DdeInitiate (function)
Purpose
Establishes a conversation with a DDE server application that supports
the specified service name and topic name.
Syntax
hConv = DdeInitiate ( sService, sTopic )
Parameters
sService
VAL String[]
Service name
sTopic
VAL String[]
Topic name
Long
Handle of the DDE conversation
Returns
hConv
Comments
Returns 0 if the conversation was not established. The server
application that supports the service and topic should already be
running. The WinExec function can be used to start an application.
Example
hConv=DdeInitiate("EXCEL", "SHEET1")
If hConv = 0 Then
Abort
Endif
See Also
DdeExecute, DdePoke, DdeRequest, DdeTimeout, DdeTerminate
52
ATEasy® 2.0 Reference Manual
DdePoke (function)
Purpose
Sends an unsolicited data item to a DDE server application.
Syntax
lStatus = DdePoke ( hConv, sItem, sData )
Parameters
hConv
VAL Long
Handle of the DDE conversation
sItem
VAL String[]
The item where the sData is sent
sData
VAL String[]
The data for sItem
Long
Status
Returns
lStatus
Comments
Returns TRUE for success and FALSE for failure. The data format
supported is text. The function waits until the server sends back
acknowledgement. The timeout can be specified by the DdeTimeout.
Example
If DdePoke(hConv, "R1C1", "Hello Excel") Then
Abort
Endif
! set the A1 cell in an excel worksheet to "hello
world"
See Also
DdeExecute, DdeRequest, DdeTimeout
ATEasy® 2.0 Reference Manual
DdeRequest (function)
Purpose
Requests a data item from a DDE server application.
Syntax
sData = DdeRequest ( hConv, sItem )
Parameters
hConv
VAL Long
Handle of the DDE conversation
sItem
VAL String[]
The requested item
String
The requested item data
Returns
sData
Comments
Returns the contents of the requested item (sItem). The data format
supported is text. The function waits until the server sends back the
data. The timeout can be specified by the DdeTimeout function.
Example
sData=DdeRequest(hConv, "R1C1")
If left(sData, 5) <> "Hello" Then
Abort
Endif
! cheks if the cell A1 in an excel worksheet starts
with "Hello"
See Also
DdeExecute, DdePoke, DdeTimeout
53
54
ATEasy® 2.0 Reference Manual
DdeTerminate (function)
Purpose
Terminates a conversation with a DDE server application.
Syntax
lStatus = DdeTerminate ( hConv )
Parameters
hConv
VAL Long
Handle of the DDE conversation
Long
Status
Returns
lStatus
Comments
Returns TRUE for success and FALSE for failure. The function
invalidates the DDE conversation handle hConv. Further conversations
to the same application can be started only after the DdeInitiate
function is reissued.
ATEasy automatically terminates all conversations upon exiting or if
Reset is selected from the Run menu.
The hConv parameter is a DDEML.DLL handle that is returned by the
DdeInitiate function.
Example
if DdeTerminate(hConv) = FALSE Then
Abort
Endif
See Also
DdeInitiate
ATEasy® 2.0 Reference Manual
55
DdeTimeout (function)
Purpose
Specifies a timeout in milliseconds to wait for a DDE Transaction to be
completed.
Syntax
lStatus = DdeTimeout ( lmSec )
Parameters
lmSec
VAL Long
Timeout value in milliseconds
Long
Previous timeout value
Returns
lPrvTimeout
Comments
The return value specifies the previous timeout value in milliseconds
upon success; if lmSec is 0 or negative, the function returns 0. The
function specifies the maximum time to wait for the DDE server
application to respond to a DDE Transaction. A DDE Transaction can
be invoked by calling DdeExecute, DdePoke, and DdeRequest
functions. The default timeout value is 1000ms.
Example
!set Dde timeout to 2.5 seconds
DdeTimeout (2500)
See Also
DdeInitiate, DdeExecute, DdePoke, DdeRequest
56
ATEasy® 2.0 Reference Manual
Delay (subroutine)
Purpose
Suspends program execution for a specified time.
Syntax
Delay ( imSec )
Parameters
imSec
VAL Int
Delay time in milliseconds
Returns
Nothing.
Comments
The Delay subroutine suspends program execution for a specified
number of milliseconds.
Example
Delay(100) ! delay 100 mSec
See Also
SDate, STime, Tick
ATEasy® 2.0 Reference Manual
57
DisableInterrupt (function)
Purpose
Un-installs a previously installed interrupt.
Syntax
iStatus = DisableInterrupt ( iInterruptNum )
Parameters
iInterruptNum
VAL Int
INT_xxx constant
Int
Return status. Returns 0 upon success
and < 0 if the iInterruptNum was not
installed.
Returns
iStatus
Comments
The INT_xxx constants should be used as iInterruptNum. After calling
this function, the previously installed interrupt subroutine will no longer
be called by ATEasy when the specified interrupt occurrs.
Example
DisableInterrupt(INT_USER7)
See Also
EnableInterrupt, INT_xxx constants
ATEasy® 2.0 Reference Manual
58
Dupl (function)
Purpose
Returns a string where the string s is duplicated n times.
Syntax
sRet = DUPL ( s, n )
Parameters
s
VAL String[]
Input string
n
VAL Int
Number of duplications
Returns
sRet
String
Result string
Comments
The parameter n gives the number of times the string s is duplicated.
Example
s = dupl("Abc", 4)
! now s is "AbcAbcAbcAbc"
See Also
Spaces
ATEasy® 2.0 Reference Manual
59
EnableAbortPause (function)
Purpose
Enables or disables the Abort or the Continue button in the ATEasy
Control Dialog.
Syntax
iStatus = EnableAbortPause ( iAbort, iPause )
Parameters
iAbort
VAL Int
Enable/disable the Abort button
iPause
VAL Int
Enable/disable the Pause button
Int
Status
Returns
iStatus
Comments
The iAbort and iPause can be TRUE (for enable) and FALSE (for
disable).
The function also grays the corresponding buttons in the ATEasy
Control Dialog. Use this function after debugging is complete, since
disabling both buttons precludes the user from stopping the program.
This function does not work in DOIT! and LOOPIT! modes.
Example
EnableAbortPause(FALSE, TRUE)
! now the user cannot use the pause
See Also
Abort, Pause
60
ATEasy® 2.0 Reference Manual
EnableInterrupt (function)
Purpose
Installs an interrupt service subroutine.
Syntax
iStatus = EnableInterrupt ( iInterruptNum, lParam, IntSub )
Parameters
iInterruptNum
VAL Int
INT_xxx constant
lParam
VAL Long
Parameter for interrupt type
IntSub
VAL Sub
Name of interrupt subroutine, not a
string!
Int
Status
Returns
iStatus
Returns < 0 if there was an error in lParam or the interrupt is already
enabled. Returns 0 it the status is OK. Returns 1 if software emulation is
done to check between commands to implement interrupts.
Some of the GPIB boards or Drivers (GPIBxxx.DLL) do not support, or
are not configured to support, interrupts.
Comments
The INT_xxx constants should be used as iInterruptNum (for
compatibility with future ATEasy versions). lParam is set depending on
the type of interrupt specified and should be 0 if not used. IntSub
should be a user-defined subroutine and should be declared with no
parameters.
During interrupt subroutine execution, interrupts are disabled until
control returns from the interrupt subroutine. When executing
Doit!/Loopit! code, interrupts are disabled.
Calling Enable/DisableInterrupt or masking interrupts inside an
interrupt subroutine will take place only on return. Re-enabling (Disable
and Enable) of the current interrupt number handler during Interrupt sub
ATEasy® 2.0 Reference Manual
61
is not allowed (only Disable is allowed). Re-enabling of other interrupt
numbers is allowed.
Interrupts are serviced (called) according to their priority number. The
current priorities are:
TIMER1 (highest)
COM port
GPIB board
USER8
ATEasy subroutines are not re-entered; if an interrupt occurrs inside a
subroutine, that interrupt subroutine must not call that subroutine
again.
Calling EnableInterrupt clears (zeros) the corresponding iInterruptNum
bit in the InterruptMask variable. You can invoke interrupts by using
the command:
InterruptMask=InterruptMask or (1 shl INT_USER1).
This command invokes the interrupt associated with INT_USER1 if
enabled.
Example
In the following example, the interrupt subroutine TimeInt is called
every second. This program segment terminates 10 seconds after the
start if the TimeInt sub contains the statement L=i+1. Otherwise, the
While/Endwhile loop is an endless loop.
i=0
EnableInterrupt (INT_TIMER1, 1000, TimeInt)
while i< 10
endwhile
print i
See Also
DisableInterrupt, InterruptMask
62
ATEasy® 2.0 Reference Manual
_EndProgram (automatic subroutine)
Purpose
Provides user-defined termination code for an ATEasy program.
Syntax
_EndProgram( )
Comments
This user-defined subroutine is called by ATEasy after execution of the
last task of an ATEasy program. The subroutine is not called when the
user aborts the program.
The _EndProgram subroutine may be useful for resetting the system
when testing is complete or to perform any other custom procedure
required by the application.
After the function is returned, ATEasy prints the status of the current
program to the Log window. The GetLogString and SetLogOff
functions can be used to change default Log output.
ATEasy® 2.0 Reference Manual
Example
The following example restarts the program after the last task in the
program has executed.
Sub _EndProgram ()
{
! This is the content of _EndProgram subroutine
Clear PS1
!clear system power supplies
Clear PS2
!print the final summar lines
Print GetLogString()
print "Running the Program again"
_InitProgram()
Task 1
}
See Also
_AbortProgram, Automatic Subroutines, Task, GetProgramTasks
63
64
ATEasy® 2.0 Reference Manual
_EndTask (automatic subroutine)
Purpose
Provides a user-defined termination code for a program task.
Syntax
_EndTask ( )
Comments
This user-defined subroutine is called by ATEasy after the last test of
each task is executed.
The function is not called if the Task is skipped (by invoking the Task
statement or selecting Skip Task from the Run menu).
See Also
_InitTask, Automatic Subroutines, GetProgramTasks, GetTaskNum,
SetProfileNum, Task, Test
ATEasy® 2.0 Reference Manual
65
_EndTest (automatic subroutine)
Purpose
Provides a user-defined termination code for a test.
Syntax
_EndTest ( )
Comments
This user-defined subroutine is called by ATEasy after each test
execution is complete.
After a test code is complete, ATEasy evaluates TestStatus, calls
_EndTest, and then outputs the test result to the Log window.
The _EndTest subroutine may be useful for customized Log output
formats. When this subroutine is used in conjunction with the
SetLogOff and the GetLogString functions, the user may create custom
Log output to meet the requirements of the application.
66
ATEasy® 2.0 Reference Manual
Example
The following example demonstrates how to use _EndTest to decide if a
new type of test is FAIL or PASS. If the program variable iTestType is
set to 4, then the test is the new type. If so, the subroutine compares the
sResult and sRef program variables.
Sub _EndTest()
{
! This is the content of _EndTest subroutine
if iTestType <>4 then
! if not a valid test
type
return
endif
iTestType=2
! if “other” test type
if sResult=sRef and TestStatus=NONE then
TestStatus=PASS
else
TestStatus=FAIL
endif
}
See Also
_InitTest, Automatic Subroutines, GetTaskNum, GetTaskTests,
GetTestNum, GetTestType, GetProgramTasks, SetProfileNum, Task,
Test, TestStatus
ATEasy® 2.0 Reference Manual
67
ERR (constant)
Purpose
Used with the TestStatus internal variable.
Value
3
Type
Int
Comments
The TestStatus variable contains the status of the current Test. The
status may be one of the following:
0 - NONE -
No status. This is the default value of TestsStatus
when a Test is initiated.
1 - PASS -
The current Test has passed.
2 - FAIL -
The current Test has failed.
3 - ERR -
An error occurred during the current Test.
The TestStatus variable may be useful for customizing the Log output
or for any other application-oriented requirement.
Example
If TestStatus = ERR then
Abort
Endif
See Also
TestStatus, GetUutStatus
68
ATEasy® 2.0 Reference Manual
_ErrorProgram (automatic subroutine)
Purpose
Provides user-defined error handling code for a program.
Syntax
_ErrorProgram( )
Parameters
None.
Returns
Nothing.
Comments
Called by ATEasy when a recoverable (non-fatal) run-time error is
encountered during program execution. If the subroutine is not defined
in the program, System, or currently configured Drivers, ATEasy
executes the default error handling.
The default error handling is a dialog box dialog that displays the error
number and description and prompts the user with four buttons: Abort,
Retry, Ignore, and Pause.
The _ErrorProgram subroutine may use the Retry statement to resume
program execution so the offending command is re-executed. If the
Ignore statement is used, the offending command is skipped and the
TestStatus is set to ERR.
If the _ErrorProgram is returned (by invoking the return or by reaching
the end of the subroutine) the default error handling is executed by
ATEasy and the Run-Time Error Dialog is displayed.
The GetErrorNum and GetErrorMsg functions may be used to get the
error number and message. The error's location may be obtained using
the GetTaskNum and GetTestNum functions.
ATEasy® 2.0 Reference Manual
69
If an error occurs from within the _ErrorProgram subroutine, it is not
called again. An error message is then displayed and the program is
terminated.
Example
The following example demonstrates how to chain _ErrorProgram for a
Driver that needs to export its own _ErrorProgram. Note that if the
program _ErrorProgram was not defined, ATEasy will automatically
call the Driver _ErrorProgram.
! This is the Program _ErrorProgram sub
Sub _ErrorProgram()
{
DMM._ErrorProgram() !Call the DMM’s error handler
Print GetErrorMsg()! If we are here handle the
error
Ignore
! continue running
}
! This is the DMM _ErrorProgram sub
Sub _ErrorProgram()
{
! Check if the DMM caused the error
s="'"+GetDriverName(0)+"'"
If Pos(s, GetErrorMsg()) = -1
Return
! default
Endif
! The DMM cause the error handle the error
Ignore
! retry / return
}
See Also
Automatic Subroutines, Ignore, Retry, GetErrorString, GetErrorNum,
TestStatus, GetTaskNum, GetTestNum
70
ATEasy® 2.0 Reference Manual
Exit (statement)
Purpose
Terminates the current program and exits ATEasy.
Syntax
Exitloop
Comments
If the current program, driver, or system was changed, ATEasy prompts
the user to save changes before exiting. The Exit statement does not
cause the _AbortProgram or any other automatic subroutine to be
called prior to program termination. However, you can call these
subroutines explicitly.
Example
_ResetProgram()
Exit
See Also
Run
ATEasy® 2.0 Reference Manual
Exitloop (statement)
Purpose
Terminates the smallest enclosing For, Loop, Repeat, or While
statement in which it appears.
Syntax
Exitloop
Example
i=0
Loop
! Program statements
if i > 5 then
exitloop
endif
print i,
i=i+1
Endloop
! this will print 0 1 2 3 4 5
See Also
For..Next, Loop..Endloop, Repeat..Until, While..Endwhile
71
72
ATEasy® 2.0 Reference Manual
ExitTask (statement)
Purpose
Exit the current Task.
Syntax
ExitTask
Comments
The statement is used to exit the current Task. After the statement is
invoked ATEasy will call the Automatic Subroutines _EndTest and then
_EndTask.
Run-time error is generated if no task is currently running. e.g. when
executing _InitProgram.
Do not use ExitTask from within _EndTask, or _EndTest this will cause
ATEasy to call _EndTest endlessly, use the Return or Test statements
instead.
Example
If iRunMode<>RUN_ALL_TESTS
ExitTask
! skip all tests in this task
Endif
See Also
Automatic Subroutines, Goto, Task, Test
ATEasy® 2.0 Reference Manual
ExitTest (statement)
Purpose
Exit the current Test.
Syntax
ExitTest
Comments
The statement is used to exit the current Test. After the statement is
invoked ATEasy will call the Automatic Subroutines _EndTest.
Run-time error is generated if no test is currently running. e.g. when
executing _InitProgram or _EndTask Automatic Subroutine.
Do not use ExitTest from within _EndTest, this will cause ATEasy to
call _EndTest endlessly, use the Return or Test statements instead.
Example
If TestStatus=ERR
ExitTest
Endif
! end this test
See Also
Automatic Subroutines, Goto, Task, Test
73
ATEasy® 2.0 Reference Manual
74
Exp (function)
Purpose
Returns the base of the natural logarithms (e) to the power of x.
Syntax
f = Exp ( x )
Parameters
x
VAL Float
Function input
Float
Result
Returns
f
Comments
x should be a numerical expression (float/integer).
Example
x = 2
f = exp(x)
! now x is 2 and f is 7.3890560989
See Also
Log, Log10
ATEasy® 2.0 Reference Manual
75
FAIL (constant)
Purpose
Used with the TestStatus internal variable.
Value
2
Type
Int
Comments
The TestStatus variable contains the status of the current Test. The
status may be one of the following:
0 - NONE -
No status. This is the default value of
TestsStatus when a Test is initiated.
1 - PASS -
The current Test has passed.
2 - FAIL -
The current Test has failed.
3 - ERR -
An error occurred during the current Test.
The TestStatus variable may be useful for customizing the Log output
or for any other application-oriented requirement.
Example
If TestStatus = FAIL then
Test GetTestNum()
Endif
See Also
GetUutStatus, TestStatus
! run the Test again
ATEasy® 2.0 Reference Manual
76
FALSE (constant)
Purpose
May be used as a false Boolean ( 0 ).
Value
0
Type
Int
Comments
FALSE is provided for convenience only. Its value ( 0 ) may be used as
well.
Example
If iStatus = FALSE then
! Program statements
Endif
See Also
TRUE
ATEasy® 2.0 Reference Manual
77
FileClose (function)
Purpose
Closes an open file.
Syntax
iStatus = FileClose (iHandle)
Parameters
iHandle
VAL Int
Handle to file
Int
Status
Returns
iStatus
Comments
The FileClose function closes an open file associated with iHandle.
Once this function is executed, the iHandle can no longer be used with
other file functions.
ATEasy automatically closes all open files upon exiting or when the
user selects Reset from the Run menu.
The iHandle parameter specified DOS file handle opened by ATEasy
function FileOpen or FileCreate.
The FileClose function returns -1 upon failure.
Example
If FileClose (hFile) = -1 Then
Print "Error During FileClose..."
Endif
See Also
FileOpen, FileCreate
78
ATEasy® 2.0 Reference Manual
FileCreate (function)
Purpose
Creates a new file or opens and truncates an existing file.
Syntax
iHandle = FileCreate ( sFilenName )
Parameters
sFileName
VAL String[]
String containing filename
Int
Handle to file, status
Returns
iHandle
Comments
If the file specified by sFileName does not exist, a new file is created. If
the file already exists, the function truncates the file to length 0,
destroying the previous contents.
The file is opened for read and write; after the file is opened the file
pointer is set to the beginning of the file.
If the function was successful, it returns the DOS file handle. Otherwise,
it returns -1. Common causes for errors are: the given path or filename
was not valid, the file is a read-only file, or there were too many open
files.
ATEasy® 2.0 Reference Manual
Example
iFile = FileCreate("c:\\ATEasy\\data.dat")
If iFile = -1 Then
Print "Unable to create file: data.dat"
Endif
See Also
FileOpen, FileClose, FileWrite, FileSeek, FileTell, GetDir, FileRemove,
FileRename
79
80
ATEasy® 2.0 Reference Manual
FileEOF (function)
Purpose
Determines whether End-Of-File for the file associated with iHandle has
been reached.
Syntax
iStatus = FileEOF ( iHandle )
Parameters
iHandle
VAL Int
Handle of file to detect
Int
TRUE/FALSE or error
Returns
iStatus
Comments
The iStatus may be one of the following:
0
EOF has not been reached.
1
EOF has been reached.
-1
An error encountered by the function or the iHandle
parameter is not valid.
ATEasy® 2.0 Reference Manual
81
Example
The following example reads into an array of strings (asMsg) the
content of the file. The file contains messages with a fixed length of 30
bytes each.
i=0
While FileEOF (1) <> -1
FileRead(iFile, asMsg[i], 30)
i=i+1
Endwhile
See Also
FileOpen, FileCreate, FileRead, FileSeek, FileTell
82
ATEasy® 2.0 Reference Manual
FileFind ( function )
Purpose
Finds a file whose name matches the sFileSpec.
Syntax
iAttr=FileFind(sFileSpec, sFileName)
Parameters
sFileSpec
VAL String[]
File specification
sFileName
VAR String[]
Found file name
Int
Found file attributes
Returns
iAttrib
Comments
The sFileSpec is a string expression that specifies a path or a filename.
The path and filename can include a drive specification and any valid
wild card characters (? and *).
The sFileName must be large enough to contain the found file name.
The function returns the first filename that matches sFileSpec.
Additional filenames that match the sFileSpec pattern can be retrieved
by calling FileFind again with sFileSpec as an empty string.
When no filenames match, FileFind returns a null string and iAttrib is 0.
Once FileFind has returned a null string, the sFileSpec argument must
be used again in subsequent calls or the function returns 0.
Not all sFileNames that match the given sFileName must be retrieved
before calling FileFind again with a new sFileSpec.
FileFind is not case sensitive. "C" is equivalent to "c."
ATEasy® 2.0 Reference Manual
83
The return value iAttrib specifies the attributes of the found file name.
The following list specifies the possible values if iAttrib is not 0:
0x00
File Not Found
0x01
Read Only
0x02
Hidden
0x04
System
0x08
Volume ID
0x10
Directory
0x20
Archive
0x80
Normal
The iAttrib can be a combination of these values.
Example
The following example displays all files with the "DLL" extension in the
C:\ATEASY\DLL sub directory:
iAttrib=FileFind("c:\\ateasy\\dll\\*.dll", sFileName)
while iAttrib
print sFileName
iAttrib=FileFind("", sFileName)
endwhile
See Also
GetDir, FileCreate, FilePrint, FileOpen, FileRemove
84
ATEasy® 2.0 Reference Manual
FileOpen (function)
Purpose
Opens the file specified by sFileName and prepares the file for
subsequent reading or writing.
Syntax
iHandle = FileOpen ( sFileName )
Parameters
sFileName
VAL String[]
Name of file to open
Returns
iHandle
Int
Handle of file
Comments
The file pointer is set to the beginning of the file.
If the function was successful it returns the DOS file handle. Otherwise,
it returns -1. Common causes for errors are: the file does not exist, the
given path or filename was not valid, the file is a read-only file, or too
many open files.
ATEasy® 2.0 Reference Manual
Example
The following example opens a file. If the file can't be opened (e.g., it
doesn't exist) FileCreate tries to create it.
sFileName="c:\\ATEasy\\data.dat"
hFile = FileOpen(sFileName)
If hFile = -1 Then
hFile = FileCreate(sFileName)
if hFile = -1 Then
print "Unable to create file: sFileName
Endif
Endif
See Also
FileClose, FileCreate, FileRead, FileWrite, FileSeek, GetDir
85
86
ATEasy® 2.0 Reference Manual
FilePrint (function)
Purpose
Prints a text file using the currently selected printer.
Syntax
iStatus = FilePrint ( sFileName )
Parameters
sFileName
VAL String[]
Name of file to print
Int
Handle of file
Returns
iStatus
Comments
If a printer was not selected from Print Setup, ATEasy uses the
Windows default printer (the default printer can be selected from
Windows Control Panel application).
Example
!Prints the file “x.log” from the ATEASY Log Directory
FilePrint(GetDir(3)+"\\x.Log")
See Also
PrintLog, SaveLog, GetDir
ATEasy® 2.0 Reference Manual
87
FileRead (function)
Purpose
Reads iBytes into s from the file associated with iHandle.
Syntax
iStatus = FileRead ( iHandle, s, iBytes)
Parameters
iHandle
VAL Int
Handle to an open file
s
VAR String[]
String data read from file
iBytes
VAL Int
Number of bytes to read
Returns
iStatus
Int
Number of bytes read
Comments
The iHandle specifies the DOS file handle obtained by the FileOpen or
FileCreate functions.
The return value contains the actual number of bytes read from the file.
If the function fails, the return value contains -1. If the file pointer is
already at the End-Of-File (EOF), the return value contains 0. If the
function encounters the EOF before reading the specified amount, the
return value is less than the number of bytes specified by the iBytes
parameter.
The function reads the data starting with the current position of the
file's pointer. This position may be read using the FileTell function and
may also be changed using the FileSeek function.
88
ATEasy® 2.0 Reference Manual
Example
The following example reads a file and prints its contents to the Log
window.
SetLogOff()
ClearLog()
hFile=FileOpen(GetDir(3)+"\\ATEasy.Log")
If hFile <> -1 Then
While FileRead(hFile, sBuf, 32000) > 0
print sBuf
Endwhile
FileClose(hFile)
Endif
See Also
FileOpen, FileCreate, FileWrite, FileSeek, FileTell, FileEOF, FileClose
ATEasy® 2.0 Reference Manual
FileRemove (function)
Purpose
Deletes a file specifies by sFileName.
Syntax
iStatus = FileRemove ( sFileName )
Parameters
sFileName
VAL String[]
Name of existing file to delete
Int
Status
Returns
iStatus
Comments
The function returns 0 if the function was successful, or -1 if the
function failed.
Example
If FileRemove (GetDir(3)+"\\ATEasy.Log") = -1
Print "Error During FileRemove..."
Else
Print "ATEASY.log successfully deleted"
Endif
See Also
FileRename, FileCreate, GetDir
89
90
ATEasy® 2.0 Reference Manual
FileRename (function)
Purpose
Renames or moves a file.
Syntax
iStatus = FileRename ( sFileName, sNewFileName )
Parameters
sFileName
VAL String[]
Name of existing file
sNewFileName
VAL String[]
New file name
Returns
iStatus
Int
Status
Comments
The FileRename function renames a file specified by sFilename to the
name given by the sNewFileName. The sFilename must be the path of
an existing file. The sNewFileName name must not be the name of an
existing file. If the sNewFileName contains a different path from
sFilename, the file is moved to a new directory.
This function returns 0 if the function was successful, or a nonzero
value if the function failed.
This function may be used to move files from one directory to another
or to rename them. However, files cannot be moved from one device to
another (e.g., from drive C: to drive A:).
ATEasy® 2.0 Reference Manual
Example
If FileRename(GetLogDir(3)+"\\x.Log", "y.Log") = -1
Print "Error During FileRename..."
Endif
See Also
FileRemove, FileCreate, FileFind, GetDir
91
92
ATEasy® 2.0 Reference Manual
FileSeek (function)
Purpose
Repositions the file pointer associated with iHandle to a new location
that is lOffsetfrom iOrigin.
Syntax
lNewPos = FileSeek ( iHandle, lOffset, iOrigin )
Parameters
iHandle
VAL Int
Handle to an open file
lOffset
VAL Long
Offset in bytes
iOrigin
VAL Int
Starting position in the file
Long
The file pointer new position
Returns
lNewPos
Comments
iOrigin can be one of the following:
0
Beginning of the file. Move the file pointer offset bytes from
the beginning of the file.
1
Current position of the file pointer. Move the file pointer
offset bytes from its current position in the file (may be
obtained by the FileTell function).
2
End of file. Move the file pointer offset bytes from the end of
the file.
The function returns the value in bytes of the new file pointer's position
from the beginning of the file. If the function fails, it returns -1.
ATEasy® 2.0 Reference Manual
93
When a file is initially opened (using the FileCreate or FileOpen
functions), the file pointer is positioned at the beginning of the file. The
FileRead and FileWrite may also change the file pointer position.
The FileSeek function permits random access to a file's contents by
moving the file pointer randomly without reading or writing data.
Example
The following example moves the file pointer to the end of the file and
prints the file size in bytes.
lFileSize=FileSeek(hFile, 0, 2)
If lFileSize >= 0 Then
Print "File Size is:"; lFileSize
Else
Print "Error During FileSeek..."
Endif
See Also
FileOpen, FileCreate, FileWrite, FileRead, FileTell, FileEOF
94
ATEasy® 2.0 Reference Manual
FileTell (function)
Purpose
Returns the current position of a file pointer associated with iHandle.
Syntax
lPos = FileTell ( iHandle)
Parameters
iHandle
VAL Int
Handle to an open file
Long
Position of the file pointer
Returns
lPos
Comments
The lPos is expressed as the number of bytes from the beginning of the
file. The function returns -1 if the function has failed.
Example
The following example calculates current record number according to
the iRecordSize and the current file pointer position.
lPos = FileTell(hFile)
If lPos < 0 Then
Print "Error During FileTell..."
Else
lRecordNum=lPos/iRecordSize
Endif
See Also
FileRead, FileSeek, FileEOF
ATEasy® 2.0 Reference Manual
95
FileWrite (function)
Purpose
Writes iBytes from the s string to a file associated with iHandle.
Syntax
iStatus = FileWrite ( iHandle, s, iBytes)
Parameters
iHandle
VAL Int
Handle to an open file
s
VAL Int
A buffer to write
iBytes
VAL Int
Number of bytes to write
Int
Number of bytes written
Returns
iStatus
Comments
The function writes the data starting with the current position of the file
pointer. The file pointer is increased by the number of bytes actually
written. The function returns the number of bytes actually written. It
returns -1 if the function fails.
Example
s = "1234.5 , 7890.123"
i = FileWrite (2, s, len(s))
If i <> len(s) Then
Print "Error During FileWrite..."
Endif
See Also
FileRead, FileSeek
96
ATEasy® 2.0 Reference Manual
For..Next (statement)
Purpose
Repeats a block of statements a specified number of times.
Syntax
For IndexVariable = StartValue { To | Downto } FinalValue [ Do ]
[ statements ]
Next
Comments
IndexVariable is a simple numeric variable (not array) it can be a Byte,
Int, Long or Float variables. StartValue and FinalValue are numeric
expressions.
The Do keyword is optional. To or Downto is required.
The IndexVariable starts at the StartValue and is incremented or
decremented by 1 for each loop until the IndexVariable is greater than
(or less than when using Downto) the FinalValue.
ATEasy® 2.0 Reference Manual
Example
For i=1 To 5 Do
Print i;
Next
! This will print 1 2 3 4 5
! i is now 6
For i=5 Downto 1
print i;
Next
! This will print 5 4 3 2 1
! i is now 0
For i=0 To -1
print i
Next
! This will not print
! i is 0
See Also
Continue, Exitloop, Loop...Endloop, Repeat..,Until, While...Endwhile,
Statements, Expressions
97
98
ATEasy® 2.0 Reference Manual
Format ( function )
Purpose
Converts a number to a string and formats it according to the sFormat
specification.
Syntax
s=Format(fX, sFormatSpec)
Parameters
fX
VAL Float[]
Number to convert
sFormatSpec
VAR String[]
Format specifications
String[]
Formatted number
Returns
s
Comments
The sFormatSpec includes two types: fixed point and floating point
format. The sFormatSpec syntax is:
##[#...][.#[#,,,]][E | E##[#...]]
where:
#
Specifies a place holder for decimal digit or a sign.
#...
Indicates that zero or more decimal place holders can be
repeated
.
Indicates a decimal point.
Other characters are ignored.
ATEasy® 2.0 Reference Manual
99
At least two place holders (#) are required before the decimal point and
after the optional E or e. The first place holder at the beginning of
sFormatSpec is used for minus sign ('-') for negative fX and space (' ')
for positive fX. The first place holder after E or e is used for a negative
exponent ('-') or positive exponent ('+'). If fewer than two place holders
are supplied to the function, two are used. If sFormatSpec does not
contain place holders, the function returns a converted number as the
Str function returns with iBase as 10.
The format specification sFormatSpec never causes an fX value to be
truncated if SFormatSpec does not contains enough place holders
before the decimal point (or after the E or e in the case of floating point
syntax) to contain the converted number. However, ATEasy rounds the
numeric-exp to fit the required decimal characters after the decimal point.
The Print Using statement can be used to output a number converted to
a string in the same format specifications as the Format function.
Example
s=Format(-34.56, "####.####")
s is now " -34.5600"
s=Format(-345678.56, "####.####")
s is now "-345678.5600"
s=Format(-34.56, "##.##e###")
s is "-3.46e+01"
See Also
Print, Str, Val
100
ATEasy® 2.0 Reference Manual
Function Call
(statement)
Purpose
Executes statements defined in the function and returns a value.
Syntax
[ Owner. ]FuncName ( [ Arguments] )
Parameters
Zero or more Arguments separated by commas.
Returns
Type
Type can be one of the following:
Byte
1 byte (8 bits) signed integer.
Int
2 bytes signed integer.
Long
4 bytes integer, signed integer.
Float
8 bytes, floating point.
String
One dimension string.
Comments
A function call can be used as a stand alone statement or as a value in
an expression.
ATEasy first evaluates the function arguments and then passes them to
the pre-defined function parameters. Control is then transferred to the
function, which begins to execute. Upon termination, if the function
originated as a value in an expression, it returns its value in the
expression.
ATEasy® 2.0 Reference Manual
101
The optional Owner followed by the scope resolution operator (dot) can
be one of the following:
System
The current system (.CFG)
DriverName The driver name defined in Setup Drivers dialog
(.INS).
If Owner is not specified, ATEasy searches the function in the
following order:
1. The Current owner where the statement is called.
2. The System owner if the current owner is Program.
3. Drivers defined in the same order as configured in the Setup
Drivers dialog.
4. Internal owner - the predefined subroutines in ATEasy.
Two types of functions exist in ATEasy: Internal functions (such as
Val) which are pre-defined by ATEasy, and DLL functions that are
defined in the Driver Editor DLL Subroutines dialog.
Example
In the following example, the Mid internal function arguments are first
evaluated. Then the Mid function is called. Finally, the Val is called and
passed to the Print statement.
Print Val(Mid(s, i, i+10), 10)
See Also
Subroutine Call, Statements, Expressions
102
ATEasy® 2.0 Reference Manual
GetDir (function)
Purpose
Retrieves the current working directory, ATEASY, PRG, LOG, INS, DLL
and DLG directories.
Syntax
sDir = GetDir ( iDir)
Parameters
iDir
VAL Int
The requested directory
String
The directory
Returns
sDir
Comments
The iDir can be one of the following:
0
Current working directory.
1
ATEasy directory.
2
3
4
5
6
7
Other
PRG (Program files) directory.
LOG (Log files) directory.
INS (Driver files) directory.
DLL (dll files) directory.
DLG (DlgEasy files) directory.
Directory of the last loaded program.
The function returns an empty string.
The function returns the full path of these directories. If you use this
function to create a file name, append the "\\" and the filename to the
returned string.
ATEasy® 2.0 Reference Manual
Example
sLogFileName=GetDir(3)+"\\"+"X.LOG"
Print sLogFileName
! if the Log directory is c:\ATEasy\Log this will
print
! C:\ATEASY\LOG\X.LOG
See Also
FileOpen, FileCreate, FilePrint, SaveLog
103
104
ATEasy® 2.0 Reference Manual
GetDriverAddress (function)
Purpose
Returns the address of the specified Driver's name, sDriverName.
Syntax
lAddress = GetDriverAddress ( sDriverName )
Parameters
sDriverName
VAL String[]
Configuration name of Driver
Returns
lAddress
Long
Address of Driver
Comments
The sDriverName is the name specified in the Setup Drivers Dialog.
When this function is called from within a Driver subroutine and
sDriverName is an empty string, the calling Driver is assumed.
For a GPIB Driver, the hexadecimal format of lAddress is as follows:
0xBBPPSS
Where:
BB =
The GPIB board used (1 or 2).
PP =
The primary address of a GPIB device, this value is
between 1 and 30.
SS =
The secondary address of a GPIB device, this value can
be between 1 and 31, and 0 if not used.
The lAddress may be used with low-level GPIB Functions.
ATEasy® 2.0 Reference Manual
105
For RS-232 Drivers, the lAddress is COMn (1-4) and may be used with
the ComSetup function.
For VXI Driver, the lAddress specifies the Logical Address (0-255) and
may be used with low-level VXI Functions.
If the Driver is an Other-based Driver that uses a file and the file is open,
then the lAddress is the file handle associated with that file. This file
handle may be used with File I/O Functions. Otherwise, the lAddress is 1.
The function returns -1 if sDriverName cannot be found.
Example
The following example retrieves the address of "DMM", a GPIB Driver,
and uses this address to clear the device.
The DMM Driver is configured as a GPIB board 2, Primary address of
12, and a secondary address of 4.
lDmmAddress=GetDriverAddress("DMM")
! now lDmmAddress is 0x20C04
GpibClear(lDmmAddress)
See Also
GetDriverModule, GetDriverName, GetDriverType
106
ATEasy® 2.0 Reference Manual
GetDriverModule (function)
Purpose
Returns the module number of the specified Driver's name sDriverName.
Syntax
iModule = GetDriverModule ( sDriverName )
Parameters
sDriverName
VAL String[]
Configuration name of a Driver
Int
Module number
Returns
iModule
Comments
Some instruments use special addressing called module. These
instruments may be VXI switching systems with one master card and
several slave cards that have no address and are identified by module
number. When such instruments are configured into ATEasy, the model
number can be specified in the module box of the driver’s setup table
(System Editor). Base addresses of PC-based instruments are also
specified in the module box. The sDriverName is the name specified in
the Setup Drivers Dialog. When this function is called from within a
Driver subroutine and sDriverName is an empty string, the calling
Driver is assumed.
The function returns -1 if sDriverNamecannot be found. It returns 0 if
no value is specified as a module number in the Setup Drivers Dialog.
ATEasy® 2.0 Reference Manual
107
Example
iMod = GetDriverModule("Relay")
If a 'Relay' Driver is configured as a VXI instrument, module number 2
(of a switch matrix device), the following statement will result in i Mod=
2:
iBaseAddr = GetDriverModule (“A to D”)
PortOutByte (iBaseAddr, 0XAE)
In this example, GetDriverModule is used to retrieve the base address of
an A/D card. The data 0XAE is then written to that address.
See Also
GetDriverAddress, GetDriverName, GetDriverType, PortOutByte
108
ATEasy® 2.0 Reference Manual
GetDriverName (function)
Purpose
Returns the Driver name of a specified Driver's number.
Syntax
sDriverName = GetDriverName ( iDriverNum )
Parameters
iDriverNum
VAL Int
Number of Driver in the Driver table
String
Configuration name of Driver.
Returns
sDriverName
Comments
The Driver's number represents the Driver's line number in the Setup
Drivers Dialog (in the System Editor) starting from 1.
The sDriverName is according to the Driver's name as specified in the
Setup Drivers Dialog. If sDriverName is an empty string, the
iDriverNum does not exist.
If this function is used within a Driver subroutine, a 0 can be specified
as the iDriverNum parameter. The returned Driver name will be the name
of the Driver owning the subroutine.
Note: This function is very useful, since the developer of the driver may
not know the name under which this driver will be configured. The name
is required to retrieve the base address of PC-based instruments. Using
this function with a 0 as iDriverNum in conjunction with the
GetDriverModule function is therefore a requirement for PC-based
instruments if the driver is to operate properly, regardless of its name.
ATEasy® 2.0 Reference Manual
109
Example
The following example displays the content of the Setup Drivers Dialog.
Loop
sDrv=GetDriverName(i)
If sDrv = "" Then
Exitloop
Endif
Print i, sDrv, GetDriverType(sDrv),
Print GetDriverAddress(sDrv),
Print GetDriverModule(sDrv)
Endloop
See Also
GetDriverAddress, GetDriverModule, GetDriverType
110
ATEasy® 2.0 Reference Manual
GetDriverType (function)
Purpose
Returns the interface type of a specified Driver's name.
Syntax
iType = GetDriverType ( sDriverName )
Parameters
sDriverName
VAL String[]
Name of Driver in Driver table
Int
Driver type
Returns
iType
Comments
The Driver's name must be specified according to its definition in the
Driver Setup Drivers Dialog. Otherwise, the function returns -1.
The type may be one of the following:
1 - GPIB
2 - RS-232
3 - VXI
4 - Other
Example
Print GetDriverType("DMM")
! This will print 1 if DMM is a GPIB Driver
See Also
GetDriverAddress, GetDriverModule, GetDriverName
ATEasy® 2.0 Reference Manual
111
GetErrorMsg (function)
Purpose
Returns the current run-time error message.
Syntax
sError = GetErrorMsg ( )
Parameters
None.
Returns
sError
String
Error message
Comments
This function can be used only when a non-fatal run-time error
(recoverable) occurred and the _ErrorProgram subroutine was called.
Otherwise, the function returns an empty string.
112
ATEasy® 2.0 Reference Manual
Example
This example demonstrates how to determine whether a Driver caused
the error.
! This code must be inside a Driver’s _ErrorProgram
sub
Sub _ErrorProgram()
{
s="'"+GetDriverName(0)+"'"
If Pos(s, GetErrorMsg()) <> -1
! handle the error
Ignore
Else
!This driver didn’t cause the error
return
Endif
}
See Also
GetErrorNum, _ErrorProgram, Run-Time Errors, Abort, Pause, Ignore,
Retry
ATEasy® 2.0 Reference Manual
113
GetErrorNum (function)
Purpose
Returns the current run-time error number.
Syntax
iERR = GetErrorNum( )
Parameters
None.
Returns
iError
Int
Error number
Comments
This function can be used only when a non-fatal run-time error
(recoverable) occurred and the _ErrorProgram subroutine was called.
Otherwise, the function returns -1.
114
ATEasy® 2.0 Reference Manual
Example
The following example demonstrates how to retry a specific error (Error
93) three times.
Sub _ErrorProgram()
{
If GetErrorNum( ) = 93 Then
! instrument not responding
iRetries=iRetries+1
If iRetries < 3 Then
Retry ! retry 3 times
Endif
iRetries=0
Ignore
! ignore it
Else
Return
! default error message
Endif
}
See Also
GetErrorMsg, _ErrorProgram, Run-Time Errors, Abort, Pause, Ignore,
Retry
ATEasy® 2.0 Reference Manual
115
GetLogString (function)
Purpose
Returns the current Log string.
Syntax
sLog = GetLogString ( )
Parameters
None.
Returns
sLog
String
Current Log string
Comments
The current Log string can be retrieved only while ATEasy is executing
Automatic Subroutines. The function is used to retrieve the current Log
string in order to customize the Log output.
From:
The Function Returns:
_InitProgram
The serial number and the start time.
_InitTask
The task header.
_InitTest
The test header.
_EndTest
The test log line (MIN/MAX, RESULT, etc.).
_EndProgram
The stopped time, elapsed time, UUT status.
116
ATEasy® 2.0 Reference Manual
Example
The following example uses the GetLogString to print test results
without the Pin Field.
Sub _EndTest()
{
SetLogOff()
s=GetLogString()
! s is
i=Pos("Pin ", s)
If (i > 0)
s=Mid(s, 0, i)+Right(s,
i=Pos(" ------ ", s)
s=Mid(s, 0, i)+Right(s,
Endif
i=Pos("-\r\n", s)
s=Mid(s, 0, i+26)+Right(s,
Print s
the Log
}
Sub _InitTask()
{
SetLogOn()
}
Sub _EndTask()
{
SetLogOn()
}
Sub _EndProgram()
{
SetLogOn()
}
defined as string[512]
i+6)
! remove pin
i+6)
! remove ----
I+32)
! remove name
! print
! enable Log output
! enable Log output
! enable Log output
See Also
FormatLogString, SetLogOff, SetLogOn, Automatic Subroutines
ATEasy® 2.0 Reference Manual
117
GetProfileName (function)
Purpose
Returns the name of the current Profile.
Syntax
sProfile = GetProfileName ( )
Parameters
None.
Returns
sProfile
String
Current profile name
Comments
This function returns a string containing the name of the current Profile
as selected using the Select Profile option from the Conditions menu or
as set by the SetProfileNum function . If no Profile was selected, this
function returns an empty string.
Example
If GetProfileName( ) = "DEBUG U12" then
! Program statements
Endif
See Also
GetProfileNum, SetProfileNum
118
ATEasy® 2.0 Reference Manual
GetProfileNum (function)
Purpose
Returns the number of the current Profile.
Syntax
iProfile = GetProfileNum ( )
Parameters
None.
Returns
iProfile
Int
Current Profile number
Comments
This function returns an Int containing the number of the current Profile
as selected using the Select Profile option from the Conditions menu or
as set by the SetProfileNum function. If no Profile was selected, this
function returns 0.
Example
If GetProfileNum( ) = 5 then
! Program statements
Endif
See Also
GetProfileName, SetProfileNum
ATEasy® 2.0 Reference Manual
119
GetProgramLastUpdate (function)
Purpose
Returns the date and time the current program was last updated.
Syntax
sUpdate = GetProgramLastUpdate ( )
Parameters
None.
Returns
sUpdate
String
Last update string
Comments
This function returns a string containing the date and time the current
program was last saved. (The return value can also be seen at the
Program Summary dialog.)
Example
Print "The Program was Last Updated and Saved on:";
Print GetProgramLastUpdate( )
See Also
GetProgramName, GetProgramSerialNum, GetProgramVersion,
GetProgramUut
120
ATEasy® 2.0 Reference Manual
GetProgramName (function)
Purpose
Returns the file name of the current program.
Syntax
sName = GetProgramName ( )
Parameters
None.
Returns
sName
String
Program file name
Comments
Only the name and extension of the file is returned, not the full path.
Example
Print GetProgramName( )
! e.g. prints "EXAMPLE.PRG"
See Also
GetProgLastUpdate, GetProgSerialNum, GetProgramVersion,
GetProgramUut, GetUserName, GetDir, Run
ATEasy® 2.0 Reference Manual
121
GetProgramSerialNum (function)
Purpose
Returns the serial number of the current Unit Under Test (UUT).
Syntax
sSerNum = GetProgramSerialNum ( )
Parameters
None.
Returns
sSerNum
String
UUT serial number
Comments
This function returns a string containing the serial number of the
current UUT. The Serial Number string is the string entered by the user
in the UUT Serial Number # dialog.
Example
Sub _InitProgram()
{
If Mid(GetProgramSerialNum( ), 2, 2) = "V3" then
Task 1
Else
Task 2
! skip first Task
Endif
}
See Also
GetProgramName, GetProgLastUpdate, GetProgramVersion
122
ATEasy® 2.0 Reference Manual
GetProgramTasks (function)
Purpose
Returns the number of Tasks in the current program.
Syntax
iTasks = GetProgramTasks ( )
Parameters
None.
Returns
iTasks
Int
Number of tasks
Example
! execute the last task of this program
Task GetProgramTasks()
See Also
GetTaskTests, Task, Test
ATEasy® 2.0 Reference Manual
123
GetProgramUut (function)
Purpose
Returns the name of the current Unit Under Test (UUT).
Syntax
sUutName = GetProgramUut( )
Parameters
None.
Returns
sUutName
String
Program UUT name
Comments
This function returns a string containing the name of the current UUT
as defined in the Program Summary dialog. The function is useful for
custom test logs.
Example
Print "UUT : ";GetProgramUut()
See Also
GetProgramName, GetProgLastUpdate, GetProgSerialNum,
GetProgramVersion
124
ATEasy® 2.0 Reference Manual
GetProgramVersion (function)
Purpose
Returns the version of the current program.
Syntax
sVersion = GetProgramVersion ( )
Parameters
None.
Returns
sVersion
String
Program version string
Comments
This function, which can be used for configuration management
purposes, returns a string containing the version of the current program
(as taken from the Program Summary dialog).
Example
Print "Program Version:";
Print GetProgramVersion( )
See Also
GetProgramName, GetProgLastUpdate, GetProgSerialNum,
GetProgramUut
ATEasy® 2.0 Reference Manual
125
GetTaskName (function)
Purpose
Returns the name of the current Task.
Syntax
sTask = GetTaskName( )
Parameters
None.
Returns
sTask
String
Current Task name
Comments
This name is defined at the Task/Test Summary dialog. If no Task is
currently running (e.g., while ATEasy is executing _InitProgram), an
empty string is returned.
Example
The following example disables the Log output on a Task named
"Calibration UUT...".
Sub _InitTask()
{
If GetTaskName( ) = "UUT Calibration" then
Print "Calibrating UUT..."
SetLogOff()
Else
SetLogOn()
Endif
}
See Also
GetProgramTasks, GetTaskNum, GetTestName, GetTestNum
126
ATEasy® 2.0 Reference Manual
GetTaskNum (function)
Purpose
Returns the number of the current Task.
Syntax
iTask = GetTaskNum ( )
Parameters
None.
Returns
iTask
Int
Current Task number
Comments
The function returns a number greater than 0 when a Task is running
and 0 when a Task is not running (e.g., while ATEasy is executing
_InitProgram).
Example
The following example skips Task 3 if one of the Tests failed.
Sub _EndTask()
{
If GetUutStatus()< > PASS then
if GetTaskNum( ) = 2 then
! status is FAIL
or ERR
Task 4
! skip Task 3
Endif
Endif
}
See Also
GetTestName, GetTaskName, GetTestNum
ATEasy® 2.0 Reference Manual
GetTaskTests (function)
Purpose
Returns the number of Tests in the current test.
Syntax
iTests = GetTaskTests ( )
Parameters
None.
Returns
iTests
Int
Number of tests
Example
! execute the last task of this program
Test GetTaskTests()
See Also
GetProgramTasks, Task, Test
127
128
ATEasy® 2.0 Reference Manual
GetTestMask (function)
Purpose
Returns the value of the mask used with the current REF-2 or REF-X
Test.
Syntax
lMask = GetTestMask ( )
Parameters
None.
Returns
lMask
Long
Current Test mask value
Comments
This function returns the mask of the current REF-2 or REF-X Test as
defined using the Task/Test Summary dialog.
The function returns 0 if the current Test Type is not REF-2 or REF-X.
The lMask represents 32 bits that should be compared (1), or ignored
(0) when the result of the Test (TestRefResult) is compared to the
reference value (GetTestRef).
Example
!Prints a binary representation of the mask
Print Str(GetTestMask(), 2)
See Also
GetTestRef, SetTestMask, SetTestRef, TestRefResult
ATEasy® 2.0 Reference Manual
129
GetTestMax (function)
Purpose
Returns the value of the upper limit (MAX) allowed for the current MINMAX Test.
Syntax
fMax = GetTestMax( )
Parameters
None.
Returns
fMax
Float
Current Test maximum
Comments
The MAX value is defined in the Task/Test Summary dialog.
The function returns 0 if the current Test type is not MIN-MAX.
Example
! Set new MIN\MAX according to fOffset variable
SetTestMin(fOffset+GetTestMin())
SetTestMax(fOffset+GetTestMax())
See Also
GetTestMin, SetTestMax, SetTestMin, TestResult
130
ATEasy® 2.0 Reference Manual
GetTestMin (function)
Purpose
Returns the value of the lower limit (MIN) allowed for the current MINMAX Test.
Syntax
fLimit = GetTestMin ( )
Parameters
None.
Returns
fLimit
Float
Current Test minimum
Comments
The MIN value is defined in the Task/Test Summary dialog.
The function returns 0 if the current Test type is not MIN-MAX.
Example
! Set new MIN\MAX according to fOffset variable
SetTestMin(fOffset+GetTestMin())
SetTestMax(fOffset+GetTestMax())
See Also
GetTestMax, SetTestMax, SetTestMin, TestResult
ATEasy® 2.0 Reference Manual
GetTestName (function)
Purpose
Returns the name of the current Test.
Syntax
sTestName = GetTestName ( )
Parameters
None.
Returns
sTestName
String
Name of current Test
Comments
The name is defined in the Task/Test Summary dialog.
If no Test is currently running (e.g., while ATEasy is executing
_InitProgram), an empty string is returned.
131
132
ATEasy® 2.0 Reference Manual
Example
The following example aborts the program if a Test that begins with the
word "Critical" fails.
Sub _EndTest()
{
s=GetTestName( )
If (Mid(s, 0, 8) = "Critical" Then
If TestStatus>PASS Then
Print GetLogString()
Print "Aborting..."
_AbortProgram()
Abort()
Endif
Endif
}
See Also
GetTaskName, GetTaskNum, GetTestNum
ATEasy® 2.0 Reference Manual
133
GetTestNum (function)
Purpose
Returns the number of the current Test.
Syntax
iTestNum = GetTestNum ( )
Parameters
None.
Returns
iTestNum
Int
Current Test number
Comments
The function returns a number greater than 0 when a Test is running
and 0 when a Test is not running (e.g., while ATEasy is executing
_InitTask).
Example
The following example uses GetTestNum to customize the Log output.
Sub _EndTest()
{
Print GetTestNum();".";GetTestName();
Print "-";asStatus[TestStatus]
}
See Also
GetTestName, GetTaskName, GetTaskNum
134
ATEasy® 2.0 Reference Manual
GetTestPin (function)
Purpose
Returns the Pin name of the current Test.
Syntax
sPin = GetTestPin ( )
Parameters
None.
Returns
sPin
String
Test pin name
Comments
The name is defined in the Task/Test Summary dialog.
Example
The following example switches a Relay Driver and takes a measurement
from a DMM according to the Test Pin name.
Sub MeasureTest( )
{
Switch Relay AllOff
sPin=GetTestPin()
If Mid(sPin, 0, 2)="P-"
Switch Relay On (101)
Else
Switch Relay On (103)
Endif
Measure DMM (TestResult)
}
See Also
GetTestUnit, GetTestType
ATEasy® 2.0 Reference Manual
135
GetTestRef (function)
Purpose
Returns the required value (reference) for the current REF-2 or REF-X
Test.
Syntax
lRef = GetTestRef ( )
Parameters
None.
Returns
lRef
Long
Test reference value
Comments
This function returns the reference value of the current REF-2 or REF-X
Test as defined in the Task/Test Summary dialog.
The function returns 0 if the current Test Type is not REF-2 and not
REF-X.
Example
Print Str(GetTestRef(), 16)
hex format
!Prints the reference in
See Also
GetTestMask, SetTestMask, SetTestRef, TestRefResult
136
ATEasy® 2.0 Reference Manual
GetTestType (function)
Purpose
Returns the type of the current Test.
Syntax
iType = GetTestType ( )
Parameters
None.
Returns
iType
Int
Test type
Comments
The Test type is defined using the Task/Test Summary dialog.
Test type can be one of the following:
1 - MIN/MAX
2 - Other
3 - REF-2
4 - REF-X
ATEasy® 2.0 Reference Manual
137
Example
The following example uses GetTestType to customize the Log output.
Sub _EndTest()
{
If GetTestType( ) = 1 Then
sType="MIN-MAX"
Else
sType="Other"
Endif
Print , GetTestNum();".";sType;".";
Print GetTestName();
Print "-";asStatus[TestStatus]
}
See Also
GetTestUnit, GetTestPin
138
ATEasy® 2.0 Reference Manual
GetTestUnit (function)
Purpose
Returns the units of measurement used with the current Test.
Syntax
sUnits = GetTestUnit ( )
Parameters
None.
Returns
sUnits
String
Test units
Comments
GetTestUnit returns a string containing the units of measurement of the
current Test as defined in the Task/Test Summary dialog box.
Example
The following example takes a DC or a 2Wire measurement according to
the current Test Unit.
Sub _EndTest()
{
If GetTestType( ) = 1 Then
If GetTestUnit() = "Volt"
Set DMM Function VDC
Else
Set DMM Function 2Wire
Endif
Mesure DMM (TestResult)
Endif
}
See Also
GetTestType, GetTestPin, GetTestUnit
ATEasy® 2.0 Reference Manual
139
GetUserLevel (function)
Purpose
Returns the current user level.
Syntax
iLevel = GetUserLevel ( )
Parameters
None.
Returns
iLevel
Int
User level
Comments
The current user level can be 3, 2, or 1 as defined for the current user in
the Password Definition Dialog. The current user is determined by
ATEasy according to the password entered in the Password Login
Dialog.
Example
The following example disables the Pause button if the user has a 1 level
value.
Sub _InitProgram()
{
If GetUserLevel()=1 Then
EnableAbortPause(TRUE, FALSE)
Endif
}
See Also
GetUserName
140
ATEasy® 2.0 Reference Manual
GetUserName (function)
Purpose
Returns the current user name.
Syntax
sUserName = GetUserName ( )
Parameters
None.
Returns
sUserName
String
User name
Comments
The current user name is defined in the Password Definition Dialog. The
current user is determined by ATEasy according to the password
entered in the Login Dialog.
Example
Print "Current User Name Is :";GetUserName( )
See Also
GetUserLevel
ATEasy® 2.0 Reference Manual
141
GetUutStatus (subroutine)
Purpose
Returns the status of the current program.
Syntax
GetUutStatus ( iStatus, lFails, iFlags, fElapsedTime)
Parameters
None.
Returns
iStatus
VAL Int
The UUT status
lFails
VAL Long
Number of failed tests
iFlags
VAL Int
See "Comments," below
fElapsedTime
VAL Float
Time elapsed since this program started
Comments
The iStatus can be one of TestStatus constants: NONE, PASS, FAIL or
ERR.
The iFails is the number of tests which have failed since the current
program started.
Each bit in lFlags represents a condition that occurred since Run-Start
was selected or since GetUutStatus was last executed. The conditions
are listed below. Each bit is set to 1 if the condition occurred, or to 0 if it
didn’t. The following bits are available:
bit 0
Task was skipped
bit 1
Test was skipped
bit 2
Loop on test
bit 3
Current test
bit 4
Step/Trace happened
142
ATEasy® 2.0 Reference Manual
bit 5
Doit happened
bit 6
Pause happened
bit 7
Abort happened
bit 8
Error occurred
bit 9
Ignore occurred
bit 16
Serial number is checked
bit 17
Profile is selected
bit 18
Task by task
bit 19
Test by test
bit 20
Stop on fail
After calling GetUutStatus, bits 0 through 15 are cleared (set to 0).
The fElapsedTime specifies the elapsed time in seconds since the
current running program was started.
Example
Sub _EndProgram ( )
{
GetUutStatus ( iStatus, iFails, iFlags, fTime)
If iStatus = PASS Then
Print "This UUT PASSED"
Else
Print "This UUT FAILED"
Endif
}
See Also
GetUserLevel
ATEasy® 2.0 Reference Manual
Goto
143
(statement)
Purpose
Performs an unconditional branch to the statement following the
specified label.
Syntax
Goto Label
.
.
Label:
Comments
The specified label must be declared inside the current code segment
(Test or Subroutine) before or after the Goto statement.
Example
If i = 5 Then
Goto TestEnd
Endif
! Program statements
TestEnd:
! other Program statements
See Also
Task, Test
144
ATEasy® 2.0 Reference Manual
GpibClear (function)
Purpose
Clears (resets) a specified GPIB device.
Syntax
iStatus = GpibClear ( lBoardDevice )
Parameters
lBoardDevice
VAL Long[ ]
Board or Device address
Int
Status
Returns
iStatus
Comments
This function initializes (resets) a specified GPIB device or board by
sending the SDC (Selected Device Clear) command to the specified
device, or by sending the DCL (Device Clear) command to the board.
The instrument must have a DC1 or DC2 subset of the GPIB DC
interface function in order to respond to this function.
The hexadecimal format of lBoardDevice is as follows:
lBoardDevice = 0xBBPPSS
Where:
BB =
Board address (1 or 2)
PP =
Device Primary address (1 to 30)
SS =
Device Secondary address (1-31, 0 if not used)
When PPSS is 0 lBoardDevice specifies a board address. The value of
lBoardDevice may be obtained using the GetDriverAddress function.
The function returns 0 on success and -1 on failure.
ATEasy® 2.0 Reference Manual
145
Examples
The following command clears the GPIB device at address 5 connected
to GPIB board 1:
GpibClear(0x010500)
The following command clears all the GPIB devices connected to GPIB
board 1:
GpibClear(0x010000)
See Also
GpibIFC, GpibCommands
146
ATEasy® 2.0 Reference Manual
GpibCommands (function)
Purpose
Sends a string containing a sequence of GPIB commands to the
specified GPIB board.
Syntax
iSent = GpibCommands ( lBoard, sStr, iBytes )
Parameters
lBoard
VAL Long
Board address
sStr
VAR String[]
A sequence of GPIB commands
iBytes
VAL Int
Number of bytes to send
Int
Bytes sent
Returns
iSent
Comments
The hexadecimal format of lBoard is as follows:
lBoard = 0xBB0000
Where:
BB = Board address (1 or 2)
GpibCommands is used when special command sequences which are
not supported by other ATEasy functions need to be sent directly to
GPIB device(s). Do not use this function to transmit data instructions to
devices. All bytes are sent with ATN set on.
ATEasy® 2.0 Reference Manual
The following table lists the available commands and their decimal
values:
Value
CMD
Remark
1
GTL
Go To Local
4
SDC
Selective Device Clear
5
PPC
Parallel Poll Configure
8
GET
Group Execute Trigger
17
LLO
Local Lock Out
20
DCL
Device Clear
21
PPU
Parallel Poll Unconfigure
24
SPE
Serial Poll Enable
25
SPD
Serial Poll Disable
32-62
LADx
Listen address x
63
UNL
Un-Listen
MTAx
My Talk address x
64-94
95
UNT
Un-Talk My Talk address x
The function returns the number of bytes sent on success and -1 on
failure.
Example
The following command simultaneously triggers GPIB devices at
addresses 1, 2, and 4 connected to board # 1:
GpibCommand ( 0x10000, "?\x033\x034\x036\x008", 5 )
Where:
'?'
'\x033'
'\x034'
'\x036'
'\x008'
See Also
GpibSend
UNL Un-Listen
L1 Listen address 1
L2 Listen address 2
L4 Listen address 4
Group Execute Trigger
147
148
ATEasy® 2.0 Reference Manual
GpibIFC
(function)
Purpose
Performs Interface Clear (IFC) on a specified GPIB board.
Syntax
iStatus = GpibIFC ( lBoard )
Parameters
lBoard
VAL Long
Board address
Int
Status
Returns
iStatus
Comments
This function asserts the GPIB IFC line and causes the instruments
connected to the specified GPIB board to be un-addressed and taken
out of serial poll mode.
The hexadecimal format of lBoard should be as follows:
lBoard = 0xBB0000
Where:
BB = Board address (1 or 2)
This function returns 0 on success and -1 on failure
Example
The following command performs IFC on GPIB card #2:
GpibIFC(0x020000)
See Also
GpibClear
ATEasy® 2.0 Reference Manual
149
GpibLLockout (function)
Purpose
Send Local Lockout messages to all devices connected to the specified
GPIB board to disable their front panel.
Syntax
iStatus = GpibLLockout ( lBoard )
Parameters
lBoard
VAL Long
Board address
Int
Status
Returns
iStatus
Comments
This function locks the front panel operation capabilities of all the
devices connected to the specified board by sending a Local LockOut
(LLO) command to the board. After receiving the Local Lockout
command, the device ignores any input from its front panel control
switches.
The hexadecimal format of lBoard should be as follows:
lBoard = 0xBB0000
Where BB = Board address (1 or 2)
The function returns 0 on success and -1 on failure.
150
ATEasy® 2.0 Reference Manual
Example
The following command enters devices connected to board 1 into the
Local Lockout mode:
GpibLLockout(0x10000)
See Also
GpibLocal, GpibRemote
ATEasy® 2.0 Reference Manual
151
GpibLocal (function)
Purpose
Causes a specified GPIB device to switch into local mode of operation.
Syntax
iStatus = GPIBLocal ( lBoardDevice )
Parameters
lBoardDevice
VAL Long
Board to Device address
Returns
iStatus
Int
status
Comments
This function causes the specified device to obey commands from its
front panel control switches by performing the Go To Local GPIB
function (GTL). If lBoardDevice specifies only a board address, the
Remote Enable (REN) line is de-asserted, placing all devices connected
in local mode.
The hexadecimal format of lBoardDevice should be as follows:
lBoardDevice = 0xBBPPSS
Where:
BB =
Board address (1 or 2)
PP =
Device Primary address (1 to 30)
SS =
Device Secondary address (1-31, 0 if not used)
When PPSS is 0, lBoardDevice specifies a board address.
The value of lBoardDevice may be obtained using the
GetDriverAddress function.
The function returns 0 on success and -1 on failure.
152
ATEasy® 2.0 Reference Manual
Example
The following command sets an oscilloscope into local mode:
GPIBLocal(GetDriverAddress("SCOPE")
See Also
GpibLLockout, GpibRemote
ATEasy® 2.0 Reference Manual
GpibPPoll
153
(function)
Purpose
Performs a parallel poll to the specified GPIB board and returns the
result byte.
Syntax
iStatus = GpibPPoll ( lBoard )
Parameters
lBoard
VAL Long
Board address
Int
Parallel Poll byte
Returns
iPPL
Comments
This function conducts a parallel poll and returns an Int containing the
data byte read from all devices which have been configured for parallel
polls. The state of each bit is according to the parallel poll configuration
sent to the instrument using the GpibPPollC function.
The hexadecimal format of the long Int is as follows:
lBoard = 0xBB0000
WhereL
BB = Board address (1 or 2)
A return value of -1 indicates that an error occurred during execution.
154
ATEasy® 2.0 Reference Manual
Example
The following command performs parallel poll on GPIB board #2 and
isolates the data stored in dataline #1:
iDIO1=GpibPPoll(0x020000) and 1
See Also
GpibPPollC, GpibPPollU, GpibSpl
ATEasy® 2.0 Reference Manual
155
GpibPPollC (function)
Purpose
Configures a GPIB device to respond to parallel polling.
Syntax
iStatus = GpibPPollC ( lDevice, iDataLine, iSense )
Parameters
lDevice
VAL Long
Device address
iDataLine
VAL Int
Parallel poll configure response line 1-8
iSense
VAL Int
Data sense, 0 or 1
Int
Status
Returns
iStatus
Comments
This function configures the specified device to respond to parallel
polling according to the DataLine and the Sense.
This function accepts a long Int containing the GPIB device number
(lDevice), an Int containing the data line number on which the device is
to respond (iDataLine may be 1 through 8), and the response to the
condition under which the device is to assert or un-assert the specified
data line (iSense may be 0 or 1).
156
ATEasy® 2.0 Reference Manual
The hexadecimal format of lDevice is as follows:
lDevice = 0xBBPPSS
Where:
BB =
Board address (1 or 2)
PP =
Device Primary address (1 to 30)
SS =
Device Secondary address (1-31, 0 if not used)
The value of lDevice may be obtained using the GetDriverAddress
function.
The function returns 0 on success and -1 on failure.
Not all devices can be configured to respond to parallel polling. Devices
with the built-in capability to configure themselves for parallel polling
will ignore the GpibPPollC function.
Example
The following command configures the SCOPE to assert data line
number 2 to '1':
GpibPPollC(GetDriverAddress("SCOPE") , 2, 1)
!...
! program statements
!...
If (GpibPPoll(GetDriverAddress("SCOPE")) & 2)=1
! do something
Endif
See Also
GpibPPoll, GpibPPollU
ATEasy® 2.0 Reference Manual
157
GpibPPollU (function)
Purpose
Disables parallel polling of a specified GPIB device.
Syntax
iStatus = GpibPPollU (lBoardDevice)
Parameters
lBoardDevic
e
VAL Long
Board or Device address
Int
Status
Returns
iStatus
Comments
This function disables a device from responding to parallel polling. If
lBoardDevice specifies board address, all devices connected to this
board will be unconfigured.
The hexadecimal format of the lBoardDevice parameter is as follows:
lBoardDevice = 0xBBPPSS
Where:
BB =
Board address (1 or 2)
PP =
Device Primary address (1 to 30)
SS =
Device Secondary address (1-31, 0 if not used)
When PPSS is 0, lBoardDevice specifies a board address. The value of
lBoardDevice may be obtained using the GetDriverAddress function.
This function returns 0 on success and -1 on failure.
158
ATEasy® 2.0 Reference Manual
Example
The following command disables the DMM from responding to parallel
polling:
GpibPPollU(GetDriverAddress("DMM"))
See Also
GpibPPollC, GpibPPoll
ATEasy® 2.0 Reference Manual
159
GpibReceive (function)
Purpose
Reads a string of data bytes from a specified GPIB device.
Syntax
iStatus = GpibReceive ( lDevice , sEOS , iEOI , iTimeoutmSec , iMode ,
sStr , iBytes )
Parameters
lDevice
VAL Long
Device address
sEOS
VAL String[]
End of sequence string
iEOI
VAL Int
Terminate on EOI
iTimeout
VAL Int
Timeout in milliseconds
iMode
VAL Int
Mode of operation
sStr
VAR String[]
Receive data buffer
iBytes
VAL Int
Maximum bytes to receive
Int
Bytes actually received
Returns
iReceived
160
ATEasy® 2.0 Reference Manual
Comments
The hexadecimal format of lDevice parameter is as follows:
lDevice = 0xBBPPSS
Where:
BB =
Board address (1 or 2)
PP =
Device Primary address (1 to 30)
SS =
Device Secondary address (1-31, 0 if not used)
The value of lDevice may be obtained using the GetDriverAddress
function.
The sEOS can be 0-2 bytes long. It specifies the data bytes that signal
the end of data.
The iEOI can be 1 for termination of the transmission on EOI line (End
or Identify), or 0 if the EOI line is ignored.
The iMode specifies the condition of receipt:
0 - Immediate
1 - On SRQ
2 - Immediate or SRQ, whichever comes first
This function returns the number of bytes received, including the EOS
string. A value of -1 indicates failure.
Example
The following command reads a maximum of 20 bytes from the DMM to
sData. The terminator used is Carriage Return/Line Feed. EOI is enabled
and timeout is set to 1500 mSec:
lDevice=GetDriverAddress("DMM")
GpibReceive(lDevice, "\r\n", 1, 1500, 0, sData, 20)
See Also
GpibSend
ATEasy® 2.0 Reference Manual
161
GpibRemote (function)
Purpose
Places a specified GPIB device in a remote mode of operation and
addresses the device as a listener.
Syntax
iStatus = GpibRemote ( lBoardDevice )
Parameters
lBoardDevice
VAL Long
Board or Device address
Int
Status
Returns
iStatus
Comments
This function places the specified device in a remote mode of operation
(under program control). If lBoardDevice specifies only a board address
the Remote Enable (REN) line will be asserted but no device will be
addressed.
The hexadecimal format of lBoardDevice is as follows:
lBoardDevice = 0xBBPPSS
Where:
BB =
Board address (1 or 2)
PP =
Device Primary address (1 to 30)
SS =
Device Secondary address (1-31, 0 if not used)
When PPSS is 0, lBoardDevice specifies a board address.
The value of lBoardDevice may be obtained using the
GetDriverAddress function.
This function returns 0 on success and -1 on failure.
162
ATEasy® 2.0 Reference Manual
Example
The following command places a function generator in remote mode:
GPIBRemote(GetDriverAddress("FuncGen"))
See Also
GpibLocal
ATEasy® 2.0 Reference Manual
GpibSend
163
(function)
Purpose
Sends a string of data bytes to a specified GPIB device.
Syntax
iSent = GpibSend ( lDevice, sEOS, iEOI, iTimeoutmSec, sStr, iBytes )
Parameters
lDevice
VAL Long
Device address
sEOS
VAL String[]
End of sequence string
iEOI
VAL Int
Terminate on EOI
iTimeout
VAL Int
Milliseconds before timeout
sStr
VAL String[]
String to transmit
iBytes
VAL Int
Number of bytes to transmit
Int
Bytes actually sent
Returns
iSent
164
ATEasy® 2.0 Reference Manual
Comments
The hexadecimal format of lDevice parameter is as follows:
lDevice = 0xBBPPSS
Where:
BB =
Board address (1 or 2)
PP =
Device Primary address (1 to 30)
SS =
Device Secondary address (1-31, 0 if not used)
The value of lDevice may be obtained using the GetDriverAddress
function.
The sEOS can be 0-2 bytes long. This string is sent after the sStr is sent.
The iEOI can be 1 for asserting the EOI line (End or Identify) on the last
byte sent, and 0 if assertion is not required.
This function returns the number of bytes sent, including the sEOS
string. A value of -1 indicates failure.
Example
The following command sends the string "F1G2" to the DMM. The
terminator used is Carriage Return/Line Feed, EOI is enabled, and
timeout is set to 150 mSec:
lDevice=GetDriverAddress("DMM")
GpibSend(lDevice, "\r\n", 1, 150, "F1G2", 4)
See Also
GpibCommands, GpibReceive
ATEasy® 2.0 Reference Manual
GpibSpl
165
(function)
Purpose
Performs a Serial Poll of a specified GPIB device.
Syntax
iSpl = GpibSpl ( lDevice )
Parameters
lDevice
VAL Long
Device address
Int
Serial Poll byte
Returns
iSpl
Comments
This function reads the Serial Poll byte of a device, the byte is assigned
to the return value (Int). Some devices are not capable of responding to
a serial poll.
Serial Poll is usually the user-programmed response to a device Service
ReQuest (SRQ).
The hexadecimal format of lDevice parameter is as follows:
lDevice = 0xBBPPSS
Where:
BB =
Board address (1 or 2)
PP =
Device Primary address (1 to 30)
SS =
Device Secondary address (1-31, 0 if not used)
The value of lDevice may be obtained using the GetDriverAddress
function.
A return value of -1 indicates that an error occurred during execution.
166
ATEasy® 2.0 Reference Manual
Example
The following example waits until bit # 6 in the Serial Poll byte is 1
(SRQ). Then it receives a string.
lScope=GetDriverAddress("SCOPE")
i=0
While (GpibSpl(lScope) and 64) = 0 and i < 20000
i=i+1
Endwhile
If i < 20000 Then
GpibReceive(lDevice, "\r\n", 1, 150, 0, sData, 20)
Else
print "Scope Error: Timeout"
Endif
See Also
GpibStatus
ATEasy® 2.0 Reference Manual
167
GpibStatus (function)
Purpose
Determines the status of a specified GPIB board.
Syntax
iStatus = GpibStatus ( lBoard )
Parameters
lBoard
VAL Long
Board address
Int
Status
Returns
iStatus
Comments
This function reads the current state of the SRQ and NDAC lines of the
specified GPIB board.
The hexadecimal format of the lBoard parameter is as follows:
lBoard = 0xBB0000
Where:
BB = Board address (1 or 2)
This function returns an Int containing the status: Bit #0 (LSB)
designates the state of SRQ line (1 for set, 0 for clear); Bit #1 designates
the state of NDAC line.
A return value of -1 indicates that an error occurred during execution.
168
ATEasy® 2.0 Reference Manual
Example
The following command reads the status of GPIB board #2 and
determines if the SRQ line is asserted:
iStatus=GpibStatus(0x20000)
iSrqOn = iStatus <> -1 and (iStatus and 1)
See Also
GpibSrq
ATEasy® 2.0 Reference Manual
GpibTrig
169
(function)
Purpose
Triggers the specified GPIB device or devices connected to a specified
board.
Syntax
iStatus = GpibTrig ( lBoardDevice )
Parameters
lBoardDevice
VAL Long
Board or device address
Int
Status
Returns
iStatus
Comments
This function triggers a specified device or board using the GPIB GET
function (Group Execute Trigger). If lBoardDevice specifies a board
address, all devices connected to this board and addressed to listen are
triggered.
The hexadecimal format of lBoardDevice is as follows:
lBoardDevice = 0xBBPPSS
Where:
BB =
Board address (1 or 2)
PP =
Device Primary address (1 to 30)
SS =
Device Secondary address (1-31, 0 if not used)
When PPSS is 0, lBoardDevice specifies a board address.
The value of lBoardDevice may be obtained using the
GetDriverAddress function.
A return value of 0 indicates success, and -1 indicates that an error
occurred during execution.
170
ATEasy® 2.0 Reference Manual
Example
The following command triggers a DMM:
GpibTrig(GetDriverAddress("DMM"))
See Also
GpibCommand
ATEasy® 2.0 Reference Manual
171
FormatLogString (function)
Purpose
Changes the format of Test results of a given Test type printed by
ATEasy at the end of a Test to the Log window or returned by the
GetLogString function.
Syntax
lPrvFlags = FormatLogString ( iTestType, sHeader, sFormatSpec,
lFlags )
Parameters
iTestType
VAL Int
sHeader
VAL String [ ]
One of the following values:
1=MIN/MAX
2=Other
3=Ref-2
4=Ref-X
Test header
sFormatSpec
VAL String [ ]
Test format specification
lFlags
VAL Long
0 for default or one or a combination of
the following values ORed together:
0x01=Next Include Header
0x02=Next Not Include Header
0x04=Next Calculate TestStatus
0x10=Ignore sHeader parameter
0x20=Ignore sFormatSpec Parameter
Long
Pervious flags
Returns
lPrvFlag
172
ATEasy® 2.0 Reference Manual
Comments
The sHeader parameter is used to set the specified Test type iType
header. e.g. the default MIN-MAX header is the following string:
"#
Test-Name
Pin
Unit
Min
Result
Max
Status\r\n"+
"--- ------------------ ------ ------ ---------- ------------------ ------"
This header can be changed by setting the sHeader parameter. If the
sHeader parameter contain one or more lines separated by \r\n ATEasy
will use the sHeader as is when printing test header. If the sHeader
does not contain \r\n then the second line will automatically be
generated by ATEasy according to the sFormatSpec parameter. If
sHeader is a "" then ATEasy will generate the header automatically.
For example:
sHeader=
"| #
| Test Name
| Result
| Status
|\r\n"+
"|~~~~~|~~~~~~~~~~~~~~~~~~|~~~~~~~~~~~|~~~~~~~~|"
The sFormatSpec string parameter contains fields characters preceding
with % and an optional parameter following the field character. The field
syntax is : %F[P] where F is the field character and P is the optional
parameter. The field can be separated by any character(s) which are
used as is. The following table describes the fields code and their
parameters:
Field
Name
Parameter
Default
Parameter
#
GetTestNum
[length]
3
N
GetTestName
[length]
16
P
GetTestPin
[length]
6
U
GetTestUnit
[length]
6
L
GetTestMin
[length
[:decimal[:exponent]]]
10:4
ATEasy® 2.0 Reference Manual
H
GetTestMax
[length
[:decimal[:exponent]]]
10:4
173
174
ATEasy® 2.0 Reference Manual
Field
Name
Parameter
Default
Parameter
R
GetTestResult
[length
[:decimal[:exponent]]]
10:4
2
GetTestMask
[length]
32
GetTestRef
TestRefResult
X
TestRefResult
[length]
8
M
GetTestMask
[length]
8
F
GetTestRef
[length]
8
S
TestStatus
[length]
6
For Example:
sFormatSpec="| %# | %N16 | %R10:3:3 | %S |"
will generate the following Test result:
"| 001 | This is an examp | 10.245E+02 | pass
|"
The lFlags parameter specifies whether to include or not to include the
sHeader in the next call to the GetLogString function or in the next time
ATEasy outputs Test results to the Log window.
The lFlags can be used to force ATEasy to calculate TestStatus if its
value is not NONE in the next call to GetLogString.
Other flags 0x10, and 0x20 can be used to keep the Format or Header as
is.
The return value indicates the previous flags state, this value can be
used in order to find out whether ATEasy will include the Test header in
the next call to GetLogString or in the next time ATEasy outputs Test
results to the Log window.
ATEasy® 2.0 Reference Manual
175
Example
The LANGUAGE.PRG Program contains several examples of Log
formatting using the FormatLogString function. The following example
demonstrates how to change the format of MIN-MAX Test results:
Sub _InitProgram ( )
{
s= "|Num|Test Name
| Result |Status|\r\n"
s=s+"|~~~|~~~~~~~~~~~~~~~~|~~~~~~~~~~|~~~~~~|"
FormatLogString(1, s, "|%#|%N16|%R10:3|%S6|", 4)
}
See Also
GetLogString, Print, SetLogOff, SetLogOn
176
ATEasy® 2.0 Reference Manual
If..Then
(statement)
Purpose
Makes a decision regarding the program's flow based on a result
returned by an expression.
Syntax
If integer-exp1 [ Then ]
[ statements1 ]
[ Elseif integer-exp2 [ Then ]
[ statements2 ]... ]
[ Else
[ statements3 ] ]
Endif
Comments
If the result of the integer-exp1 is not equal to zero (true), the
statements1 are executed. If integer-exp1 is zero (false), the next Elsif (if
exist) expression is evaluated. If the next Elseif expression is true, the
corresponding statements are executed. If none of the expressions is
true, any statements following the Else are executed. After the first
statements are executed, control passes to the next statement following
the Endif.
Example
If i > 5 Then
i=i+1
Endif
! if i was 3, now it is still 3
! if i was 6, now it is 7
If (i > 2 and i < 6) Then
i=i+1
Endif
! if i was 3, now it is 4
ATEasy® 2.0 Reference Manual
! if i was 6, now it is still 6
If i
i=i+1
Endif
! if i was 0, now it is still 0
! if i was 6, now it is 7
If i < 2 then
j=1
elseif (i = 2) then
j=2
elseif i=3
j=3
else
j=4
Endif
! if i is 1, j is 1
! if i is 2, j is 2
! if i is 3, j is 3
! if i is 6, j is 4
! nested if Example
If i < 2
if i =1
j=1
else
j=2
endif
elseif i=2
j=3
else
j=4
endif
! if i is 1, j is 1
! if i is 0, j is 2
! if i is 2, j is 3
! if i is 6, j is 4
See Also
Expressions, Statements
177
178
ATEasy® 2.0 Reference Manual
Ignore (statement)
Purpose
Ignores a non-fatal run-time (recoverable) error and resumes execution
of the next statement.
Syntax
Ignore
Comments
This statement can be used only after ATEasy calls the _ErrorProgram
automatic subroutine and before it returns from this subroutine.
Otherwise, ATEasy ignores the statement.
Normally when a recoverable run-time error occurrs, ATEasy displays
the Run-Time Error Dialog describing the error and asking for a user
response. The Ignore statement overrides the default behavior of
ATEasy, allowing the program to handle the error.
When the Ignore statement is executed, ATEasy does not change the
TestStatus to ERR (3) as it does when the Run-Time Error Dialog is
displayed and the Ignore button is selected.
Example
Sub _ErrorProgram
{
TestStatus=ERR
! set teststatus to
error
! display the error
Print "Error "GetErrorNum();" ";GetErrorString()
! resume execution to the next statement
Ignore
}
See Also
_ErrorProgram, Retry
ATEasy® 2.0 Reference Manual
179
_InitProgram (automatic subroutine)
Purpose
Provides user-defined initialization code for an ATEasy program.
Syntax
_InitProgram( )
Parameters
None.
Returns
Nothing.
Comments
This user-defined subroutine is called by ATEasy at the beginning of a
program, before the first Task is executed and after _ResetProgram is
called.
The _InitProgram subroutine may be useful for initializing the system
before testing begins and for customizing the log output.
After the subroutine is returned, ATEasy prints to the Log window the
serial number and the starting time of the UUT being tested.
The GetLogString and SetLogOff functions can be used to change
default Log output.
180
ATEasy® 2.0 Reference Manual
Example
Sub _InitProgram ()
{
SetLogOff()
ClearLog()
! the log window is now empty
Print "Testing UUT :"; GetUUTSerialNum()
}
See Also
_EndProgram, _ResetProgram, Automatic Subroutines
ATEasy® 2.0 Reference Manual
181
_InitTask (automatic subroutine)
Purpose
Provides user-defined initialization code for a Program Task.
Syntax
_InitTask( )
Parameters
None.
Returns
Nothing.
Comments
This user-defined subroutine is called by ATEasy at the beginning of
each Task. After ATEasy calls the subroutine, it outputs to the Log
window a log string that includes the task name and number.
The _InitTask subroutine may be useful for creating a standard initial
system setup for each program's Task. When used, the user may
execute individual Tasks without having to verify the validity of the
current system setup for each Task. This subroutine may also be used
for custom Log formats or to perform any other procedure required by
the application.
See Also
_EndTask, Automatic Subroutines, GetTaskNum
182
ATEasy® 2.0 Reference Manual
_InitTest (automatic subroutine)
Purpose
Provides a user-defined initialization code for a program Test.
Syntax
_InitTest ( )
Parameters
None.
Returns
Nothing.
Comments
For each Test, ATEasy assigns TestStatus to NONE, TestResult to
1.7E+308, and TestRefResult to 0. ATEasy then calls _InitTest (if
defined), and then executes the Test.
See Also
_EndTest, Automatic Subroutines, TestStatus, GetTaskNum,
GetTestNum
ATEasy® 2.0 Reference Manual
Int
183
(function)
Purpose
Truncates a floating-point value to a floating point number representing
the largest integer that is less than or equal to x
Syntax
f = Int ( x )
Parameters
x
VAL Float
Input expression
Float
Result
Returns
f
Comments
When x is negative, this function returns a value less than or equal to x.
Example
f
!
f
!
= Int(123.456)
now f is 123
= Int(-123.456)
now f is -124
See Also
Abs
ATEasy® 2.0 Reference Manual
184
INT_xxx (constants)
Purpose
Interrupt mask constants are defined internally in ATEasy, and are used
in conjunction with EnableInterrupt, DisableInterrupt and
InterruptMask.
Name and Value
Name
x
Value
INT_TIMERx
1-2
26-17
INT_COMx
1-4
18-21
INT_GPIBx
1-2
22-23
INT_USERx
1-8
24-31
Type
Int
Comments
Interrupts are serviced (called) according to their priority number. Lower
values represent higher priorities.
ATEasy® 2.0 Reference Manual
185
The following list explains the use of each INT_xxx constant and the
allowed value of lParam when calling the EnableInterrupt function.
INT_COMx
Interrupt from the COM1-4 port. COM interrupts work
only in Windows 3.1 or above. The lParam must be
0. The interrupt event is for receiving a character.
INT_GPIBx
GPIB interrupts. lParam must be 0, specifying
interrupt on SRQ.
INT_TIMERx
Timer interval interrupts. lParam can be 0-65536
mSec. The minimum resolution is 55mSec (18.2 Hz).
INT_USERx
User-defined interrupts. lParam should be 0. This
interrupt can be invoked only by the program by
setting the corresponding bit in the InterruptMask
variable to 1.
See Also
EnableInterrupt, DisableInterrupt, InterruptMask
ATEasy® 2.0 Reference Manual
186
InterruptMask (internal variable)
Purpose
Provides a bitmask of the current interrupts.
Type
Long
Comments
Each one of the 32 bits represents an interrupt number that is associated
with a pre-defined event. If a bit is '1' and the interrupt number
associated with this bit is enabled, ATEasy will clear the corresponding
bit and immediately call the interrupt subroutine associated with the
interrupt number.
Calling EnableInterrupt clears (sets to 0) the iNum bit in the
InterruptMask variable.
An interrupt can also be invoked by setting the associated bit to 1
within the program. For example, the following command:
InterruptMask=InterruptMask or (1 shl INT_USER1)
sets bit #24 to 1. If this interrupt is enabled, ATEasy immediately calls
the Interrupt subroutine associated with it.
ATEasy enables you to pass this variable pointer (by VAR) to a DLL
sub. If a DLL wants to interrupt ATEasy, it can set the specified bit in
the InterruptMask variable to 1.
It is most advisable to use the INT_xxx constants when using interruptrelated functions or variables. Other values are reserved for future
versions and should not be used.
ATEasy® 2.0 Reference Manual
187
Example
This will clear the INT_USER2 interrupt.
InterruptMask=InterruptMask and not(1 shl INT_USER2)
See Also
EnableInterrupt, DisableInterrupt, INT_xxx constants
ATEasy® 2.0 Reference Manual
188
LCase (function)
Purpose
Converts a string sStr to lower case string s.
Syntax
s = LCase ( sStr )
Parameters
sStr
VAL String[ ]
String to convert
Returns
s
String
A converted String
Comments
This function converts alphabetical characters only. Other characters
are not changed.
Example
Print LCase("Ab12Cd")
! This will print "ab12cd"
See Also
UCase
ATEasy® 2.0 Reference Manual
189
Left (function)
Purpose
Returns the iBytes leftmost characters of the string sStr.
Syntax
s = Left ( sStr, iBytes )
Parameters
sStr
VAL String[ ]
Input string
iBytes
VAL Int
Number of bytes
Returns
s
String
The result string
Comments
If iBytes is greater than the length (not dim) of sStr, the returned string s
will have the same length as sStr. If iBytes is 0 or less than 0, an empty
string is returned.
Example
Print Left("ATEasy", 3)
! This will print "ATE"
See Also
Right, Mid, Len
ATEasy® 2.0 Reference Manual
190
Len (function)
Purpose
Returns the length of the string sStr.
Syntax
i = Len ( sStr )
Parameters
str
VAL String[ ]
Input string
Returns
i
Int
Length of sStr
Comments
This function returns the number of characters in the string sStr. This
number can be equal to or less than the maximum defined bytes for that
string (dimension). Nonprintable characters as well as spaces are
counted.
Example
! s is defined as s:string[256]
s="ATEasy"
Print Len(s)
! this will print 6
See Also
Right, Left, Mid
ATEasy® 2.0 Reference Manual
Log
191
(function)
Purpose
Returns the natural logarithm of x.
Syntax
f = Log (x)
Parameters
x
VAL Float
Input number
Float
Result
Returns
f
Comments
x must be a number greater than zero. Otherwise, the result is unknown.
Example
Print Log(2.718)
! this will print 0.99989...
See Also
Log10, Exp
ATEasy® 2.0 Reference Manual
192
Log10 (function)
Purpose
Returns the base 10 logarithm of x.
Syntax
f = Log10 ( x)
Parameters
x
VAL Float
Input number
Float
Result
Returns
f
Comments
x must be a number greater than zero. Otherwise, the result is unknown.
Example
Print Log10(100)
! This will print 2
See Also
Log, Exp
ATEasy® 2.0 Reference Manual
Loop..Endloop
193
(statement)
Purpose
Executes several statements in an endless loop.
Syntax
Loop
[ statements ]
Endloop
Comments
The statements are executed repeatedly until the control is transferred
outside the Loop statement. Usually the Exitloop is used to terminate the
loop and to transfer control to the next statement.
Example
i=0
Loop
i+i+1
If i =3 Then
i =4
continue
Elseif i=6
Exitloop
Endif
Print i;
Endloop
! This will print 1 2 5
See Also
Statements, Continue, Exitloop, For...Next, While...Endwhile,
Repeat...Until
ATEasy® 2.0 Reference Manual
194
Mid
(function)
Purpose
Returns the iBytes characters of the string sStr, starting from the iStart
character.
Syntax
s = Mid ( sStr, iStart, iBytes )
Parameters
sStr
VAL String[ ]
Input string
iStart
VAL Int
Start position (0 is the first)
iBytes
VAL Int
Number of characters to return
Returns
s
String
Result string
Comments
If iStart plus iBytes is greater then the length of sStr, the returned string
is truncated to the length of sStr. If iStart is greater than or equal to the
length of sStr, then s is returned an empty string.
Example
Print mid("ATEasy", 2, 4)
! This will print "Easy"
See Also
Right, Left, Mid
ATEasy® 2.0 Reference Manual
195
NONE (constant)
Purpose
Used with the TestStatus internal variable.
Value
0
Type
Int
Comments
The TestStatus variable contains the status of the current Test. The
status may be one of the following:
0 - NONE -
No status. This is the default value of
TestsStatus when a Test is initiated.
1 - PASS -
The current Test has passed.
2 - FAIL -
The current Test has failed.
3 - ERR -
An error occurred during the current Test.
The TestStatus variable may be useful for customizing the Log output
or for any other application-oriented requirement.
Example
If TestStatus = NONE then
Print "TestResult was not assigned in this test"
Endif
See Also
TestStatus, _InitTest
ATEasy® 2.0 Reference Manual
196
PASS (constant)
Purpose
Used with the TestStatus internal variable.
Value
1
Type
Int
Comments
The TestStatus variable contains the status of the current Test. The
status may be one of the following:
0 - NONE -
No status. This is the default value of
TestsStatus when a Test is initiated.
1 - PASS -
The current Test has passed.
2 - FAIL -
The current Test has failed.
3 - ERR -
An error occurred during the current Test.
The TestStatus variable may be useful for customizing the Log output
or for any other application-oriented requirement.
Example
If TestStatus <> PASS then
Print "This test is not OK !"
Endif
See Also
TestStatus
ATEasy® 2.0 Reference Manual
197
Pause (statement)
Purpose
Suspends program execution until resumed by the user.
Syntax
Pause
Comments
This statement suspends program execution indefinitely. The user must
select Continue from the ATEasy Control Dialog (or other commands
from the Run menu) in order to resume execution.
Example
If i = 1 Then
Print "Something is wrong !!!"
pause
Endif
See Also
Abort, EnableAbortPause
ATEasy® 2.0 Reference Manual
198
PI (constant)
Purpose
Contains the value of PI.
Value
3.14159265358979
Type
Float
Example
Print Sin ( PI / 2 )
! This will print 1
See Also
Sin, Cos, Tan, ASin, ACos, ATan, SinH, CosH, TanH
ATEasy® 2.0 Reference Manual
199
PortInByte (function)
Purpose
Reads a byte of data from the specified input port.
Syntax
bData = PortInByte ( iPort )
Parameters
iPort
VAL Int
Input port number (address)
Byte
Result byte
Returns
bData
Comments
The function, which may be used to read data from I/O-mapped, PCbased instruments, returns a byte containing the data read from iPort.
iPort can be any number in the range 0x0000 - 0xFFFF.
Example
b = PortInByte(0x311)
! reads a byte from address 0x311 to b
See Also
PortInWord, PortOutByte, PortOutWord
200
ATEasy® 2.0 Reference Manual
PortInWord (function)
Purpose
Reads a word (16 bits) of data from the specified input port.
Syntax
iData = PortInWord ( iPort )
Parameters
iPort
VAL Int
Input port number (address)
Int
Result word
Returns
iData
Comments
The function returns a byte containing the data read from iPort. iPort
can be any number in the range 0x0000 - 0xFFFF. This function may be
used to read data from I/O-mapped, PC-based instruments.
Example
i = PortInByte(0x302)
! reads a word from address 0x302 to i
See Also
PortInByte, PortOutByte, PortOutWord
ATEasy® 2.0 Reference Manual
201
PortOutByte (subroutine)
Purpose
Writes a byte of data to the specified output port.
Syntax
PortOutByte ( iPort , bData)
Parameters
iPort
VAL Int
Output port number (address)
bData
Val Byte
Output byte
Returns
Nothing.
Comments
iPort can be any number in the range 0x0000 - 0xFFFF. This function
may be used to write data to I/O-mapped, PC-based instruments.
Warning: Some I/O ports are reserved for internal computer usage.
Writing to these ports may result in computer lockout or other
undesired consequences.
Example
PortOutByte (0x31F, 0xAA)
! Write 0xAA to address # 0x31F
See Also
PortOutWord, PortInByte, PortInWord
202
ATEasy® 2.0 Reference Manual
PortOutWord (subroutine)
Purpose
Writes a word of data to the specified I/O port.
Syntax
PortOutWord ( iPort , iData)
Parameters
iPort
VAL Int
Address of I/O port (address)
iData
VAL Int
Output data
Returns
Nothing.
Comments
iPort can be any number in the range 0x0000 - 0xFFFF. This function
may be used to write data to I/O-mapped, PC-based instruments.
Warning: Some I/O addresses (ports) are reserved for internal computer
usage. Writing to these ports may result in computer lockout or other
undesired consequences.
Example
PortOutWord (0x310, 0x55AA)
! Write 0x55AA to address 0x310
See Also
PortOutByte, PortInByte, PortInWord
ATEasy® 2.0 Reference Manual
203
Pos (function)
Purpose
Returns the position of a string sSubStr within another string sStr.
Syntax
i = Pos( sSubStr, sStr)
Parameters
sSubStr
VAL String[ ]
The string to look for
sStr
VAL String[ ]
Where to look
Returns
i
Int
Position of str1 in str2
Comments
This function returns the position of the first character of the string
sSubStr within the string sStr starting from 0. If sSubStr is not found,
the function returns -1. The search is case sensitive.
Example
i = Pos("Ea", "ATEasy")
! now i = 2
See Also
Right, Left, Mid, Len
204
ATEasy® 2.0 Reference Manual
Print (statement)
Purpose
Appends expressions converted to strings to the Log window.
Syntax
Print [ Using FormatSpec ; ] [ [ Expression ] [ , ] [ ; ]... ]
Comments
The print statement is used to print text to the Log window.
If the print statement is not ended with a comma (,) or a semicolon (;) the
print position is moved to the beginning of a new line after ATEasy
outputs the string. A new line can also be generated by embedding the
characters \r\n or \n inside a string Expression.
A comma ',' can be used to move the print position to the beginning of
the next Tab, which is the next position that can divided by 8.
A semicolon (';') can be used as a separator between Expressions
without moving the print position.
The Expression can be a string-exp or a simple (not array) numeric-exp.
Each numeric-exp is converted to a string that contains a leading space
if the number is positive and the minus (-) if the number is negative. The
format of a converted numeric-exp to string is the same as the Str
function (with iBase as 10).
The optional Using clause is used to format numeric values. The
sFormatSpec is a string-exp that has the same syntax as the
sFormatSpec used by the Format function. After the semicolon (;) in the
Using clause, only numeric-exps are allowed as Expressions.
ATEasy® 2.0 Reference Manual
Example
Print "ATEasy";
Print " is"; " Easy"
Print 4*5,
Print "ATE"; "Easy"
!This will print:
!ATEasy is Easy
!20 ATEasy
Print using "###.###"; 1.45
Print using "###.###"; -1.45
Print using "###.###"; -99.4523
Print using "###.###"; 2344.9549
Print using "###.###E###"; 2344.9549
!This will print:
! 1.450
! -1.450
!-99.452
! 2344.955
! 23.450E+02
See Also
Chr, Format, Str
205
206
ATEasy® 2.0 Reference Manual
PrintLog (subroutine)
Purpose
Prints the current Log window contents to the currently selected printer.
Syntax
PrintLog ( )
Parameters
None.
Returns
Nothing.
Comments
If a printer was not selected from Print Setup, ATEasy uses the
Windows default printer, which can be selected from Windows Control
Panel.
Example
The following example prints the Log only when the UUT has passed all
tests.
Sub _EndProgram()
{
GetUutStatus(iStatus, iFails, iFlags, fTime)
If iStatus = PASS
PrintLog( )
Endif
}
See Also
SaveLog
ATEasy® 2.0 Reference Manual
207
Randomize (subroutine)
Purpose
Initializes the random number generator to a new sequence of random
numbers.
Syntax
Randomize ( )
Parameters
None.
Returns
Nothing.
Comments
Randomize is required before the calling the Rnd function if a new
sequence (seed) of random numbers is needed.
Example
!Create 1000 random numbers and assign to the array ai
Randomize( )
for i = 1 to 1000
ai [i] = Rnd()
Next
See Also
Rnd
208
ATEasy® 2.0 Reference Manual
Repeat..Until (statement)
Purpose
Executes Statements repeatedly until a specified integer-exp is true
(non-zero).
Syntax
Repeat
Statements
Until integer-exp
Comments
After Statements are executed, the integer-exp is evaluated. If the result
is 0, control is transferred to the statement following the Repeat... Until
statement. Otherwise, the Repeat... Until statement is executed again.
Example
i=0
Repeat
i=i+1
Print i;
Until i > 4
! i is now 5
! This will print 1 2 3 4 5
See Also
Continue, Exitloop, For...Next, Loop...Endloop, While...Endwhile,
Statements, Expressions
ATEasy® 2.0 Reference Manual
209
_ResetDriver (automatic subroutine)
Purpose
Provides a Driver's user-defined code which is called prior to Program
execution or when Reset is selected from the Run menu.
Syntax
_ResetDriver ( )
Parameters
None.
Returns
Nothing.
Comments
This Driver user-defined subroutine is called by ATEasy at the
beginning of a program execution , before the _ResetSystem subroutine
is called. ATEasy will call only _ResetDriver subroutines defined in a
pre-configured driver and according to the order in which these drivers
are defined in the Drivers Setup Dialog.
The _ResetDriver subroutine may be useful to initialize and reset the
driver to a known state when a program is started. The subroutine is
also called if the Reset is selected from the Run menu.
Example
Sub _ResetDriver ()
{
Clear Driver All
}
! open all relays
See Also
Automatic Subroutines, _InitProgram, _ResetDriver, _ResetSystem
210
ATEasy® 2.0 Reference Manual
_ResetProgram (automatic subroutine)
Purpose
Provides a user-defined code which is called prior to program execution
or when Reset is selected from the Run menu.
Syntax
_ResetProgram ( )
Parameters
None.
Returns
Nothing.
Comments
This user-defined subroutine is called by ATEasy at the beginning of a
program, before the _InitProgram subroutine is called, when a program
is started. The subroutine is also called if the Reset is selected from the
Run menu.
The _ResetProgram subroutine may be useful to perform UUT or
Program specific initialization. To initialize Drivers or the System use the
_ResetDriver and the _ResetSystem automatic subroutines.
ATEasy® 2.0 Reference Manual
Example
Sub _ResetProgram ()
{
Set PS1 Voltage (0)
Clear Relay All
}
See Also
Automatic Subroutines, _InitProgram, _ResetDriver, _ResetSystem
211
212
ATEasy® 2.0 Reference Manual
_ResetSystem (automatic subroutine)
Purpose
Provides a System's user-defined code which is called prior to Program
execution or when Reset is selected from the Run menu.
Syntax
_ResetDriver ( )
Parameters
None.
Returns
Nothing.
Comments
This System user-defined subroutine is called by ATEasy at the
beginning of a program execution after all _ResetDriver automatic
subroutine were called. ATEasy will call only _ResetSystem
subroutines defined in the System driver.
The _ResetSystem subroutine may be useful to initialize and reset the
System configured Drivers and The Log window to a known state.
Example
Sub _ResetSystem ()
{
Set PS1 Voltage ( 1)
Clear RELAY All
See Also
Automatic Subroutines, _InitProgram, _ResetDriver, _ResetProgram
ATEasy® 2.0 Reference Manual
213
Retry (statement)
Purpose
Retries a non-fatal run-time (recoverable) error and resumes execution to
the statement that caused the error.
Syntax
Retry
Comments
This statement can be used only after ATEasy calls the _ErrorProgram
automatic subroutine and before returning from this subroutine.
Otherwise, ATEasy ignores the statement.
Normally when a recoverable run-time error occurrs, ATEasy displays
the Run-Time Error Dialog describing the error and asking for the user
response. The Retry statement overrides the default behavior of
ATEasy, allowing the program to handle the error.
Invoking the Retry statement causes ATEasy to re-execute the
offending statement.
Example
The following example allows three retries in a program before it is
aborted.
Sub _ErrorProgram
{
Print "Error has occurred."
Retries=iRetries+1
If iRetries < 3 Then
Print "Trying to retry...”
Retry
Else
Print “Retry has failed. Aborting..."
_ResetProgram()
Abort
Endif
}
214
ATEasy® 2.0 Reference Manual
See Also
GetErrorMsg, GetErrorNum, Run-Time Errors, Abort, Pause, Ignore,
_ErrorProgram
ATEasy® 2.0 Reference Manual
215
Return (statement)
Purpose
Terminates execution of the subroutine in which it appears and returns
control to the statement following the calling statement.
Syntax
Return
Comments
Placing a Return at the end of a subroutine is optional.
Example
Sub CheckStatus ()
{
If iStatus <> PASS Then
sStatus=""
Return
Endif
sStatus=asStatus[iStatus]
}
See Also
Function/Subroutine calls
ATEasy® 2.0 Reference Manual
216
Right (function)
Purpose
Returns the rightmost characters of the string sStr beginning with the
iStart+1 character.
Syntax
s = Right ( sStr, iStart )
Parameters
sStr
VAL String[ ]
Input string
iStart
VAL Int
The starting index
String
The result string
Returns
s
Comments
If iStart is greater than or equal to the length (not dim) of sStr, the
returned string s is an empty string. Otherwise, the returned string
length is equal to the length of sStr minus iStart. If iStart is negative,
then it is considered to be 0.
If the n rightmost characters are required use:
s=Right(sStr, Len(sStr)-n)
Example
Print Right("ATEasy", 2)
! This will print "Easy"
See Also
Left, Mid, Len
ATEasy® 2.0 Reference Manual
217
Rnd (function)
Purpose
Returns a random number between 0 and 32767 (0xFFFF).
Syntax
i = Rnd ( )
Parameters
None.
Returns
i
Int
Random result (0-32767)
Comments
The Randomize subroutine can be used to change the random seed in
order to start a new sequence of random numbers.
Example
ai[ i ] = rnd( )
See Also
Randomize
218
ATEasy® 2.0 Reference Manual
Run (statement)
Purpose
Runs an ATEasy program. The current program is aborted.
Syntax
Run sProgram
Parameters
sProgram
VAL String [ ]
Program filename
Comments
The sProgram specifies a program filename. If sProgram is not in the
path, ATEasy searches for the program in the PRG directory, the default
directory for programs.
If the current program was changed, ATEasy prompts the user to save
changes before exiting. The Run statement does not allow the
_AbortProgram or any other automatic subroutine to be called prior to
current program termination. However, you can call these subroutines
explicitly.
Example
_AbortProgram()
Run "uut1.prg"
See Also
Abort, Exit, WinExec
ATEasy® 2.0 Reference Manual
219
SaveLog (subroutine)
Purpose
Saves the current Log window text to a file.
Syntax
SaveLog ( sFilename )
Parameters
sFilename VAL String[ ]
Filename for log file
Returns
Nothing.
Comments
If the sFilename is given without a directory, the file is saved to
ATEasy's LOG directory. If sFilename is an empty string, ATEasy
prompts the user to specify a filename (similarly to the Save As... option
of the Log menu).
Example
The following example saves the Log to a filename made up from the
serial number entered by the user.
Sub _EndProgram ( )
{
s=GetProgramSerialNum()
SaveLog(Left(s, 8)+".LOG")
}
See Also
PrintLog
ATEasy® 2.0 Reference Manual
220
SDate (function)
Purpose
Returns the current date.
Syntax
s = SDate ( )
Parameters
None.
Returns
s
String
String date
Comments
The date is returned in a string containing 8 characters in the following
format:
mm/dd/yy
Where:
mm =
the current month (two digits)
dd =
the day of the month (two digits)
yy =
the year (two digits)
Example
Print SDate( )
! If the date was December 7, 1991
! this will print 12/07/91
See Also
STime
ATEasy® 2.0 Reference Manual
221
SetLogOff (function)
Purpose
Suspends default logging of test results by ATEasy.
Syntax
iPrvState = SetLogOff ( )
Parameters
Nothing.
Returns
iPrvStates
Int
Log state before calling the function:
TRUE - Log state was On, FALSE for Off
state.
Comments
ATEasy automatically logs test results, as each Test generates output
to the Log window. This automatic result logging may be suspended
using this subroutine and may be resumed later using the SetLogOn
subroutine.
If the test-log format provided by ATEasy is different from the one
required by your application, you may use this subroutine to suspend
the automatic test-log and create a custom format.
Example
The following example empties the log window:
SetLogOff( )
ClearLog( )
See Also
Automatic subroutines, ClearLog, FormnatLogString, Print, SetLogOn
222
ATEasy® 2.0 Reference Manual
SetLogOn (subroutine)
Purpose
Resumes automatic logging of test results by ATEasy after it was
suspended by the SetLogOff subroutine.
Syntax
iPrvStates = SetLogOn ( )
Parameters
None.
Returns
iPrvStates
Int
Log state before calling the function:
TRUE - Log state was On, FALSE for Off
state.
Comments
ATEasy automatically logs test results, as each Test generates output
to Log. The automatic result logging may be suspended using the
SetLogOff subroutine and may be resumed later using this subroutine.
ATEasy® 2.0 Reference Manual
223
Example
The following example uses SetLogOff/On to print only the failed tests.
All the strings here are defined as 512 characters long (the iPrvTable,
iTable, and sTable) should be declared as program variables.
Sub _InitTask ( )
{
! we have no table
iPrvTable=-1
SetLogOn()
}
Sub _EndTask ( )
{
SetLogOn()
}
Sub _EndTest ( )
{
SetLogOff()
s=GetLogString()
! i holds the end of the table
i=Pos("-\r\n", s)
If i >= 0
sTable=Mid(s, 0, I+3)
! the last table header
s=Right(s, I+3)
! the test results
iTable=GetTestType()
! the last test table
type
Endif
If TestStatus > PASS
If iTable <> iPrvTable
Print sTable;
! update the displayed table type
iPrvTable=iTable
Endif
! the test result
Print s;
Endif
}
See Also
Automatic subroutines, SetLogOff
224
ATEasy® 2.0 Reference Manual
SetTestMask (subroutine)
Purpose
Modifies the value of the mask used with the current REF-X or REF-2
test.
Syntax
SetTestMask ( lMask )
Parameters
lMask
VAL Long
New mask data
Returns
Nothing.
Comments
This subroutine may be used to modify the value of the mask as defined
in the Task/Test Summary dialog.The current test type should be REF-2
or REF-X. Otherwise, the function is ignored.
The lMask represents 32 bits that should be compared (1) or ignored (0)
when comparing the result of the Test (TestRefResult) to the reference
value (GetTestRef).
Example
SetTestMask ( lNewMask)
See Also
GetTestMask, GetTestRef, SetTestRef, TestRefResult
ATEasy® 2.0 Reference Manual
SetTestMax (subroutine)
Purpose
Modifies the value of the upper limit (MAX) allowed for the current
MIN-MAX Test.
Syntax
SetTestMax ( fMax )
Parameters
fMax
VAL Float
New upper limit data
Returns
Nothing.
Comments
The MAX value is defined in the Task/Test Summary dialog. The
function temporarily changes this value at run-time.
Example
The following example offsets the Test upper limit according to a
measurement taken.
f = GetTestMax( )
Measure System DMM J1-11 (TestResult)
x = f + TestResult
SetTestMax(x)
See Also
GetTestMax, SetTestMin, GetTestMin, TestResult
225
226
ATEasy® 2.0 Reference Manual
SetTestMin (subroutine)
Purpose
Modifies the value of the lower limit (MIN) allowed for the current MINMAX Test.
Syntax
SetTestMin ( fMin )
Parameters
fMin
VAL Float
New lower limit data
Returns
Nothing.
Comments
The MIN value is defined in the Task/Test Summary dialog. The
function temporarily changes this value at run-time.
Example
The following example offsets the Test lower limit according to a
measurement taken.
f = GetTestMin( )
Measure System DMM J1-11 (TestResult)
x = f + TestResult
SetTestMin(x)
See Also
GetTestMin , SetTestMax, SetTestMax, TestResult
ATEasy® 2.0 Reference Manual
227
SetTestRef (subroutine)
Purpose
Modifies the reference (the required) value for the current REF-2 or REFX Test.
Syntax
SetTestRef ( lRef )
Parameters
lRef
VAL Long
New reference value
Returns
Nothing.
Comments
This function modifies the reference value of the current REF-2 or REFX Test as defined using the Task/Test Summary dialog.
Example
SetTestRef ( lNewRef )
See Also
GetTestMask, SetTestMask, SetTestRef, TestRefResult
ATEasy® 2.0 Reference Manual
228
Sin
(function)
Purpose
Returns the sine of x.
Syntax
f = Sin ( x )
Parameters
x
VAL Float
Input value in radians
Float
Result
Returns
f
Comments
x should be expressed in radians.To convert from degrees to radians,
multiply by PI/180.
Example
f = sin(pi/4)
! now f = 0.7071067811
See Also
PI, Cos, Tan, ASin, ACos, ATan, SinH, CosH, TanH
ATEasy® 2.0 Reference Manual
229
SinH (function)
Purpose
Returns the hyperbolic sine of x.
Syntax
f = SinH ( x )
Parameters
x
VAL Float
Input value in radians
Float
Result
Returns
f
Comments
x should be expressed in radians.To convert from degrees to radians,
multiply by PI/180
Example
f = SinH(pi/4)
! Now f = 0.8686709614
See Also
PI, Sin, Cos, Tan, ASin, ACos, ATan, CosH, TanH
ATEasy® 2.0 Reference Manual
230
Spaces (function)
Purpose
Returns a string of iCount spaces.
Syntax
s = Spaces ( iCount )
Parameters
iCount
VAL Int
Number of spaces
String
Result string
Returns
s
Comments
iCount must be an integer within the range of 0 to 32766.
Example
s = "AT" + spaces(5) + "Easy"
! In this example: s = "AT
See Also
Dupl, Len
Easy"
ATEasy® 2.0 Reference Manual
Sqrt (function)
Purpose
Returns the square root of x.
Syntax
f = Sqrt ( x )
Parameters
x
VAL Float
Input value
Float
Square root of x
Returns
f
Comments
x must be equal to or greater than 0. Otherwise, the result is 0.
Example
f = sqrt(2)
! now f = 1.4142135623
See Also
Abs
231
ATEasy® 2.0 Reference Manual
232
STime (function)
Purpose
Returns the current time.
Syntax
s = STime ( )
Parameters
None.
Returns
s
String
Characters in HH:MM:SS format
Comments
This function returns a string containing 8 characters in the the
following format:
HH:MM:SS
Where:
HH =
the current hour (2 digits)
MM =
the current minute (2 digits)
SS =
the current second (2 digits)
Example
s=STime( )
! if the time 6:24 PM
! s is now 18:24:00
See Also
Delay, SDate, Tick
ATEasy® 2.0 Reference Manual
233
Str (function)
Purpose
Returns the string representation of the value of x based on the
predefined radix iBase.
Syntax
s = Str ( x, iBase )
Parameters
x
VAL Float
Input value
iBase
VAL Int
Radix to use in conversion (2-36 or 0)
String
The converted number
Returns
s
Comments
Str may be used to convert numbers to a string.
The iBase can be a number in the range 2 to 36 or 0. If 0 is used, iBase is
assumed to be 10.
if iBase is 10 and the x is negative, the first character is minus (-).
Otherwise, x is assumed to be unsigned in the range of Long type.
ATEasy® 2.0 Reference Manual
234
Example
i
s
!
i
s
!
f
s
!
= 0xFF
= Str(i, 10)
now s = "255"
= 0xFF
= Str(i, 2)
now s = "11111111"
= -1234E+34
= Str(f, 10)
now s = "-1.234E+34"
See Also
Chr, Val
ATEasy® 2.0 Reference Manual
235
Subroutine Call (statement)
Purpose
Executes statements defined in the subroutine and returns control to the
statement following the subroutine call.
Syntax
[ Owner. ]SubName ( [ Arguments] )
Parameters
Zero or more Arguments separated by commas.
Returns
Nothing.
Comments
ATEasy first evaluates the subroutine arguments and then passes them
to the pre-defined subroutine parameters. After that the control is
transferred to the first statement defined in the subroutine. Upon
termination (return), the control is transferred to the statement following
the subroutine call.
The optional Owner followed by the scope resolution operator (dot) can
be one of the following:
System -
The current system (.CFG)
DriverName -
The driver name defined in Setup Drivers
dialog (.INS).
236
ATEasy® 2.0 Reference Manual
If Owner is not specified, ATEasy searches the SubName in the
following order:
1.
The Current owner where the statement is called.
2.
The System owner, if current owner is Program.
3.
Drivers defined in the same order as configured in the Setup
Drivers dialog.
4.
Internal owner; The predefined subroutines in ATEasy.
Three types of subroutines exist in ATEasy: internal subroutines such
as SetLogOff, which are pre-defined by ATEasy; user-defined
subroutines that are declared by the user and belong to an Owner; and
DLL functions that are defined in the Driver Editor DLL Subroutines
dialog. These subroutines reside in a Windows Dynamic Link Library.
Example
The following examples demonstrate calls to internal subroutines:
SetLogOff( )
Delay(1000)
See Also
Function Call, Statements, Expressions
ATEasy® 2.0 Reference Manual
237
Tan (function)
Purpose
Returns the tangent of x.
Syntax
f = Tan ( x )
Parameters
x
VAL Float
Input value in radians
Float
Result
Returns
f
Comments
x should be expressed in radians.To convert from degrees to radians,
multiply by PI/180.
Example
f = Tan(PI / 3)
! now f = 1.7320508075
See Also
PI, Sin, Cos, ASin, ACos, ATan, SinH, CosH, TanH
ATEasy® 2.0 Reference Manual
238
TanH (function)
Purpose
Returns the hyperbolic tangent of x.
Syntax
f = TanH ( x )
Parameters
x
VAL Float
Input value in radians
Float
Result
Returns
f
Comments
x should be expressed in radians.To convert from degrees to radians,
multiply by PI/180.
Example
f = TanH(PI / 4)
! now f = 0.6557942026
See Also
PI, Sin, Cos, Tan, ASin, ACos, ATan, SinH, CosH
ATEasy® 2.0 Reference Manual
239
Task (statement)
Purpose
Performs an unconditional branch (out of the normal program sequence)
to the specified Task number iTask and to the optional Test number
iTest.
Syntax
Task iTask [, iTest]
Parameters
iTask
VAL Int
Task number
iTest
VAL Int
Test number
Comments
The Task statements performs a branch from the current program
location to the specified Task within the Program. Branching to a Task
will cause ATEasy to execute _InitTask and _InitTest automatic
subroutines (if exist) before executing a Test. If the iTask parameter is
not a valid Task number in the current running program, _EndProgram
is called and the program will be ended. The iTest should be a valid Test
number in the specified Task, otherwise _EndTask will be called and the
specified Task will be ended.
240
ATEasy® 2.0 Reference Manual
Example
The following example transfers control to a Task according to the
sMode variable.
If sMode = "One Station" Then
Task (iStation - 1) * 5 + 8
Elseif sMode = "Run Again" Then
Task 1
Else
Task -1
! end the program
Endif
See Also
Automatic Subroutines, GetProgramTasks, GetTaskTests, GetTaskNum,
GetTestNum, SetProfileNum, Test
ATEasy® 2.0 Reference Manual
241
Test (statement)
Purpose
Performs an unconditional branch (out of the normal program sequence)
to a specified Test iTest in the current running Task.
Syntax
Test iTest
Parameters
iTest
VAL Int
Test number
Comments
The iTest should be a valid Test number in the current Task, otherwise
_EndTask will be called and the current Task will be ended. To branch
to a different Task's Test use the Task statement.
The statement generate a run-time error if no Task is currently running.
e.g. if invoked from _InitProgram.
242
ATEasy® 2.0 Reference Manual
Example
The following example will cause the ATEasy program to retry each
failed Test three times. If the Test continue to fail the Task is
terminated:
Sub _EndTest ()
{
If TestStatus = FAIL
If iRetryCount < 4
iRetryCount = iRetryCount + 1
Test GetTestNum ( )
Else
Test -1
Endif
Else
iRetryCount=0
Endif
}
See Also
Automatic Subroutines, GetTaskTests, Task
ATEasy® 2.0 Reference Manual
243
TestRefResult (internal variable)
Purpose
Contains the result of the current REF-2 or REF-X Test.
Type
Long
Comments
ATEasy zeroes the variable in the beginning of each REF-X or REF-2
Test.
During the Test the TestRefResult should be assigned a value. After
the test is complete, this value is used to determine whether the Test
status (TestStatus) is PASS or FAIL. This is done by comparing the
TestRefResult with the Test mask (GetTestMask) and the Test
reference (GetTestRef).
After the comparison is done, ATEasy calls the _EndTest automatic
subroutine.
Example
The following REF-X Test demonstrates the way ATEasy calculates
TestStatus according to TestRefResult variable.
If TestStatus=NONE
lStatus=TestRefResult xor GetTestRef( )
lStatus=lStatus and GetTestMask()
If lStatus
TestStatus=FAIL
Else
TestStatus=PASS
Endif
Endif
See Also
TestStatus, GetTestRef, GetTestMask, _EndTest
ATEasy® 2.0 Reference Manual
244
TestResult (internal variable)
Purpose
Contains the result of the current MIN-MAX Test.
Type
Float
Comments
ATEasy assigns the variable the value of 1.7E+308 in the beginning of
each MIN-MAX Test.
During the Test the TestResult should be assigned a value. After the
test is complete, this value is used to determine whether the Test status
(TestStatus) is PASS or FAIL. This is done by comparing the
TestResult with the Test lower limit (GetTestMin) and the Test upper
limit (GetTestMax).
After the comparison is done, ATEasy calls the _EndTest automatic
subroutine.
Example
The following MIN-MAX Test demonstrates the way ATEasy
calculates TestStatus according to TestResult variable.
If TestStatus=NONE and TestResult <> 1.7E+308
lStatus=TestResult < GetTestMin( )
lStatus=lStatus or TestResult > GetTestMax()
If lStatus
TestStatus=FAIL
Else
TestStatus=PASS
Endif
Endif
See Also
TestStatus, GetTestMin, GetTestMax, _EndTest
ATEasy® 2.0 Reference Manual
245
TestStatus (internal variable)
Purpose
Contains the status of the current Test.
Type
Float
Comments
The TestStatus can have one of the following values:
0 - NONE -
No status. This is the default value of TestStatus
when a Test is initiated.
1 - PASS -
The current Test has passed.
2 - FAIL -
The current Test has failed.
3 - ERR -
An error occurred during the current Test.
ATEasy assigns the variable the value of NONE in the beginning of
each Test.
If during the Test the value of TestStatus has not been changed by the
program, ATEasy calculates its value before calling the _EndTest
automatic subroutine and the value of PASS or FAIL is assigned.
If a non-fatal error occurred during the Test and the user selected
Ignore in the Run-Time Error Dialog, the TestStatus is assigned the
value of ERR.
246
ATEasy® 2.0 Reference Manual
Example
The following example aborts the program when a Test has failed.
Sub _EndTest ( )
{
If TestStatus <> PASS
Abort
Endif
}
See Also
NONE, PASS, FAIL, ERR, TestResult, TestRefResult, _EndTest
FALSE
ATEasy® 2.0 Reference Manual
247
Tick (function)
Purpose
Returns the number of milliseconds since Windows was started.
Syntax
lTime = Tick ( )
Parameters
None.
Returns
lTime
Long
Time in milliseconds
Comments
The function is accurate to 1ms and can be used to calculate elapsed
time between events.
Example
The following example iterate 2 seconds:
lTime=Tick()
repeat
! do something ...
until Tick()-lTime > 2000
See Also
STime, SDate, Delay
ATEasy® 2.0 Reference Manual
248
TRUE (constant)
Purpose
May be used as a true Boolean (1).
Syntax
TRUE
Value
1
Type
Int
Comments
TRUE is provided for convenience only. Its value ( 1 ) may be used as
well.
Example
If iStatus = FALSE then
! Program statements
Endif
See Also
FALSE
ATEasy® 2.0 Reference Manual
249
UCase (function)
Purpose
Converts the string sStr to upper case string s.
Syntax
s = UCase ( sStr )
Parameters
str
VAL String[ ]
String to convert
String
A converted string
Returns
s
Comments
This function converts alphabetical characters only. Other characters
are not changed.
Example
Print UCase("Ab12Cd")
! This will print "AB12CD"
See Also
LCase
ATEasy® 2.0 Reference Manual
250
VAL (function)
Purpose
Returns the numerical value of a string based on the predefined radix
base.
Syntax
f = Val ( sStr, iBase )
Parameters
sStr
VAL String[ ]
String to convert
iBase
VAL Int
Radix to use in conversion (2-36 or 0)
Float
The converted number
Returns
f
Comments
VAL may be used to convert strings in various radixes to numbers.
If base is 10 the string can have the following format:
[whitespace] [sign] [digits] [.digits] [ e | E][sign]digits]
Where whitespace consists of a space or tab character.
The first character that does not fit this form stops the conversion.
If base is not 10 the string can have the format:
[whitespace] [+ | -] [0 [ x | X ]] [digits]
ATEasy® 2.0 Reference Manual
251
If base is between 2 and 36, then it is used as the base of the number. If
base is 0, the initial characters of the string are used to determine the
base. If the first character is 0 and the second character is not 'x' or 'X',
then the string is interpreted as an octal integer; otherwise, it is
interpreted as a decimal number. If the first character is '0' and the
second character is 'x' or 'X', then the string is interpreted as a
hexadecimal integer. If the first character is '1' through '9', then the string
is interpreted as a decimal integer. The letters 'a' through 'z' (or 'A'
through 'Z') are assigned the values 10 through 35; only letters whose
assigned values are less than base are permitted.
The function returns 0 if no conversion could be performed.
Example
f
!
f
!
f
!
f
!
f
!
i
!
= val("123.456ABc",10)
now f = 123.456
= val("FF", 16)
now f = 255
= val("0xFF", 0)
now f = 255
= val("010", 0)
now f = 8
= val("77", 8)
now f = 63
= val("101", 2)
now i = 5
See Also
Chr, Str
252
ATEasy® 2.0 Reference Manual
VxiClear (function)
Purpose
Sends a Word Serial CLEAR command to the specified message-based
VXI device.
Syntax
iStatus = VxiClear ( iLA )
Parameters
iLA
VAL Int
Device logical address
Int
Status
Returns
iStatus
Comments
The iLA contains the logical address of the device and may be obtained
using the GetDriverAddress function.
If iStatus is negative, an error has occurred. Otherwise, the function is
successful.
Examples
The following command clears the VXI device at logical address 5:
VxiClear(5)
See Also
VxiCommand
ATEasy® 2.0 Reference Manual
253
VxiCommand (function)
Purpose
Sends a Word Serial command to the specified message-based VXI
device.
Syntax
iStatus= VxiCommand ( iLA , iWidth , lCmd , iCmdExt , iMode , lResult)
Parameters
iLA
VAL Int
Device logical address.
iWidth
VAL Int
Specifies the width in bytes of the serial
command:
(2,4,6) = 16, 32, 48 bit commands
lCmd
VAL Long
Lower 32 bits of the command value.
iCmdExt
VAL Int
Upper 16 bits of the command value.
iMode
VAL Int
Response mode:
0 - Do not get response
<> 0 - Get a response.
lResult
VAR Long[ ]
Response value.
Int
Status
Returns
iStatus
254
ATEasy® 2.0 Reference Manual
Comments
VxiCommand is used when special command sequences, which are not
supported by other ATEasy VXI functions, need to be sent to VXI
device(s). Do not use this function to transmit data to devices.
The iLA contains the logical address of the device and may be obtained
using the GetDriverAddress function.
The iWidth parameter is an integer that represents one of the following:
2 Word;16 bit command.
4 Longword; 32 bit command.
6 Extended Longword; 48 bit command.
if iMode is not equal to 0, the function also returns the response in
lResult.
If iStatus is negative, an error has occurred. Otherwise, the function is
successful.
Example
The following command sends the extended longword serial command
0xFFFCFFFDFFFE to a device at logical address 7. The response is
assigned to the variable Resp.
VxiCommand(7, 6, 0xFFFDFFFE, 0xFFFC, 1, Resp)
See Also
VxiClear, VxiTrig
ATEasy® 2.0 Reference Manual
255
VxiGetDevInfoNum (function)
Purpose
Gets information about a specified VXI device from the device
configuration table.
Syntax
iStatus = VxiGetDevInfoNum (iLA, iField, lResult)
Parameters
iLA
VAL Int
Device logical address.
iField
VAL Int
Field number
lResult
VAR Long
The requested field.
Int
Status
Returns
iStatus
Comments
The iLA contains the logical address of the device and may be obtained
using the GetDriverAddress function.
256
ATEasy® 2.0 Reference Manual
The iField specifies the field number in the configuration table as
follows:
2 Commander's logical address.
3 Mainframe.
4 Slot.
5 Manufacturer identification number.
7 Model code.
9 Device class.
10 Extended subclass (if extended class device).
11 Address space used.
12 Base of A24/A32 memory.
13 Size of A24/A32 memory.
14 Memory type and access time.
15 Bit vector list of VXI interrupter lines.
16 Bit vector list of VXI interrupt handler lines.
17 Mainframe extender and controller information.
18 Asynchronous mode control state.
19 Response enable state.
20 Protocols supported.
21 Capability/status flags.
22 Status state (Passed/Failed, Ready/Not Ready)
If iStatus is negative, an error has occurred. Otherwise, the function is
successful.
Example
The following command gets the device class of a device at Logical
Address 27, and the response is assigned to the variable lResult.
VxiGetDevInfoNum (27, 9, lResult)
See Also
VxiGetDevInfoStr
ATEasy® 2.0 Reference Manual
257
VxiGetDevInfoStr (function)
Purpose
Gets information about a specified VXI device from the device
configuration table.
Syntax
iStatus = VxiGetDevInfoStr ( iLA , iField , sResult)
Parameters
iLA
VAL Int
Device logical address.
iField
VAL Int
Field number
sResult
VAR String
The requested field.
Int
Status
Returns
iStatus
Comments
The iLA contains the logical address of the device and may be obtained
using the GetDriverAddress function.
The iField specifies the field number in the configuration table as
follows:
1 Device name.
6 Manufacturer name.
8 Model name.
If iStatus is negative, an error has occurred. Otherwise, the function is
successful.
258
ATEasy® 2.0 Reference Manual
Example
The following loop displays the name of all devices currently
configured.
for iLA=0 to 255
If VxiGetDevInfoStr (iLA, 1, sDevice) < 0
Continue
Endif
print sDevice
Next
See Also
VxiGetDevInfoNum
ATEasy® 2.0 Reference Manual
259
VxiIn (function)
Purpose
Reads data from a specified VXI address with the specified access
mode.
Syntax
iStatus = VxiIn ( iMode , lAddress , iWidth , lResult )
Parameters
iMode
VAL Int
Access mode
lAddress
VAL Long
VXI address within the specified space
iWidth
VAL Int
Width in bytes of response (1, 2 or 4)
lResult
VAR Long
Response value
Int
Status
Returns
iStatus
Comments
This function may be used when a direct read from a VXI bus addresses
is required.
The iMode parameter is specified as follows:
Bits 0,1 - VXI address space:
1 A16.
2 A24.
3 A32.
260
ATEasy® 2.0 Reference Manual
Bits 2,3,4 - Access Privilege:
0 Nonprivileged data access.
1 Supervisory data access.
2 Nonprivileged program access.
3 Supervisory program access.
4 Nonprivileged block access.
5 Supervisory block access.
Bit 7 - Byte Order:
0 Motorola (MSB first).
1 Intel (LSB first).
All other bits should be 0.
If iStatus is negative, an error has occurred. Otherwise, the function is
successful.
Example
The following command reads the ID register of a device at Logical
Address 4, and the response is assigned to the variable lResult:
VxiIn (1, 0xC100, 2, lResult)
See Also
VxiOut, VxiMove
ATEasy® 2.0 Reference Manual
261
VxiInRegister (function)
Purpose
Reads a single word from a specified VXI register offset on the specified
VXI device. The register is read in Motorola byte order (MSB first) and
as nonprivileged data.
Syntax
iStatus = VxiInRegister (iLA , iRegister , iResult )
Parameters
iLA
VAL Int
Device logical address
iRegister
VAL Int
Offset within the device logical address
registers
iResult
VAR Int
Response value
Int
Status
Returns
iStatus
Comments
This function may be used when a direct read from a VXI register is
required. It may be needed when accessing a Register-based device or
other types of devices.
The iLA contains the logical address of the device and may be obtained
using the GetDriverAddress function.
If iStatus is negative, an error has occurred. Otherwise, the function is
successful.
262
ATEasy® 2.0 Reference Manual
Example
The following command reads the ID register of a device at Logical
Address 12, and the response is assigned to the variable iResult:
VxiInRegister (12, 0, iResult)
See Also
VxiOutRegister
ATEasy® 2.0 Reference Manual
263
VxiMove (function)
Purpose
Copies a block of data from a specified source location in any address
space to a specified destination in any address space.
Syntax
iStatus = VxiMove ( iSrcMode , lSrcAddr , iDstMode , lDstAddr,
lLength , iWidth )
Parameters
iSrcMode
VAL Int
Source access mode
lSrcAddr
VAL Long
Source address
iDstMode
VAL Int
Destination access mode
lDstAddr
VAL Long
Destination address
lLength
VAL Long
Number of elements to transfer
iWidth
VAL Int
Width in bytes of elements (1, 2 or 4)
Int
Status
Returns
iStatus
Comments
The function may be used when a direct read and write from a VXI bus
address is required.
264
ATEasy® 2.0 Reference Manual
The iSrcMode and iDstMode parameters are specified as follows:
Bits 0,1 - VXI address space:
1 A16.
2 A24.
3 A32.
Bits 2,3,4 - Access Privilege:
0 Nonprivileged data access.
1 Supervisory data access.
2 Nonprivileged program access.
3 Supervisory program access.
4 Nonprivileged block access.
5 Supervisory block access.
Bit 7 - Byte Order:
0 Motorola (MSB first).
1 Intel (LSB first).
All other bits should be 0.
If iStatus is negative, an error has occurred. Otherwise, the function is
successful.
Example
The following command moves 2KB from A24 space at 0x300000 to A16
space at 0xC800. The tranfer is word wide, nonprivileged data in
Motorola byte order:
VxiMove (2, 0x300000, 1, 0xC800, 0x800, 2)
See Also
VxiIn, VxiOut
ATEasy® 2.0 Reference Manual
265
VxiOut (function)
Purpose
Reads data to a specified VXI address with the specified access mode.
Syntax
iStatus = VxiOut ( iMode , lAddress , iWidth , lData )
Parameters
Mode
VAL Int
Source access mode
lAddress
VAL Long
Source address
iWidth
VAL Int
Width in bytes of data
lData
VAL Long
Data value to write
Int
Status
Returns
iStatus
Comments
The function may be used when a direct write to VXI bus addresses is
required.
266
ATEasy® 2.0 Reference Manual
The iMode parameter is specified as follows:
Bits 0,1 - VXI address space:
1 A16.
2 A24.
3 A32.
Bits 2,3,4 - Access Privilege:
0 Nonprivileged data access.
1 Supervisory data access.
2 Nonprivileged program access.
3 Supervisory program access.
4 Nonprivileged block access.
5 Supervisory block access.
Bit 7 - Byte Order:
0 Motorola (MSB first).
1 Intel (LSB first).
All other bits should be 0.
If iStatus is negative, an error has occurred. Otherwise, the function is
successful.
Example
The following command writes the data 0xA800 to the offset register of
a device at Logical Address 4:
VxiOut (1, 0xC10A, 2, 0xA800)
See Also
VxiIn, VxiMove
ATEasy® 2.0 Reference Manual
267
VxiOutRegister (function)
Purpose
Writes a single word to a specified VXI register offset on the specified
VXI device. The register is written in Motorola byte order (MSB first)
and as nonprivileged data.
Syntax
iStatus = VxiOutRegister ( iLA , iRegister , iData )
Parameters
iLA
VAL Int
Device logical address.
iRegister
VAL Int
Offset within VXI logical address
registers.
iData
VAL Int
Data value to write.
Int
Status
Returns
iStatus
Comments
The function may be used when a direct write from a VXI register is
required. This may be needed when accessing Register based device or
other types of devices.
The iLA contains the logical address of the device and may be obtained
using the GetDriverAddress function.
If iStatus is negative, an error has occurred. Otherwise, the function is
successful.
268
ATEasy® 2.0 Reference Manual
Example
The following command writes the data 0xFF01 to the signal register of a
device at Logical Address 19:
VxiOutRegister (19, 8, 0xFF01)
See Also
VxiInRegister
ATEasy® 2.0 Reference Manual
269
VxiReceive (function)
Purpose
Reads a string of data bytes from a specified VXI Message Based
device.
Syntax
iStatus = VxiReceive ( iLA , sEOS , iEND, iTimeout , iMode, sStr ,
iBytes)
Parameters
iLA
VAL Int
Device logical address
sEOS
VAL String[ ]
End of sequence string
iEND
VAL Int
Terminate on END bit
iTimeout
VAL Int
Timeout in milliseconds
iMode
VAL Int
Mode of operation
sStr
VAR String[ ]
Receive data buffer
iBytes
VAL Int
Maximum bytes to receive
Returns
iStatus
Int
Bytes actually received
Comments
The iLA contains the logical address of the device and may be obtained
using the GetDriverAddress function.
The sEOS can be 0-2 bytes long and specifies the data bytes that signal
the end of data (terminator).
The iEND can be 1 for terminating the transmission upon END bit, or 0
if the END bit is ignored (similar to GPIB EOI).
270
ATEasy® 2.0 Reference Manual
The iMode specifies the conditions of receipt:
0 Abort if not DOR (Data out Ready)
1 Poll until DOR bit is on within the specified timeout iTimeout.
This function returns the number of bytes received. A value of -1
indicates failure.
Example
The following command reads up to 20 data bytes from a device at
logical address 19 and assigns the data to the variable sData. The
terminator used is Line Feed, END is enabled, and timeout is set to 1500
mSec:
VxiReceive(19, "\n", 1, 1500, 1, sData, 20)
See Also
VxiSend
ATEasy® 2.0 Reference Manual
271
VxiSend (function)
Purpose
Sends a string of data bytes to a specified VXI Message Based device.
Syntax
iStatus = VxiSend ( iLA , sEOS , iEND, iTimeout , sStr , iBytes )
Parameters
iLA
VAL Int
Device logical address
sEOS
VAL String[ ]
End of sequence string
iEND
VAL Int
Terminate on END bit
iTimeout
VAL Int
Timeout in milliseconds
sStr
VAR String
Receive data buffer
iBytes
VAL Int
Number of bytes to transmit
Returns
iStatus
Int
Bytes actually sent
Comments
The iLA contains the logical address of the device and may be obtained
using the GetDriverAddress function.
The sEOS can be 0-2 bytes long. It specifies the data bytes that signal
the end of data (terminator).
The iEND can be 1 for terminating the transmission upon END bit, or 0
if the END bit is ignored (similar to GPIB EOI).
This function returns the number of bytes sent, a value of -1 indicates
failure.
272
ATEasy® 2.0 Reference Manual
Example
The following command sends the string "F1G2" to a device at logical
address 19. The terminator used is Line Feed, EOI is enabled, and
timeout is set to 150 mSec:
VxiSend(19, "\n", 1, 150, "F1G2", 6)
See Also
VxiInRecieve
ATEasy® 2.0 Reference Manual
273
VxiTrig (function)
Purpose
Sends a Word Serial TRIGGER command to the specified Message
Based VXI device.
Syntax
iStatus = VxiTrig ( iLA )
Parameters
iLA
VAL Int
Device logical address.
Int
Status
Returns
iStatus
Comments
The iLA contains the logical address of the device and may be obtained
using the GetDriverAddress function.
If iStatus is negative, an error has occurred. Otherwise, the function is
successful.
Example
The following command triggers the VXI device at logical address 5:
VxiTrig(5)
See Also
VxiCommand
274
ATEasy® 2.0 Reference Manual
While..Endwhile
(statement)
Purpose
Execute Statements repeatedly while the specified integer-exp is true
(non-zero).
Syntax
While integer-exp [Do]
Statements
Endwhile
Comments
ATEasy first evaluates the integer-exp. If the result is zero, the control
is transferred to the statement that follows the Endwhile. Otherwise,
Statements are executed and the While...Endwhile statement is executed
again. The DO statement is optional.
Example
i=0
While i < 2
i=i+1
Print i;
EndWhile
! i is now 2
! This will print 1 2
See Also
Continue, Exitloop, For...Next, Loop...Endloop, Repeat..Until,
Statements, Expressions
ATEasy® 2.0 Reference Manual
275
WinExec (function)
Purpose
Runs the specified application.
Syntax
iStatus = WinExec ( sCmdLine , iCmdShow )
Parameters
sCmdline
VAL String[ ]
Command line to hold path or executable
filename and optional parameters
iCmdshow
VAL Int
Initial window state of the window
Returns
iStatus
Int
Status
Comments
The WinExec function is used to execute a Windows or DOS (nonWindows) application.
If the sCmdLine contains an application filename that does not contain
a path, Windows searches the directories in the following order:
1.
2.
3.
4.
5.
The current directory.
The Windows directory (containing WIN.COM).
The Windows SYSTEM sub-directory.
The directories listed in the PATH statement.
The list of directories mapped in a network.
276
ATEasy® 2.0 Reference Manual
The iCmdShow specifies how the Windows application to be shown
this can be one of the followings:
0. (HIDE) - Hides the window and passes activation to another
window.
1. (SHOW NORMAL) - Activates and displays a window. If the
window is minimized or maximized, Windows restores it to its
original size and position.
2. (SHOW MINIMIZED) - Activates the window and displays it
as an icon.
3. (SHOW MAXIMIZED) - Activates the window and displays it
as a maximized window (full window).
4. (SHOW NO ACTIVATE) - Displays the window in its most
recent size and position. The currently active window remains
active.
5. (SHOW) - Activates the window and displays it in its current
size and position.
6. (MINIMIZE) - Minimizes the specified window and activates
the top-level window in the window- manager's list.
7. (SHOW MINIMIZED NO ACTIVATE) - Displays the window
as an icon. The currently active window remains active.
8. SHOW NA) - Displays the window in its current state. The
currently active window remains active.
For a non-Windows application, the PIF file, if used, determines the
state of the application.
If the returned iStatus is less than 32, an error occurred. The error can be
one of the following:
0. Not enough memory to run application.
1. File not found.
2. Path not found.
5. Attempt to dynamically link to a task.
6. Library requires separate data segments for each task.
10. Incorrect Windows version.
11. Invalid EXE file (non-windows EXE or error in EXE image).
12. O/S 2 application.
13. DOS 4.0 application.
14. Unknown EXE type.
15. Attempt to load an EXE file created for earlier versions of
Windows in the protected mode (Standard or 386 Enhanced).
ATEasy® 2.0 Reference Manual
277
16. Attempt to load a second instance of an EXE file containing
multiple, writeable data segments.
17. Attempt to load a second instance of an application that links
to certain non-shareable DLLs already in use (in large-frame
EMS mode).
18. Attempt to load an application marked for protected mode only
while in Real mode.
Example
i = WinExec("notepad c:\\ATEasy\\readme.1st", 4)
If i < 32 then
Print "Error while executing notepad.."
Endif
See Also
Run
278
ATEasy® 2.0 Reference Manual
Index
—_—
_AbortProgram (automatic
subroutine), 25
_EndProgram (automatic
subroutine), 62
_EndTask (automatic
subroutine), 64
_EndTest (automatic
subroutine), 65
_ErrorProgram (automatic
subroutine), 68
_InitProgram (automatic
subroutine), 178
_InitTask (automatic
subroutine), 180
_InitTest (automatic
subroutine), 181
_ResetDriver (automatic
subroutine), 208
_ResetProgram (automatic
subroutine), 209
_ResetSystem (automatic
subroutine), 211
—A—
Abort (statement), 24
Abs (function), 26
ACos (function), 27
ASin (function), 28
Assignment (statement), 29
ATan (function), 30
Automatic Subroutines, 11
—C—
CalcChecksum (function), 31
Chr (function), 33
ClearLog (subroutine), 34
ComClose (function), 35
ComFlush (function), 36
Command (statement), 37
Comment (statement), 39
ComOpen (function), 40
ComReceive (function), 41
ComSend (function), 43
ComSetup (function), 45
Constants, 8
Continue (statement), 47
Cos (function), 48
CosH (function), 49
—D—
Data Types, 5
DDE Functions, 13
DdeExecute (function), 50
DdeInitiate (function), 51
DdePoke (function), 52
DdeRequest (function), 53
DdeTerminate (function), 54
DdeTimeout (function), 55
Delay (subroutine), 56
DisableInterrupt (function), 57
Drivers Information Functions,
12
Dupl (function), 58
Dynamic Data Exchange, 13
—E—
EnableAbortPause (function),
59
EnableInterrupt (function), 60
ERR (constant), 67
Exit (statement), 70
Exitloop (statement), 71
ExitTask (statement), 72
ExitTest (statement), 73
Exp (function), 74
Expressions, 3
—F—
FAIL (constant), 75
FALSE (constant), 76
File I/O Functions, 14
FileClose (function), 77
FileCreate (function), 78
FileEOF (function), 80
FileFind ( function ), 82
FileOpen (function), 84
FilePrint (function), 86
FileRead (function), 87
FileRemove (function), 89
FileRename (function), 90
FileSeek (function), 92
FileTell (function), 94
FileWrite (function), 95
Floating-Point Literals, 9
For..Next (statement), 96
Format ( function ), 98
FormatLogString (function), 171
Function Call (statement), 100
Functions, 12
—G—
GetDir (function), 102
GetDriverAddress (function),
104
GetDriverModule (function),
106
GetDriverName (function), 108
GetDriverType (function), 110
GetErrorMsg (function), 111
GetErrorNum (function), 113
GetLogString (function), 115
GetProfileName (function), 117
GetProfileNum (function), 118
GetProgramLastUpdate
(function), 119
GetProgramName (function),
120
GetProgramSerialNum
(function), 121
GetProgramTasks (function),
122
GetProgramUut (function), 123
GetProgramVersion (function),
124
GetTaskName (function), 125
GetTaskNum (function), 126
GetTaskTest (function), 127
GetTestMask (function), 128
GetTestMax (function), 129
GetTestMin (function), 130
GetTestName (function), 131
GetTestNum (function), 133
GetTestPin (function), 134
GetTestRef (function), 135
GetTestType (function), 136
GetTestUnit (function), 138
GetUserLevel (function), 139
GetUserName (function), 140
GetUutStatus (subroutine), 141
Global Variables, 7
Goto (statement), 143
GPIB Functions, 15
GpibClear (function), 144
GpibCommands (function), 146
GpibIFC (function), 148
GpibLLockout (function), 149
GpibLocal (function), 151
GpibPPoll (function), 153
GpibPPollC (function), 155
GpibPPollU (function), 157
GpibReceive (function), 159
GpibRemote (function), 161
GpibSend (function), 163
GpibSpl (function), 165
GpibStatus (function), 167
GpibTrig (function), 169
—I—
If..Then (statement), 175
Ignore (statement), 177
Int (function), 182
INT_xxx (constants), 183
Integer Literals, 8
Internal Constants, 10
Internal Variables, 10
Interrupt Functions, 16
InterruptMask (internal
variable), 185
—L—
Language Elements, 1
LCase (function), 187
Left (function), 188
Len (function), 189
Literals, 8
Local Variables, 7
Log (function), 190
Log File / Information
Functions, 17
Log10 (function), 191
Loop..Endloop (statement), 192
—M—
Math Functions, 19
Mid (function), 193
Miscellaneous Functions, 23
—N—
NONE (constant), 194
—P—
PASS (constant), 195
Pause (statement), 196
PC Ports / COM Functions, 20
PI (constant), 197
PortInByte (function), 198
PortInWord (function), 199
PortOutByte (subroutine), 200
PortOutWord (subroutine), 201
Pos (function), 202
Print (statement), 203
PrintLog (subroutine), 205
—R—
Randomize (subroutine), 206
Repeat..Until (statement), 207
Retry (statement), 212
Return (statement), 214
Right (function), 215
Rnd (function), 216
Run (statement), 217
—S—
SaveLog (subroutine), 218
SDate (function), 219
SetLogOff (function), 220
SetLogOn (subroutine), 221
SetTestMask (subroutine), 223
SetTestMax (subroutine), 224
SetTestMin (subroutine), 225
SetTestRef (subroutine), 226
Sin (function), 227
SinH (function), 228
Spaces (function), 229
Sqrt (function), 230
Statements, 2
STime (function), 231
Str (function), 232
String Functions, 21
String Literals, 9
Subroutine Call (statement), 234
—T—
Tan (function), 236
TanH (function), 237
Task (statement), 238
Test (statement), 240
TestRefResult (internal
variable), 242
TestResult (internal variable),
243
TestStatus (internal variable),
244
Tick (function), 246
TRUE (constant), 247
—U—
UCase (function), 248
VxiClear (function), 251
VxiCommand (function), 252
VxiGetDevInfoNum (function),
254
VxiGetDevInfoStr (function),
256
VxiIn (function), 258
VxiInRegister (function), 260
VxiMove (function), 262
VxiOut (function), 264
VxiOutRegister (function), 266
VxiReceive (function), 268
VxiSend (function), 270
VxiTrig (function), 272
—V—
VAL (function), 249
Variable Owners, 6
Variables, 6
Variables’ Hierarchy, 7
VXI Functions, 22
—W—
While..Endwhile (statement),
273
WinExec (function), 274