0% found this document useful (0 votes)
302 views129 pages

Easy-Wire Scripting Manual.2017.4.0

CIRRIS easy-wire Scripting Manual

Uploaded by

TOPOTRONIK
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
302 views129 pages

Easy-Wire Scripting Manual.2017.4.0

CIRRIS easy-wire Scripting Manual

Uploaded by

TOPOTRONIK
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 129

easy-wire Scripting Manual

Version 2017.4.0
easy-wire Scripting Manual
Copyright Cirris Systems Corporation
401 North 5600 West
Salt Lake City, Utah 84116
U.S.A.

II
Introduction 1
What is easy-wire scripting? ........................................................................................... 1
Enabling Scripting........................................................................................................... 2
Getting a Script ............................................................................................................... 3
Different kinds of scripts ................................................................................................. 4
LUA Test Event Scripts 5
Overview ....................................................................................................................... 5
Required Syntax for a LUA Test Event Script ................................................................. 6
Selecting the LUA Test Event Script for a Test Program................................................. 7
EVT Test Event Scripts 8
Overview ....................................................................................................................... 8
Required Syntax for an EVT Test Event Script ............................................................... 9
Selecting the EVT Test Event Script for a Test Program............................................... 10
Parameter Types and Values ....................................................................................... 12
Component Scripts 13
Overview ...................................................................................................................... 13
Component Script Syntax ............................................................................................. 14
Parameter Types and Values ....................................................................................... 15
More Component Script Examples ............................................................................... 15
Inserting a LUA Component into a Test Program.......................................................... 16
Custom Report Scripts 18
Overview ...................................................................................................................... 18
Setting up a Custom Report Script ............................................................................... 18
Custom Report Syntax.................................................................................................. 19
Custom Script Example ................................................................................................ 19
Easy Touch Embedded Blocks 20
Who Should Read this Section ..................................................................................... 20
How Embedded Blocks are Implemented ..................................................................... 21
Script Errors & Debugging 34
Common Script Errors .................................................................................................. 34
Debugging Methods ..................................................................................................... 35
Cirris Functions 36
Cirris functions organized by category .......................................................................... 36
Cirris Functions organized alphabetically ...................................................................... 38
Date and Time Functions.............................................................................................. 40
Digital Input and Output Functions ................................................................................ 43
File Functions ............................................................................................................... 55
Low Level Function....................................................................................................... 59
Measurement and Test Functions ................................................................................ 68
Printer Functions .......................................................................................................... 87
Tester Information Functions ........................................................................................ 91
Test Information Functions ........................................................................................... 94
User Interface Functions............................................................................................. 104
1100 Embedded File Functions .................................................................................. 111
Preserved Lua 3.2 Functions ...................................................................................... 119
Unsupported Cirris Functions ..................................................................................... 120
Index 121

ii
You may download example scripts files and a PDF
version of this manual from the Cirris Community
Forum.
To do this:
1. In your web browser, type in the URL https://community.cirris.com.
2. Click Downloads on the top menu bar.
3. Click Documentation under Download Categories.
4. Find the downloads Search box in the upper right corner of the download page. In
this box type Easy Touch Scripting.
5. Click on either the Easy Touch Scripting manual or examples.
6. Click Download.

iii
Introduction
What is easy-wire scripting?

You can use easy-wire scripting on the Cirris Easy Touch, CR, and CH2 testers, all of
which use the Cirris easy-wire software. You can also use easy-wire scripting on a Cirris
1100 tester that is controlled by a PC running the Cirris easy-wire software. An easy-wire
script will typically not run on an independent 1100 Tester, or on a Cirris Touch1 tester. A
Cirris scripting language with some different commands is used for these applications.

By using scripting you can make the tester extremely flexible and customize a test process
to fit a unique task. The following list gives examples for using scripts:

• Create complex tests that are easy for line workers to use.
• Make highly customized reports or cable tags.
• Control external devices such as lamps, hold-down clamps, markers, etc.
• Test devices such as switches, gas fuses, zener diodes, bi-color diodes, etc.
• Verify color and lighting of LED’s.
• Display prompt messages.
• Hipot different nets at different voltages.

Easy-wire scripting is written in the Lua programming environment. Lua is a free


programming language often used to control factory equipment. In addition to the
standard Lua programming commands, Cirris has added its own programming commands
to Easy-wire scripting to provide the tools needed to control the Cirris cable tester. This
manual documents these tools. In addition to this Easy-wire Scripting Manual, use the Lua
5.1 Reference Manual, which documents all of the general Lua programming commands.
You can find the Lua 5.1 Reference Manual at www.lua.org.

1
Introduction

Enabling Scripting
Scripting must be enabled before you run a script file on your tester. If scripting was
ordered with your tester, the scripting option should be checked on the tester’s options
label. You can find this label on the top front corner on the left side of the tester. If you are
enabling this option in the field, use a marker to check this label when Scripting has been
enabled.

To enable scripting in the easy-wire software:


1. From the easy-wire main menu, select Utilities.
2. In the System Utilities box select Setup System Options.
3. Under the Tester Hardware tab, select Enable Features.
4. If enabled, scripting should be displayed in the installed features list as shown below. If
not enabled, enter the Feature Key Code received from Cirris, and press Install the
Feature.

If you are using an 1100 series tester, PC Control must also be enabled in the above
Enabled Features window.

2
Introduction

Getting a Script
Writing scripts can be challenging. You may choose to have Cirris write a script for you,
or modify an existing script for your application. For those who choose to write their own
scripts, having an aptitude for programming and previous programming experience is
highly recommended. You may download example scripts files from the Cirris
community forum. See the page after the table of contents for instructions on
downloading these examples.

Scripts are ASCII text files. You can write or modify a script using a text editor or a word
processor running in text mode. Many programmers prefer to use a text editor that is
optimized for the programming environment Notepad++ is a popular editing program
that can be downloaded for free. If using Notepad++, make sure to set the language
option to Lua for better programming clarity.

Whenever you are about to make major modifications to a script that has been
functioning, make sure to make a copy of the script to preserve the original file. When
developing a script, being able to quickly make and try script changes is critical. To this
end you may find it helpful to attach a keyboard to the Easy Touch tester to edit a script.
You may also store script files on a network where they can be accessed by the tester
and your programming station. When using easy-wire software to control an 1100
tester, you may copy the script files to any drive and directory that is accessible to the
PC running the easy-wire software.

3
Introduction

Different kinds of scripts


There are different kinds of scripts. The kind of script you use depends on the application,
and when the script executes. Each kind of script has a unique syntax and file extension
requirement. The kinds of scripts are summarized below and then treated in detail in the
following pages.

Test Event Scripts


Test Event Scripts execute when certain events happen during a test. A test event script
does not cause a test to pass or fail. One Test Event Script can be assigned to a test
program. There are two kinds of Test Event Scripts: “LUA” and “EVT.” Each of these Test
Event Scripts have different syntax requirements and file extensions. EVT scripts have
been developed more recently, and have the added flexibility of using parameters that can
be easily modified in the tester’s user interface.

Component Scripts
You can attach one component script to test program. However, the component script file
can have one or more custom components. After attaching the component script file to a
test, you can add its custom to the test in manner similar to how you can add test
instructions. Like test instructions, custom components must be correctly completed for a
test to pass. Therefore, a component script differs from other script types in that it can
cause the test to fail. Creating a custom component script can allow you to test standard
components to higher level or test electrical components and conditions that differ from
standard components.

Custom Report Scripts


The easy-wire software that controls the Easy Touch tester uses makes it easy to
customize and print a broad range of report and label options. However, sometimes even
this broad range of options may not be suitable. Custom report scripts give you full control
over the content, format and presentation of the printed documentation. Note that the
easy-wire reporting allows you to turn reporting on or off, or configure it differently for
different test programs. On the other hand, a custom report script can run each time a test
fails, each time a test passes, or after every test. If you need a custom report script for
select test programs, you can use a test event script for a custom report application.

4
LUA Test Event Scripts
Overview
A LUA Test Event Script is executed when one or more test events occur during the test
process. The easy-wire software uses a value to represent each of these events. When the
event occurs, the script passes the value to the script. The test events and their values are
shown in the table below.
value LUA test event
1 The first test event occurs when the test program is loaded.
2 The second test event occurs when the low voltage test begins. The low voltage
test is the first test that is performed on a cable and always occurs.

If the Test Method is set to Signature Continuous Test, the low voltage test
starts when the operator attaches a cable assembly.
- OR -
If the Test Method is set to Signature Single Test, the low voltage test starts
when the operator presses Start in the Test Window.
3 The third test event occurs at the end of all tests on a cable. This includes the
low voltage test, and if selected, the high voltage and intermittents test.

If the Test Method is set to Signature Continuous Test, the end of all tests
happens when the cable assembly is removed.
- OR -
If Test Method is set for Signature Single Test mode, the end of the test
happens when the low voltage, and if selected, high voltage test are completed.

A LUA Test Event Script says in essence, “When a test event happens, do the following thing
or things.” A LUA Test Event Script will not cause the test to pass or fail. If you want to test
custom electrical characteristics of a circuit, you should use a component (CMP) script
instead. Unlike CMP and EVT scripts, LUA Test Event Scripts accept no parameters.
Parameters allow you store values for the script, which can then be changed in the test setup
without modifying the script.

You can assign one test event script to a test program. A LUA Test Event Script must end
with a .lua file extension and must include the required syntax as shown in the following
section.

5
Lua Test Event Scripts

Required Syntax for a LUA Test Event Script


Every LUA Test Event Script must start by defining the function DoOnTestEvent. All other
functions in the script are called from the DoOnTestEvent function.
function DoOnTestEvent (event)
if event == eventnumber then
.
.
.
All other function calls
.
.
.
end
end
Note, a function definition must always end with an end statement. The easy-wire software
passes the value of event to the script when the LUA test events occur. See the table of LUA
test events and their values on the previous page.

Examples of a LUA Test Event Syntax


Here’s a short LUA test event script that brings up a window to congratulate the operator upon
loading the test program.
function DoOnTestEvent(iwhen)
if iwhen == 1 then
MessageBox(“Good job loading the test program”)
end
end

Here’s a slightly longer LUA test event script that congratulates the operator at all three test
events.
function DoOnTestEvent(iwhen)
if iwhen == 1 then
MessageBox(“Good job loading the test program”)
end
if iwhen == 2 then
MessageBox(“Good job starting the test”)
end
if iwhen == 3 then
MessageBox(“Good job completing the test”)
end
end

6
LUA Test Event Scripts

Selecting the LUA Test Event Script for a Test Program


You can select one Test Event Script for a test program. Before selecting the Test Event
Script, create the test program just as you would any other test program. To select a LUA
Test Event Script for a test program:

1. Edit the Test Program. In the test editor press the Set Test Defaults tab.
2. Press Select Test Event Script.
3. Press the Attach button. Remember, a LUA Test Event Script must have a .lua file
extension.

The script will load. Applicable error messages will be displayed.

4. Note: With Enable Script Changed Warnings selected in the window above, you will not
be able to load the Test Program using the script if the script changes. Instead a warning
window will be displayed. After you are through making frequent changes to a script, you
can use this selection to help ensure the integrity of the test event script used by the test
program.

5. Press OK.

7
EVT Test Event Scripts
Overview
An EVT Test Event Script can execute upon the test events shown in the table below. Each
event has an associated value. The easy-wire software passes this value to the script when
each of these events occurs.

Value EVT Test Event


1 The first test event begins when the test window is initially entered. The test
window is entered after the operator selects a test and presses Test in the
main menu.
2 The second test event occurs when the low voltage test begins. The low
voltage test is the first test that is performed on a cable and always occurs.

If the Test Method is set to Signature Continuous Test, the low voltage test
starts when the operator attaches a cable assembly.
- OR -
If the Test Method is set to Signature Single Test, the low voltage test starts
when the operator presses Start in the Test Window.
3 The third test event occurs at the end of all tests on a cable. This includes the
low voltage test, and if selected, the high voltage and intermittents test.

If the Test Method is set to Signature Continuous Test, the end of all tests
happens when the cable assembly is removed.
- OR -
If Test Method is set for Signature Single Test mode, the end of the test
happens when the low voltage, and if selected, high voltage complete.
4 The forth test event occurs when the test window is open and the test is
waiting to start. Note that this test event happens before each test cycle.
5 When the operator exits the Test Window to return to the main menu.

Unlike a LUA Test Event Script, an EVT Test Event Script accepts test parameters. The test
parameters are values that are passed to the script, but can be easily changed in the easy-
wire software’s test editor. This also allows you to use the same EVT test event script in
different test programs, but use different parameter values for each program as needed. For
more information on parameter types see page 12.

There can be only one LUA or EVT Test Event Script used in a test program. If using parent
child test programs, only the parent test program can use a test event script.

An EVT Test Event Script must end with an .evt extension and have the required syntax as
described as follows.
8
EVT Test Event Scripts

Required Syntax for an EVT Test Event Script


Every EVT script must have the following syntax.
Use this line to begin to begin
the EVT Script.
evtEvent = {}
evtEvent.description = “description” Record a brief script description
evtEvent.params = { or title for the script. Always
enclose the description in quotes.
{“param1name”, “param1type”, param1value},
{“param2name”, “param2type”, param2value}, Parameters, if used in the script,
. must be defined here. Optional
. syntax is shown in grey.
.
{“paramNname”, “paramNtype”, paramNvalue} Note, there is no coma after the
last parameter definition.
}
function evtEvent.DoIt (event, “param1”, “param2”… )
if event == value then
The function evtEvent.DoIt must be
.
defined. The easy-wire software will pass
. an integer value to event depending on
. the test event. Parameters, if used, are
All other function calls listed and correspond respectively to the
. previous parameters definitions.
.
. An if-then statement is used to start the
end function calls upon a test event. EVT Test
end Events values are listed the table on page
5. The if-then statement ends with end.
The function definition must end with end.

Example of an EVT Test Event Syntax


Here is a short EVT Script that would greet the operator, Bob, when he loads a test.
evtEvent = {}
evtEvent.description = "Greet the operator"
evtEvent.params = {
{"greeting", "string", "Hello Bob"}
} sgreeting corresponds to parameter with
function evtEvent.DoIt(ievent,sgreeting) the name greeting defined above.
if ievent == 1 then When the operator loads the test, a 1 will
MessageBox(sgreeting)
be passed to ievent.
end
end
In this case the default value for the parameter greeting is Hello Bob. Maybe after several
months of using this script, Jane is the new operator. The default value, Hello Bob, can easily
be changed without modifying the script. Instead, the easy-wire Test Editor can be used to
change the parameter value in the test program as shown in the next section.

9
EVT Test Event Scripts

Selecting the EVT Test Event Script for a Test Program

1. Edit the Test Program. In the test editor click the Set Test Defaults tab.
2. Press Select Test Event Script.
3. Press the Attach button. Remember, an EVT Test Event Script must have a .evt extention.

4. Select the script and press Open. Applicable error messages will be displayed. When the
script successfully loads the parameter editor will open. If Hello Bob were used for the
greeting parameter as in the preceding example, you would see the value as shown.

greeting

5. If desired, you could change “Hello Bob”. When you are satisfied with the value, press OK.
The value will be used whenever the test is used. It is also possible for no default value to
be used in the parameter definition. If no parameter is displayed, always enter a value
before pressing OK.

10
EVT Test Event Scripts

At any time you can change the value of the parameter by returning to the Select Test Event
Script Window and pressing Edit.

With Enable Script Changed Warnings selected, you will not be able to load the Test
Program using the script if the script changes. Instead, a warning window will be displayed.
After you are through making frequent changes to a script, make sure to check this selection
to help ensure the integrity of the test event script used by the test program.

6. Click OK in the window above.

11
EVT Test Event Scripts

Parameter Types and Values


The table below shows the parameters that may be used in a EVT Test Event script.
Parameter Ranges for Description
Type Default Values

“capacitance” 10 pF – 100 uF Used for components that need a capacitance


(10 pF increments) measurement. For capacitances outside this range, use
the “number” parameter.
“current” (Approximations) Used to set the current that is applied to a test point.

0 = OFF, 1 = 3 uA
2 = 12 uA, 3 = 30 uA
4 = 110 uA, 5 = 376 uA
6 = 2 mA, 7 = 6 mA
“number” Floating point: maximum four For components that need a numeric value. Also for
points before and after decimal capacitances, percentages, resistances, and voltages
outside the range for these parameter types.
“percent” 1 – 99 For percentages outside this range, use the “number”
parameter.
“point” Number tag ties points together Any one test point in a test program. This point can be a
for hipot tests: < 0 means do fourwire point.
not tie together, >= 0 means
group points in this component This type can tie nets together. Points and point lists can
with the same number tag also be tied together by assigning the same number tag.
together for hipot tests.
“point list” < 0 = treat as a separate point Multiple test points in a wirelist that are common to one
(default) action.
 0 = tie all points with this
number tag together (can have This type can be used to tie nets together. Points and
multiple number tags) point lists can also be tied together by assigning the
same number tag.
“resistance” .1 Ohms – 5 Megaohm Resistance of a component. For milliOhm, four-wire, and
values greater than 5Meg, use the “number” parameter.
“string” 30 characters, maximum ASCI text variables
“textlist” Allows the script to do different options depending on
your selection. When creating a textlist parameter type,
use text strings that will aid in identifying the test
parameter. When the selection is made, there will be an
index starting at one to identify which item in the list was
selected. To access your selection, inside the test
function use the first item in the input parameter list. For
example:
Button = {one ,two, three, four}
Button[1] = the position in the array
Button[2] = the text in that position
“voltage” 50 –1500, tester dependent High voltage applied to a test point or net. For other
voltages or setting external voltages, use the “number”
parameter.

12
Component Scripts

Overview
You can add one component script to a test program. However, a component script can
contain one or more “Lua Components”. You can use a Lua Component to test for a unique
characteristic on the tested assembly, which characteristic could not be tested with the
tester’s base capability. Just as the test instructions for wires, a Lua Component must be
correctly completed for a test to pass. Therefore, a Component Script differs from other script
types in that it can cause the test to fail.

Component Scripts can use test parameters just as EVT scripts. The test parameters are
values that can be used in the test, but can be easily changed in the easy-wire software’s test
editor. For more information on parameter types see page 12.

One you add a Component script to a test program you one or more of the script’s Lua
Components to the test program. In some instances you might even use the same Lua
Component multiple times with different parameters in a test program. You add Lua
Components to a test program in a similar manner to how you can add test instructions to a
test program. Lua Components execute after the other test instruction have completed.

Component scripts must end with a .cmp file extension and use a defined syntax format as
defined in the following section.

13
Component Scripts

Component Script Syntax


Each LUA component within a Component Script file must end with a .cmp extension and
have the required syntax as follows:

This line defines LUA Component


name. Unique names are allowed,
but must start with cmp.
cmpCompName = {} Use this line to record a brief script
cmpCompName.description = “description” description or title. Always
cmpCompName.params = { enclose the description in quotes.
{“param1name”, “param1type”, param1value},
{“param2name”, “param2type”, param2value}, Parameters, if used, are defined.
. Always enclose the parameter
. name and type in quotes.
Optional syntax is shown in grey.
.
{“paramNname”, “paramNtype”, paramNvalue} Note, there is no coma after the
} last parameter definition.
function cmpCompName.test (param1, param2,… paramN)
.
This line begins the Component function
. definition. The variables correspond
. respectively to the parameters previously
Functions used to return value defined.
. value can be a measured test value or
. represent a particular operator button push.
.
if value == goodvalue then if-then-elseif statements are used to pass
return 0 or fail the test depending on value.
elseif value == badvalue then Returning a single variable indicates the
return 1, “failure” LUA Component test passed.
end
Returning two variables fails the LUA
end
Component test. The string “failure” is
displayed in the test window.
Complete the if-then-else statement with
end.
The function definition must end with end.

14
Component Scripts

Parameter Types and Values


You can use the same parameter types and values in component scripts as you would in
EVT Event Scripts. See page 12 for a list of these parameter types and values.
Example
The following custom component has the operator do a visual inspection. If the cable doesn’t
look good, the operator can reject the cable.
Name of this Lua Component is
cmpInspection
Description of the LUA Component.
cmpInspection = {}
cmpInspection.description = "Visual Inspection" Parameters are defined in this
cmpInspection.params = { section.
{"Message Text", "string", "Cable look good?"},
{"YesButton", "string", "Yes"}, The parameters used in this
{"NoButton", "string", "No"} function correspond respectively to
} the previous parameter definitions.
function cmpInspection.test(sMessage, sYes, sNo) The parameters are used to present
iResult = MessageBox(sMessage, sYes, sNo) a message, and the buttons yes
if iResult == 1 then and no. The Message Box function
return 0 returns a 1 to iResult if the first
else
button is pressed; otherwise 2 will
return 1, "Visual Inspection Failed"
end be returned.
end Returning a single variable to the
function will pass this inspection
test.
Returning two variables fails the
inspection test. The string “Visual
Inspection Failed” display in the
Test Window”
The component function is
completed with an end.
More Component Script Examples
You may download example scripts files shown in the table below from the Cirris community
forum. See the page after the table of contents for instructions on downloading these
examples. To transfer the script files to the Easy Touch tester you may use a USB drive, or if
your Easy Touch is connected to a network, use a scripts folder on your network. Using a
shared a network will allow you to easily make changes at a network station and then
evaluate the results on an Easy Touch Tester that is connected to the network. Then when
the script is stable, you can copy it to the Easy Touch.

Hipot_pt_net.cmp Applies hipot to one or more nets. The parameters of this Component
allow you to select the points and hipot settings for this test.
LEDHC.cmp Allows you to select the current for a higher current LED.
CustomLED.cmp LED testing script

15
Component Scripts

Inserting a LUA Component into a Test Program


1. In the test editor click the Define Instructions tab.
2. Press Select Component Script.
3. In the LUA Script window press the Attach button.

4. Navigate to the desired Component Script File. Only files with a .cmp extension will be
displayed. Select the file and press Open. In the window below the Component Script
File, EveryTest, has been selected.

Note: With Enable Script Changed Warnings is selected, you will not be able to load the
Test Program using the script if the script changes. Instead a warning window will be
displayed. Use After you are through making frequent changes to a script, you can use
this selection to help ensure the integrity of the test program using the test program.

5. Press OK to accept the selected Component Script file.


6. In the Test Editor select the test instruction under which you’d like to insert the LUA
Component.
7. Change the component type to Lua Component and press Add Instruction.

16
Component Scripts

8. If there is more than one component in the LUA script file, select the appropriate
component using the pick box.

9. To change a parameter value double tap on the parameter line. A parameter value
window will appear. Select an appropriate value and press OK.

10. When you have set all the parameter values as desired, press OK at the LUA Component
Editor Window shown above.

Note: The OK button will be grayed out until you have entered a parameter value for
each of the parameters. In the example window above “Point List” has no default value.
A value must therefore be entered before the values can be accepted.

11. Press OK at the Select LUA Script window to exit back to the Test Editor.

17
Custom Report Scripts
Overview
The easy-wire software makes it easy to customize and print different standard reports and
labels. However if you need to print a report or label outside the standard easy-wire
software’s capability, you can set up a Custom Report Script. Some custom reports may be
better created using an EVT Test Event Script. We describe the advantages of the different
report options below.

Standard Reports
The standard reports and labels created in the easy-wire software can be turned on, off, or
configured separately for each test program.

Custom Report Script


A Custom Report Script will execute for all test programs used on the tester. A Custom
Report Script can be setup to print after every good test, after every bad test, or after every
tests – whether it be good or bad. Again remember, Custom report scripts are system wide
applying to all test programs.

EVT Test Script


The advantage of using an EVT Test Script is that you have flexible scripting options, and
you can make the custom report or label for selected test programs. Additionally, an EVT
Test Script can allow you to print a custom report at the end of a test run.

Setting up a Custom Report Script


A Custom Report Script can have one of three file names – autogood.rpt, autobad.rpt or
autoall.rpt. The file name that is used determines when the Custom Report Script will run.
The script autogood.rpt prints results after a good test; autobad.rpt prints results after a bad
test; and autoall.rpt prints results after all tests. Again, remember Custom report scripts are
system wide applying to all test programs.

To use a custom report script, the custom file - whether it be auotgood.rpt, autobad.rpt,
autoall.rpt - must be in the appropriate folder location on the test system. For Vista and
Windows 7, the script file must be stored the report folder on the path
C:\Users\Public\Documents\Cirris\easywire\Report .

For older test systems using XP and 2000, the script file must be stored in the report folder
on the path C:\Documents and Settings\All Users\Documents\Cirris\easywire\Report .

18
Custom Report Scripts

Custom Report Syntax


.
function DoCustomReport()
.
The function DoCustomReport() must be
.
included in your custom report script file. This
. function is a basis for calling other script
Gather report information functions to create and print your custom report
Send report to printer
.
The DoCustomReport() function is completed
.
. with an end.
end

Custom Script Example


See the Cirris ftp site ftp://ftp.cirris.com/easytouch/scripts/ to see an example script file.
The file T1Rep.rpt at this ftp site creates a Touch 1 style report for the Easy Touch tester.

19
Easy Touch Embedded Blocks
Who Should Read this Section
Intended audience
This section affects only those who are running a script on an Easy Touch or who are
controlling an 1100 tester with easy-wire software. This section will provide details of how
the embedded script blocks are implemented on these testers. This section is intended
for advanced scripting users or those with general programming experience.

Why you might need to use Embedded Blocks


The Easy Touch Tester has two processors involved with scripting. One processor
resides on the PC motherboard; the other processor resides in the embedded system
which directly controls the tester hardware. Each of these processors has their own
memory and Lua environment. The PC processor is using a Lua 5.1 environment while
the embedded processor is using Lua 3.2.

In normal operation, when a script is started in easy-wire software, the script begins
running in the PC processor. Some of the Cirris measurement functions (such as
GetResistanceMeasurement) are executed in the embedded processor so that the
embedded system can directly control the tester hardware. When the PC processor script
encounters such a command it transfers control to the embedded processor. The PC
script then waits for the results of that function to return from the embedded processor.
Each of these commands must be transmitted over the communication channel between
the two processors, which is very slow compared to the execution speed of the
processors.

In most scripts the time required to pass data between the PC and embedded processors
is unnoticeable, but in some cases a script may run slower because of the time required
for this data transmission. If such a function were executed only a few times during a
script execution, the operator would not recognize a noticeable slowdown. However, if the
function were called repeatedly for a hundred measurements (for the sake of getting an
average, for example), the operator could notice a pause when the script executes.

For this reason Easy Touch scripting allows the use of “embedded blocks”, in which an
entire block of script commands can be designated to run exclusively together in the
embedded processor. Using an Embedded Block can reduce significant data
transmission and substantially increase the execution speed of the script. Thus if a speed
critical section of a script is calling many Cirris measurement functions with little
processing between them, using Embedded Blocks may be a good choice.

20
Embedded Blocks

How Embedded Blocks are Implemented


Implementation
Embedded Blocks allow for user-defined blocks of code to execute in the embedded
memory.
This can significantly speed up script execution when many tester hardware commands
are needed in tight loops. Before a script begins execution in the PC processor the script
is preprocessed and everything defined in an embedded block is sent to the embedded
processor’s Lua environment. Thus everything within an Embedded Block declaration is
defined in both environments including function definitions and variables. When an
Embedded Block function is encountered in the PC script the PC processor transfers
control to the embedded processor and waits for the function to return.

For example, an Embedded Block can be defined in the following manner:

This line designates the beginning of the


-- {$block blockName} block. The syntax ‘-- {$block’ indicates the
beginning of the block while blockname is a
. required, unique name to identify the block.
.
.
Embedded Block functions
.
.
This line designates the end of the block.
.
-- {$end}

.
. Functions defined outside the Embedded
. Block will always execute in the PC
processor.
PC processor functions

This syntax is all that is required to make use of Embedded Blocks. With this example any
functions defined in the Embedded Block will always execute in the embedded processor
and nothing else is needed. This behavior is likely sufficient for most new scripts. However,
Embedded Blocks have some additional functionality that may be useful for some new
scripts and for adapting legacy scripts to make use of Embedded Blocks.

21
Embedded Blocks

There are times when it may be necessary, or advantageous, to execute an Embedded


Block function on the PC processor. For instance, a function which does some
processing of measurement results may be needed in script code that is run in the
embedded processor, but may also be useful for code that is running on the PC
processor. You could define a second function outside the Embedded Block with the
same code, but such code is difficult to maintain. A better solution is to have the function
defined in one place only and then be able to specify if the code should execute on the PC
processor or the embedded processor. This behavior is accomplished through special
preprocessing which takes place before the script is run in the PC processor.

When the preprocessor encounters a function defined in an Embedded Block, the function
is first sent to the embedded processor in its original form. Then, in the PC script, the
function is replaced with three functions which allow the function to be called in three
different ways – the original function name, an embedded name, and a PC name. The
embedded name causes the function to execute in the embedded processor while the PC
name function will execute in the PC processor. The original function name will call either
the embedded version or PC version depending on a user defined default behavior
(described below).

As an example, consider the following code which represents the original script file before
running the preprocessor.

--------------------------------------- Required block syntax


-- {$block embBlockName }
---------------------------------------
Optional comment lines – used only to
function MyFunction(a, b)
make block more visible.
-- function code
end

---------------------------------------
-- {$end}
---------------------------------------

22
Embedded Blocks

After preprocessing, the script will look like essentially like the following (though some
details are not shown to simplify the example):

Embedded Script
---------------------------------------
-- {$block embBlockName }
---------------------------------------

function MyFunction(a, b)
-- original function code
end

---------------------------------------
-- {$end}
---------------------------------------

PC Script
---------------------------------------
-- {$block embBlockName }
---------------------------------------
Original function renamed. This allows for
function __embBlockName_MyFunction(a, b) reassigning the original function name to
-- original function code selectively point to embedded or PC
end version.
function e__embBlockName_MyFunction(a, b)
Embedded name.
return -- call embedded version
end
PC name.
function p__embBlockName_MyFunction(a, b)
return __embBlockName_MyFunction(a,b)
This line reassigns the original function
end
name to point to either the embedded or
PC version depending on user specified
myFunction = e__embBlockName_MyFunction
default behavior. Here it is being assigned
to the embedded version.
---------------------------------------
-- {$end}
---------------------------------------

23
Embedded Blocks

With this new version of the script the user has access to either the embedded version or
the PC version of the function. Based on the example above, to call the PC version of the
function the user would call

p__embBlockName_MyFunction(a, b)

and to call the embedded version the user could call either

e__embBlockName_MyFunction(a, b)

or more simply

myFunction(a, b)

since the default behavior allows for the original function name to call the embedded
version. It is important to remember, however, that these new function names are only
available in the new PC version of the script. Thus any function defined in an Embedded
Block cannot use the alternate function names. It is also worth noting that if you use the
alternative function names in your script code you will be referencing a function that does
not exist until the EasyWire preprocessor processes the script. This could cause
problems if you are using any external Lua syntax checking tools.

Important Notes
Because the code in an Embedded Block may execute on the embedded processor there
are a few important considerations to remember when writing code for Embedded Blocks.
First, because the embedded processor uses a Lua 3.2 environment, all code in an
Embedded Block must be Lua 3.2 compatible. This includes ensuring that functions are
defined before being called and not using newer Lua features that are not supported in 3.2
such as ‘for’ loops. A second important note is that since the code may run on the
embedded processor, functions such as ‘MessageBox’, ‘DialogOpen’, and
‘PromptForUserInformation’ should not be used because the dialog boxes will be sent to
the embedded processor display, which may not exist (in the case of an EasyTouch
tester, for instance). These functions will cause the script to appear to be ‘hung’ because
the script is waiting for user input which the user cannot give.

24
Embedded Blocks

Global Variables
In addition to function definitions, global variables can also be defined in an Embedded
Block. This could be useful for updating an existing script to run faster on an Easy Touch
Tester, but is not advisable when writing a new script. When global variables are defined
inside the Embedded Block both the embedded processor and the PC processor will have
a unique copy of the variable, and thus the variable will no longer be truly global. If the
variable is serving as a constant value that is never updated this is acceptable behavior
and will allow both processors to see the constant value. However, if a global variable
gets updated by one processor the change will not be represented in the other processor,
which may cause unexpected behavior.
Of equal importance to remember is that global variables not defined in an Embedded
Block will not be defined in the embedded processor and could provide unexpected ‘nil’
values if used in functions defined in the Embedded Block. The preferred way to transfer
information between functions that may execute in different processors is simply to use
the parameters and return values of those functions.

If you think there is a compelling reason to use global variables inside an Embedded
Block you will have to provide a mechanism to ensure that the global variables in both
processors remain synchronized. Some example code for such behavior is provided
below.

25
Embedded Blocks

---------------------------------------
-- {$block embBlockName}
---------------------------------------

myGlobal = 0

function ChangeGlobal()
myGlobal = 100
end

function UpdateMyEmbeddedGlobal(NewValue)
myGlobal = NewValue Synchronizing Functions – defined
end inside the Embedded Block to give
access to embedded version of
function GetMyEmbeddedGlobalValue() myGlobal
return myGlobal
end

---------------------------------------
-- {$end}
---------------------------------------

function My_PC_Function()
myGlobal = 5

UpdateMyEmbeddedGlobal(myGlobal)

ChangeGlobal()
myGlobal = 5 before execution
myGlobal = GetMyEmbeddedGlobalValue() myGlobal = 100 after execution
end

26
Embedded Blocks

Changing default behavior


The default behavior for the original function name can be changed by adding a second,
optional parameter to the block definition. By adding a ‘,1’ following the block name the
default behavior will change such that the original function name will call the PC version of
the function rather than the embedded version. The only change in the preprocessor
output is on the line which reassigns the original function name as illustrated below. Note,
the yellow highlighted text below is the only change from the script example on page 23.

Embedded Script
---------------------------------------
-- {$block embBlockName }
---------------------------------------

function MyFunction(a, b)
local c
c = a + b
return c
end

---------------------------------------
-- {$end}
---------------------------------------

PC Script
---------------------------------------
-- {$block embBlockName,1 }
---------------------------------------

function __embBlockName_MyFunction(a, b)
-- original function code
end

function e__embBlockName_MyFunction(a, b)
return -- call embedded version
end

function p__embBlockName_MyFunction(a, b)
return __embBlockName_MyFunction(a,b)
end With the 2nd parameter of the block
definition set to ‘1’ the original function
myFunction = __embBlockName_MyFunction name is now set to refer to the PC version
of the function.
---------------------------------------
-- {$end}
---------------------------------------

27
Embedded Blocks

The behavior of having the original function name refer to the embedded version of the
function is the default when no parameter is provided following the block name. This
behavior can also be achieved by providing a ‘0’ as the second parameter, as illustrated
below.

-- {$block embBlockName,0}

The most likely scenario for changing the default behavior of the block is when changing
an existing script to work more efficiently on an Easy Touch Tester. In most scripts only a
limited portion of the script will need to be put into an Embedded Block for speed
improvement. However, the functions placed in the Embedded Block may call other
functions that are used throughout the rest of the script which will need to run in the PC
most of the time. In this case it may be beneficial to change the default behavior to have
all Embedded Block functions run in the PC processor and then explicitly call the
embedded versions in the few select cases where they are needed.

28
Embedded Blocks

Calling sub-functions
In general there are two types of code in a script – code defined inside an Embedded
Block, and code defined outside an Embedded Block. Functions defined in an Embedded
Block may call other functions also defined in an Embedded Block. Code execution can
also flow between code defined outside a block and code defined inside a block. Script
execution always begins with code defined outside a block which executes on the PC
processor. When execution moves from code defined outside a block to code defined
inside a block we may say execution is ‘entering’ the block. Similarly, when execution
flows from code defined inside a block to that defined outside the block we may say
execution is ‘exiting’ the block. If more than one Embedded Block is defined in a script it
is also possible to exit one block and enter directly into another block.

There are two ways in which execution can enter a block from code defined outside a
block – calling the PC version of a block function or calling the embedded version of a
block function. The path that is taken to enter the block determines on which processor
that code will run. Once execution is started on a given processor it is desirable to
continue execution on the same processor until exiting the block.

29
Embedded Blocks

For instance, consider functions functionA and functionB, which are defined in an
Embedded Block in the following example.
---------------------------------------
-- {$block emb}
---------------------------------------
function functionB()

end

function functionA()

functionB()
end
---------------------------------------
-- {$end}
---------------------------------------

PC_function()

P__emb_functionA()

end

In the function defined outside the block, PC_function, it is desirable to call functionA to
run on the PC processor to save the overhead of transferring execution to the embedded
processor. However, functionA calls functionB, which is also defined in the Embedded
Block. If functionB executes in the embedded processor, there will be no benefit to calling
functionA to run on the PC processor. Thus, the desired behavior in this case is to have
functionB also execute on the PC processor since that is how functionA was called.
However, if a different path of execution is taken in which functionA is running on the
embedded processor, it would be equally inefficient to have functionB run on the PC
processor. Therefore, the desired behavior is that when code execution enters a block it
will continue executing on the same processor until it exits the block. This behavior is
accomplished through some details of the script preprocessing which were hidden earlier.
These details are explained in the following example for those who want to understand
more fully, however, it is not essential to understand the details of how this accomplished
and the example may be skipped. The important point to understand is that when calling
code in an Embedded Block the code will execute on the same processor until it leaves
that block even if other block functions are called.

Recall the original script file example used above.


---------------------------------------
-- {$block embBlockName }
---------------------------------------
function MyFunction(a, b)
-- function code
end
---------------------------------------
-- {$end
---------------------------------------
30
Embedded Blocks

The preprocessor adds an extra enable flag to track entering and exiting the block as
illustrated in the full preprocessor output below (new details highlighted). The yellow
highlighted text below shows changes from the script example on page 23.

Embedded Script
---------------------------------------
-- {$block embBlockName }
---------------------------------------
function MyFunction(a, b) No changes are made in embedded script.
-- original function code Thus once execution in a block begins in
end the embedded processor all function calls
will execute on embedded processor.
---------------------------------------
-- {$end}
---------------------------------------
PC Script
---------------------------------------
-- {$block embBlockName }
---------------------------------------
__embBlockName_enable = true
function __embBlockName_MyFunction(a, b)
-- original function code
end
function e__embBlockName_MyFunction(a, b) Checks enable flag – executes on
if __embBlockName_enable then embedded processor if flag is true,
return -- call embedded version otherwise calls PC version.
else
return __embBlockName_MyFunction(a, b)
end
end
Enable flag is cleared to keep execution on
function p__embBlockName_MyFunction(a, b) PC processor.
__embBlockName_enable = false
local temp = {__embBlockName_MyFunction(a,b)}
__embBlockName_enable = true
return unpack(temp) Enable flag is set to allow for processing
end on the embedded processor in future calls.
The default state for the enable flag is true.
myFunction = e__embBlockName_MyFunction
--------------------------------------- The temp = {…} and return unpack(temp)
-- {$end} simply ensure that all return values are
--------------------------------------- returned properly.
Examining the preprocessor output reveals that the enable flag defaults to true – which
enables execution to take place on the embedded processor. If execution enters a block
by calling the PC version of the function this flag is cleared - which keeps execution from
being transferred to the embedded processor for further Embedded Block function calls. It
is also important to note that the enable flag is tied to the block name. This means that if
more than one Embedded Block is defined in your code and you call functions in another
block the enable flag will not affect the second block. For this reason it is best practice to
keep all Embedded Block code in a single block or at least not allow interactions between
blocks whenever possible. It is also worth noting that the enable flag is not intended for
the user to access directly in a script.
31
Embedded Blocks

Summary Examples
Consider the following code example for getting the average value of a measurement,
which illustrates some of the principles presented in this section.

--------------------------------------- No second parameter after block


-- {$block emb} name, original function name will
--------------------------------------- refer to embedded version.

function CalculateAverage(sum, samples) Since the embedded block will run


return (sum / samples) in embedded processor (Lua 3.2
end environment), this function must be
defined before being used later in
function AverageResistance(myPoint1, myPoint2) the block.
local i = 0
local sum = 0

while i < 100 do


sum = sum + GetResistanceMeasurement(myPoint1, myPoint2)
i = i + 1
end

return CalculateAverage(sum, 100)


end

---------------------------------------
-- {$end}
---------------------------------------

function My_PC_Function()
local myPoint1 = 'J1-001'
This calls the embedded version
local myPoint2 = 'J1-002'
of AverageResistence which will
local fAverageValue = 0
local fAverageTime = 0 call the embedded version of
local i = 0 CalculateAverage.

while i < 5
fAverageValue = AverageResistance(myPoint1, myPoint2)
fAverageValueSum = fAverageValueSum + fAverageValue
i = i + 1
Calls PC version of
end
AverageResistence which will
call the PC version of
CalculateAverage.
fAverageValueSum = fAverageValueSum + p__emb_AverageResistance(myPoint1,
myPoint2)
return p__emb_CalculateAverage(fAverageValueSum / 6)
end
The CalculateAverage function in
the embedded block is called to
run on the PC processor.

32
Embedded Blocks

The following example executes the same as the one on the previous page, but uses the
opposite default behavior for the Embedded Block. The yellow highlighted text below
shows the changes from the previous script.
---------------------------------------
1 as second parameter after block
-- {$block emb,1}
--------------------------------------- name, original function name will
refer to PC version.
function CalculateAverage(sum, samples)
return (sum / samples)
end

function AverageResistance(myPoint1, myPoint2)


local i = 0
local sum = 0

while i < 100 do


sum = sum + GetResistanceMeasurement(myPoint1, myPoint2)
i = i + 1
end

return CalculateAverage(sum, 100)


end

---------------------------------------
-- {$end}
---------------------------------------

function My_PC_Function()
local myPoint1 = 'J1-001'
This calls the embedded version
local myPoint2 = 'J1-002'
of AverageResistence which will
local fAverageValue = 0
local fAverageTime = 0 call the embedded version of
local i = 0 CalculateAverage.

while i < 5
fAverageValue = e__emb_AverageResistance(myPoint1, myPoint2)
fAverageValueSum = fAverageValueSum + fAverageValue
i = i + 1
Calls PC version of
end
AverageResistence which will
call the PC version of
CalculateAverage.
fAverageValueSum = fAverageValueSum + AverageResistance(myPoint1, myPoint2)
return CalculateAverage(fAverageValueSum / 5)
end
The CalculateAverage function in
the embedded block is called to run
on the PC processor.

33
Script Errors & Debugging
Common Script Errors

“ERROR: Script file <script file> changed”


This message appears because the script was changed and the “Enable Script Changed
Warnings” option was selected when the script was setup. This option used to help ensure
the integrity of the test program using the test script.

To remove the message your can either:


• Change or replace the script so it is back to its original state.
• Edit each test program that uses the script. In the Test Editor either unselect the “Script
Changed Warnings” option or reselect the changed script file. Before reselecting the
script file, make sure to note any parameters that are used so you can re-enter them
accurately after reselecting the script.

The Event or Component Script file does not run


In this scenario you have tested cables, but the script file will not run for one of two reasons:
• The Script file has not been selected in the test’s setup.
• The script file contains syntax errors, which need to be corrected. To correct these errors,
see Debugging Methods on the next page.

Custom Report Script does not print


Potential reasons include:
• The Custom Report Script is in the wrong folder.
• The Custom Report Script has the wrong file name.
• The printer is not connected to the tester.
• The wrong printer (serial or parallel) is connected to the tester.
• The printer is off-line.
• The printer is turned off.
• The printer is out of paper.

34
Script Errors & Debugging

Debugging Methods

Once you have written or edited a script, you may find the syntax is not correct or it simply
does not work. Here are a few techniques you can use to get your script running.

• Put the script on your network where it can be accessible to both the tester and a network
workstation. That way you can evaluate your script changes quickly. Make sure “Enable
Script Changed Warnings” is not selected. That way you won’t have to re-select the script
after each script change. If a network is unavailable to an Easy Touch tester, make and
evaluate script changes on a USB drive. Another option is to attach a keyboard to the
Easy Touch tester.

• Use the Cirris Message Box function to display the value of variables at one or more points
in the script’s execution.

• Revert to the simplest thing that you can get to work. Comment out code, or save a copy
of the script so you can delete sections of the code. Introduce more script functionality to
find script errors.

• After you’ve eliminated all the syntax errors, continue to test the script to ensure it works as
intended and maintains its functionality under different scenarios.

35
Cirris Functions
Cirris functions organized by category
Date and Time Functions Low Level Function
Delay .................................................. 40 Sink / Unsink ..................................... 59
GetDateAsText ................................... 40 Turn On Relay ................................... 60
SetDelayTimeInMilliseconds .............. 41 Source / Clear Source Vector ............ 61
TimePassed ....................................... 41 Read / Clear Read Vector .................. 62
TimerClose ......................................... 41 Set Current ......................................... 62
TimerDone .......................................... 42 Measure Voltage ............................... 64
TimerReset ........................................ 42 Route Current to Relay ....................... 64
Set All Default .................................... 66
Digital Input and Output Functions Set High Current................................. 67
SetUserOutputStates ......................... 46
Cirris.ReadPLCInputOutputStates ...... 47 Measurement and Test Functions
Cirris.SetPLCOutputStates ................. 48 HipotNetTiedToPoint ........................ 76
Cirris.GetBuiltInTesterOutputStates .... 49 Cirris.HipotNetTiedToPoints .............. 68
Cirris.ReadBuiltInTesterInputStates ... 50 Cirris.HipotPointMask ........................ 68
Cirris.SetBuiltInOutputStates .............. 50 EPROM .............................................. 69
GetUserOutputStates ......................... 43 GetCapMeasurement ....................... 71
ReadUserInputStates ......................... 44 GetRelCapMeasurement .................. 72
SetUserOutputStates ......................... 45 GetResistanceMeasurement ............ 73
GetResistanceMeasurement4W ........ 74
File Functions GetTotalCapMeasurement ................ 75
Cirris.ChDir ......................................... 55 HipotNetTiedToPoint ......................... 76
Cirris.CloseDir ..................................... 55 HipotNetsTiedToPoints....................... 76
Cirris.CopyFile..................................... 55 HipotPointMask ................................. 80
Cirris.CurrentDir .................................. 56 LearnCable ......................................... 81
Cirris.DirExists..................................... 56 MicroLan ............................................ 82
Cirris.MkDir ......................................... 56 TestWirelist ....................................... 84
Cirris.OpenDir .................................... 57 UseChildWirelist ............................... 85
Cirris.OpenFileDialog .......................... 57
Cirris.OpenFolderDialog ..................... 57
Cirris.ReadDir ..................................... 58
Cirris.RmDir ........................................ 58

36
Cirris Functions

Cirris functions organized by category continued

Printer Functions GetErrorSignature .......................... 99


Cirris.EndPrintJob ................................. 87 GetErrorText .................................. 99
Cirris.GetNumPrinters ........................... 88 GetNumberTested ........................ 99
Cirris.GetPrinterNameByIndex .............. 88 GetPinLabel ................................. 100
Cirris.NewPage ..................................... 88 GetWirelistInfoAsText ................. 101
Cirris.Print ............................................. 89 IsSPCDataCollectionOn ............... 103
Cirris.SetPrinter ..................................... 89 TWLGetErrorText ......................... 103
Cirris.StartPrintJob ................................ 89
SendTextToParallelPrinter .................... 90 User Interface Functions
Cirris.GetWrappedText ............... 107
Tester Information Functions Cirris.HideBackgroundImage ....... 104
Get4WPairPt ........................................ 91 Cirris.PlaySoundFile..................... 105
GetHardWareVersion ........................... 91 Cirris.PressDoneButton ............... 105
GetProbedPin ....................................... 91 Cirris.ShowBackgroundImage .... 105
GetRawPointNum ................................ 91 DialogCheckBtn .......................... 106
GetPtType ............................................ 92 DialogClose ................................ 106
GetTimeAsText .................................... 92 DialogOpen .................................. 107
GetTimeAsInteger ................................ 93 MessageBox ............................... 107
GetSystemInfoAsText ......................... 93 PlaySound ................................... 109
WiresAttached .................................... 103 PromptForUserInformation ........... 107

Test Information Functions 1100 Embedded Memory Functions


Cirris.BadCount .................................... 96 _appendto .................................... 111
Cirris.CableID ....................................... 94 CopyEmbeddedFileToPc ............ 112
Cirris.GetAdapters ................................ 94 _copyfile....................................... 112
Cirris.GoodCount ................................. 96 CopyPcFileToEmbedded ............ 112
Cirris.LotID ............................................ 96 DirUtils ........................................ 113
Cirris.RunBadCount ............................. 96 _openfile ..................................... 114
Cirris.RunGoodCount ............................ 96 _read .......................................... 114
Cirris.RunNumber ................................ 96 _readfrom ................................... 116
Cirris.RunTotalCount ............................ 96 _remove ....................................... 116
Cirris.StationID ..................................... 96 _rename....................................... 117
Cirris.TotalCount .................................. 97 _rename....................................... 117
GetCableStatus ..................................... 97 _write .......................................... 117
GetComponentCount ........................... 97 _writeto ....................................... 118
GetComponentDetails .......................... 99

37
Cirris Functions

Cirris Functions organized alphabetically


_appendto ......................................... 111 Cirris.MkDir ...................................... 56
_copyfile ........................................... 112 Cirris.NewPage ................................ 88
_openfile .......................................... 114 Cirris.OpenDir................................... 57
_read ................................................ 114 Cirris.OpenFileDialog
_readfrom ......................................... 116 Cirris.OpenFileDialog ..................... 57
_remove ............................................ 116 Cirris.OpenFolderDialog .................. 57
_rename ........................................... 117 Cirris.Print ....................................... 89
_rename ........................................... 117 Cirris.PressDoneButton ................ 105
_writeto ............................................. 118 Cirris.ReadDir ................................... 58
Cirris.ReadBuiltInTesterInputStates.. 50
Cirris.BadCount .................................. 96 Cirris.ReadPLCInputOutputStates ... 47
Cirris.CableID .................................... 94 Cirris.RmDir ...................................... 58
Cirris.ChDir ........................................ 55 Cirris.RunBadCount.......................... 96
Cirris.CloseDir ..................................... 55 Cirris.RunGoodCount ....................... 96
Cirris.CopyFile .................................... 55 Cirris.RunNumber ............................. 96
Cirris.CurrentDir .................................. 56 Cirris.RunTotalCount ........................ 96
Cirris.DirExists .................................... 56 Cirris.SetBuiltInOutputStates .......... 50
Cirris.EndPrintJob ............................... 87 Cirris.SetPLCOutputStates ............. 48
Cirris.GetAdapters .............................. 94 Cirris.SetPrinter ................................ 89
Cirris.GetNumPrinters ......................... 88 Cirris.ShowBackgroundImage ...... 105
Cirris.GetBuiltInTesterOutputStates ... 49 Cirris.PlaySoundFile ....................... 105
Cirris.GetPrinterNameByIndex ........... 88 Cirris.StartPrintJob ........................... 89
Cirris.GetWrappedText ..................... 107 Cirris.StationID ................................. 96
Cirris.GoodCount ............................... 96 CopyEmbeddedFileToPc ................ 112
Cirris.HideBackgroundImage ............ 104 CopyPcFileToEmbedded ................ 112
Cirris.HipotNetTiedToPoints ................ 68
Cirris.HipotPointMask .......................... 68 Delay ............................................... 40
Cirris.LotID .......................................... 96 DialogCheckBtn.............................. 106
DialogClose.................................... 106
DialogOpen ................................... 107
DirUtils ........................................... 113

EPROM .......................................... 69

38
Cirris Functions

Cirris Functions organized alphabetically continued

Get4WPairPt ...................................... 91 Measure Voltage ................................ 64


GetCableStatus .................................. 97 MessageBox .................................... 107
GetCapMeasurement ....................... 71 MicroLan ............................................ 82
GetComponentCount ......................... 97
GetComponentDetails ........................ 99 PlaySound ...................................... 109
GetDateAsText .................................. 40 PromptForUserInformation ............... 107
GetErrorSignature .............................. 99
GetErrorText ...................................... 99 Read / Clear Read Vector ................. 62
GetHardWareVersion ....................... 91 ReadUserInputStates ......................... 44
GetNumberTested .............................. 99 Route Current to Relay ..................... 64
GetPinLabel ..................................... 100
GetProbedPin ................................... 91 SendTextToParallelPrinter ................ 90
GetPtType ......................................... 92 Set All Default ................................... 66
GetRawPointNum ............................ 91 Set Current ....................................... 62
GetRelCapMeasurement .................. 72 Set High Current ............................... 67
GetResistanceMeasurement ............ 73 SetDelayTimeInMilliseconds ............ 41
GetResistanceMeasurement4W ....... 74 SetUserOutputStates ........................ 45
GetSystemInfoAsText ...................... 93 Source / Clear Source Vector............. 61
GetTimeAsInteger ............................. 93 Sink / Unsink ...................................... 59
GetTimeAsText ................................. 92
GetTotalCapMeasurement ............... 75 TestWirelist ....................................... 84
GetUserOutputStates ....................... 43 TimerClose ....................................... 41
GetWirelistInfoAsText....................... 101 TimerDone ........................................ 42
TimePassed ...................................... 41
HipotNetTiedToPoint ........................ 76 TimerReset ....................................... 42
HipotNetsTiedToPoints .................... 76 Turn On Relay.................................... 60
HipotPointMask ................................ 80 TWLGetErrorText ............................ 103

IsSPCDataCollectionOn ................... 103 UseChildWirelist ................................ 85


LearnCable ....................................... 81
LowLevelCmd ................................... 59 WiresAttached ................................. 103

Note: Some Cirris functions previously used in scripting for Cirris 1100 and Touch 1
testers are no longer supported in Easy Touch Scripting (See Unsupported Cirris
Functions page 120 ). Some Lua 3.2 functions previously used in Cirris scripts continue
to be supported (See Preserved Lua 3.2 Functions on page 119).

39
Date and Time Functions

Date and Time Functions


Delay

Delay (delayseconds)
Sets a delay for tester functioning in seconds. Use this function when controlling relays
using the low level commands and a delay is needed to let the tester catch up. This
function acts like a NOOP operation. Also, see the SetDelayTimeInMilliseconds function.

For example the following lines of code set a 5 second delay


iDelayInSeconds = 5.0
Delay(iDelayInSeconds)

Another example, Delay(.1) delays tester functioning for 100 milliseconds.

GetDateAsText

GetDateAsText (select)
This function returns the current date information as a text string. You can select the
format for the returned date information as indicated in the table below.
date information returned select
function describes itself nothing
Month only MM (no preceding 0) 1
Day only DD (no preceding 0) 2
Year only YYYY 3
Year only YY 4
Full Date MM/DD/YYYY 5
Full Date DD/MM/YYYY 6

Example
sCurrentDate = GetDateAsText (1)
If July were the current month, the function would return the string “5”.

40
Date and Time Functions

SetDelayTimeInMilliseconds

SetDelayTimeInMilliseconds(delay)
This function sets a delay time for tester functioning in milliseconds. See also the function
Delay for setting a delay time in seconds.

Examples:
iInputNum = 5
SetDelayTimeInMilliseconds(iInputNum)

The function will delay all functioning on the tester for 5 milliseconds.

SetDelayTimeInMilliseconds(10)

The function will delay all functioning on the tester for 10 milliseconds.

TimePassed

TimePassed (timer)
This function returns the elapsed time since a timer specified by the handle timer was
opened or reset. The timer handle is integer. Time is returned as an integer value
represented in milliseconds.

Example:
local iTimerHandle = TimerOpen(500)
SetDelayTimeInMilliseconds(300)
local iTimePassed1 = TimePassed(iTimerHandle)
if iTimePassed1 > 200 then
MessageBox(“READY TO START”)
end
TimerClose(iTimerHandle)

This example will create a timer with a 500 millisecond timeout. If the time has been greater
than the 200 msec, a message box will display. The timer will then be terminated.

TimerClose

TimerClose(timer)
This function closes the timer specified by the handle timer, freeing one of the ten available
timers. Timers are created using the function TimerOpen.

41
Date and Time Functions

TimerDone

TimerDone(timer)
This function returns 0 if the timer specified by the handle timer has timed out, or the
function returns 1 if more time is remaining. A timer is created using the function
TimerOpen.

TimerReset

TimerReset (timer)
This function restarts the timer using the original timeout delay that was determined when
the timer was created. The function uses the timer’s handle timer, an integer value
created by the TimerOpen function.

42
Digital Input and Output Functions

Digital Input and Output Functions

Digital IO Functions for the Easy Touch and 1100 Testers

GetUserOutputStates

GetUserOutputStates (Easy Touch and 1100 only)

The full format of this function is:


output1[, output2,… output6)] = GetUserOutputStates (select1[, select2,… select6])

The function returns the state of the digital outputs on the tester’s I/O port. If desired, you
can specify multiple outputs and this function will return their respective states. This
function will return a 0 if the output is on (sinking), or 1 if the output is off (non conducting).
The state of the output port is determined by using the SetUserOutputStates function or by
using the setup for Digital Outputs on the tester.

IO
Connector
Input 0
Power +5 Vdc, 100 mA, max
Input 1
Output 2
Input 2
Output 3
Input 3
Power +5 Vdc, 100 mA, max
Output 0
Not Used
Output 1
Ground
Output 4
Ground
Output 5
3

select IO Connector
(integer) Pin
1 5
2 6
3 10
4 11
5 7
6 8
7 7
8 8

43
Digital Input and Output Functions

ReadUserInputStates

ReadUserInputStates (Easy Touch and 1100 only)

The full format of this function is:


state1, state2, state3, state4 = ReadUserInputStates(1, 2, 3, 4)

This function returns the state (on or off) of one or up to all four digital inputs on the digital
I/O port. Each returned input state corresponds respectively to the specified input. The
function returns a 1 if the input is on (high) or a 0 if the input is off (low). Each input is
specified by an input select number as shown in the table below.

input description
select number
1 Input 0
2 Input 1
3 Input 3
4 Input 4

The figure below shows the digital IO port as viewed from the back of the tester.

IO
Connector
Input 0
Power +5 Vdc, 100 mA, max
Input 1
Output 2
Input 2
Output 3
Input 3
Power +5 Vdc, 100 mA, max
Output 0
Not Used
Output 1
Ground
Output 4
Ground
Output 5
3

Examples:
input0 = ReadUserInputStates(1)
The function will get the state of the Input 0.

io1,io2,io3,io4 = ReadUserInputStates(1,2,3,4)

The function returns the values of all four inputs to io1, io2, io3, and io4.

44
Digital Input and Output Functions

SetUserOutputStates
SetUserOutputStates (Easy Touch and 1100 only)

The full format of this function is:


SetUserOutputStates(outselect1, set1, outselect2, set2, … outselect8, set8)
The outputs on the Easy Touch and 1100 tester IO connector are “sink” outputs. This
function sets the digital outputs on (sinking) or off (non conducting. This function takes up
to six parameter pairs. In each pair, the first parameter outselect specifies which output
to be set. The second parameter, set specifies whether the output is set on or off. If this
parameter value is 0 the output is set on (sinking low); if 1, the output is set off (not
conducting). Note that the function GetUserOutputStates allows you to read the state of
the outputs.

The outputs are capable of sinking up to a nominal 24 volts and 500 milliamps as an
absolute maximum, but 200 milliamps is more realistic. See the easy-wire help system for
example IO circuits. The relation between outselect and the IO connector pin out on the
back of the tester is shown in the table and figure below.

IO
outselect description Connector
1 Output 0
Input 0
2 Output 1 Power +5 Vdc, 100 mA, max
Input 1
3 Output 2 Output 2
Input 2
Output 3
4 Output 3 Input 3
Power +12 Vdc, 100 mA, max
5 Output 4 Output 0
Not Used
Output 1
6 Output 5 Ground
Output 4
Ground
Output 5
3
Examples:

iDigitalOutput0 = 1
iOutputState0 = 0
iDigitalOutput1 = 2
iOutputState2 = 1
SetUserOutputStates (iDigitalOutput1, iOutputState1,iDigitalOutput2, iOutputState2)
The function above will set the Output 0 (pin 5) output on, and Output 1 (pin 6) off.

SetUserOutputStates(6,0)

The function will turn on Ouput5.

45
Digital Input and Output Functions

PLC Digital IO
The Cirris CR and CH+ testers do not have a Serial Port for IO functions, but can perform
IO through a PLC connected to the computer running the tester. The CH2 and Easy
Touch Testers also support PLC IO; however, these testers also have their own built-in
Digital IO to support IO control. All Cirris testers require that the PLC must be the Direct
Logic model number DO-05DR PLC. See the topic PLC I/O in your easy-wire help system
for more information on connecting this PLC.

Cirris.GetPLCOutputStates
Cirris.GetPLCOutputStates (CR, CH2, & CH+ only)

The full format of this function is:


output0[, output1,… output2)] = Cirris.GetPLCOutputStates (select0[, select1,…
select5])

The function returns the state the digital outputs on the PLC’s control I/O port. If desired,
you can specify multiple outputs and this function will return their respective states. This
function will return a 1 if the output is energized (sinking low), or 0 if the output is not
conducting. The state of the output port is determined by using the
Cirris.SetPLCOutputStates function or by using Edit I/O Blocks Window in the easy-wire
Editor.

select Output Label


(integer) on PLC
0 Y0
1 Y1
2 Y2
3 Y3
4 Y4
5 Y5

46
Digital Input and Output Functions

Cirris.ReadPLCInputOutputStates
Cirris.ReadPLCInputStates (CR, CH2, & CH+ only)

The full format of this function is:


state0[, state1, … state7] = Cirris.ReadPLCInputStates(0[, 1, … 7])

This function returns the state (energized or inactive) of one or up to all eight digital inputs
on the digital I/O port. The function returns a 1 if the input is energized and a 0 if input is
inactive. Note that depending how the Direct Logic PLC is wired, inputs can be low or high
in their inactive state, and become active with the opposite logic state. The Each input is
specified by an input select number as shown in the table below.

input Input Label


select number on PLC
0 X0
1 X1
2 X2
3 X3
4 X4
5 X5
6 X6
7 X7

47
Digital Input and Output Functions

Cirris.SetPLCOutputStates
Cirris.SetPLCOutputStates (CR, CH2, & CH+ only)
)
The full format of this function is:
Cirris,SetPLCOutputStates(outnum0, set0, outnum1, set1, … outnum5, set5)
This function sets the digital outputs on the user I/O port to a particular low or high logic
state. This function takes up to six parameter pairs. In each pair, the first parameter
outnum specifies which output to be set. The relation between output numbers and the
labeling on the PLC is shown in the table below. The second parameter, set specifies
whether to set the output on or off. If set is 1 the output will be energized (sinking low); if
0 the output will be turned off (not conducting). Note that the function
Cirris.GetPLCOutputStates allows you to read the state of the outputs.

outnum Output Label


(integer) on PLC
0 Y0
1 Y1
2 Y2
3 Y3
4 Y4
5 Y5

Examples:

iDigitalOutput1 = 1
iOutputState1 = 0
iDigitalOutput2 = 2
iOutputState2 = 1
SetUserOutputStates (iDigitalOutput1, iOutputState1,iDigitalOutput2, iOutputState2)
The function above will set output 1 (Y1) on, and output 2 (Y2) off.

48
Digital Input and Output Functions

Digital IO Functions for the CH2 Tester


The CH2 testers have Digital I/O capability through the Digital I/O port on the back of the
tester. The Digital I/O port can accommodate up to ten inputs that respond to a logic high
signal between 5 and 30 VDC (approximate 1.5 V logic threshold). Additionally, ten open
collector outputs are capable of sinking up to 200 milliamps and 15 VDC. The Digital I/O
connector also supplies +5V and +12V at 140 milliamps each. CH2 testers built after April
2008 require an HV Interlock connection on the Digital I/O port in order to output high
voltage. The diagram and tables below show the CH2 Digital I/O port pin out and pin
assignments.

Input Pin Output Pin Output Pin


0 23 0 1 +5VDC 12
1 19 1 14 +12VDC 13
2 7 2 2 Ground 25
3 20 3 15 HV 6
4 8 4 3 Interlock
5 21 5 16
6 9 6 4
7 22 7 17
8 10 8 5
9 11 9 18

Cirris.GetBuiltInTesterOutputStates
Cirris.GetBuiltInTesterOutputStates (CH2 only)

The full format of this function is:


state0[,state1,… state9)] = Cirris.GetBuiltInTesterOutputStates (0[,1,… 9])

The function returns the state of the CH2’s digital outputs. If desired, you can specify
multiple outputs and this function will return their respective states. This function will
return a 1 if the output is energized (sunk low), or 0 if the output is off (not conducting).
Each output is specified by its output number, 0 to 9. The state of the output port is
determined by using the Cirris.SetBuiltInTesterOutputStates function or by using Edit I/O
Blocks Window in the easy-wire software

49
Digital Input and Output Functions

Cirris.ReadBuiltInTesterInputStates
Cirris.ReadBuiltInTesterInputStates (CH2 only)

The full format of this function is:


state0[, state1,… state0)] = Cirris.ReadBuiltInTesterInputStates (0[,1,… 9])

This function returns the state (on or off) of one or up to all ten digital inputs on the digital
I/O port. A 1 is returned if the input is on (high). A 0 is returned if the input is off (low).
Each input is specified by its input number, 0 to 9.

Cirris.SetBuiltInOutputStates
Cirris.SetBuiltInTesterOutputStates (CH2 only)
)
The full format of this function is:
iPassed = Cirris.SetBuiltInTesterOutputStates(outnum0, set0, outnum1, set1,
… outnum9, set9)
This function sets the digital outputs on the user I/O port to a particular low or high state.
This function takes up to ten parameter pairs. In each pair, the first parameter outnum is
an integer select number 0 to 9, which represents the output number. The second
parameter, set specifies whether to set the output on or off. If set is 1 the output is turned
on (sunk low); if 0 the output is turned off (not conducting). This function will return a value
of 1 if successful to iPassed or a value of 2 if unsuccessful. Note that the function
Cirris.GetBuiltInTesterOutputStates allows you to read the state of the outputs.

50
Digital Input and Output Functions

Digital IO Module
Unlike the digital IO port built into most Cirris tester models, this enhanced digital IO
module comes with more voltage options, more inputs and outputs, and more current
giving you additional control of your test process. The Digital IO connector has a 44-pin
D-Sub connector with the following functions:

20 Input/Output Dual Pins


The digital IO module has 20 input/output dual pins. The pins can be used as either an
input or output depending on your needs. When used for output, the pins function
similar to the dedicated output pins. However, for light loads (typically less than 4 mA) it
is advised you use the dedicated outputs.

8 Dedicated Output Pins


The module’s 8 dedicated output pins are open collector or “sink” outputs. When
activated they will connect (or sink) a voltage to ground, in effect turning ON the output
circuit. The outputs can sink up to 500 milliamps total. To limit the output current,
always ensure adequate resistance between power supply and the output.

4 Voltage Rails
The digital IO module has 4 voltage rails capable of drawing a max of 500 mA
combined. They are accompanied by 4 ground pins. The rails have the following
voltages:
• 3.3 VDC
• 5 VDC
• 12 VDC
• 24 VCD

51
Digital Input and Output Functions

Digital IO Module Connector Pin-out

Pin Purpose Pin Purpose

1 24 VDC 23 Input/Output 15

2 Ground 24 Input/Output 16

3 12 VDC 25 Input/Output 17
4 Ground 26 Input/Output 18

5 5 VDC 27 Input/Output 19

6 Ground 28 Input/Output 20
7 3.3 VDC 29 Output 21
8 Ground 30 Output 22

9 Input/Output 1 31 Output 23
10 Input/Output 2 32 Output 24

11 Input/Output 3 33 Output 25
12 Input/Output 4 34 Output 26

13 Input/Output 5 35 Output 27
14 Input/Output 6 36 Output 28
15 Input/Output 7 37

16 Input/Output 8 38

17 Input/Output 9 39

18 Input/Output 10 40

19 Input/Output 11 41

20 Input/Output 12 42
21 Input/Output 13 43

22 Input/Output 14 44

52
Digital Input and Output Functions

Programing Digital IO Module Software

The digital IO functions are written in the free LUA programming language. For more
information on LUA and scripting, see the easy-wire Scripting manual.

To control the digital IO module, Cirris has created a library of LUA functions called
diomod.lua. The diomod.lua file must be copied to your working directory in order for the
LUA script to have access to the diomod library. This file can be found on cirris.com or
on the flash drive.

diomod.ReadUserInputStates Example
The following example illustrates commands used with lua software to control the digital
IO module.

state1, state2, state3, state4 = diomod.ReadUserInputStates(1, 2, 3, 4)

This function returns the state (on or off) of the digital inputs on the digital IO port. Each
returned input state corresponds respectively to the specified input. The function returns
a 1 if the input is on (high) or a 0 if the input is off (low).

diomod.SetUserOutputStates Example
The full format of this function is:

diomod.SetUserOutputStates(Pin1, State1, Pin2, State2, … Pin8, State8)

The outputs are “sink” outputs. This function sets the digital outputs on (sinking) or off
(floating). This function takes up to eight parameter pairs. In each pair, the first
parameter, specifies which output to be set. The second parameter, specifies whether
the output is set on or off. If this parameter value is 0 the output is set on (sinking low); if
1, the output is set off (not conducting).

53
Digital Input and Output Functions

Digital IO Module Full Script Example


cmpDIO = {}
cmpDIO.description = “Digital IO Module Example 1”

function cmpDIO.test()

LoadLibrary(“diomod”) -- Loads the diomod library


diomod.SetUserOutputStates(11,0) -- Turns on output 11
diomod.SetUserOutputStates(12,1) -- Turns off output 12

return MessageBox(“Test Finished”)

end
-- ***************************************************
-- LoadLibrary FUNCTION MUST BE PRESENT IN THE SCRIPT
-- ***************************************************
function LoadLibrary(sLibrary)

if Cirris then

package.path = string.format(“%s;%s?.lua”,
package.path,string.match(debug.getinfo(1).
source:match(“@(.*)$”), “(.-)([^\\/]- %.?([^%.\\/]*))$”))

_G[sLibrary] = require(sLibrary)

Else

dofile(sLibrary..”.lua”)

end

end

54
File Functions

File Functions
Cirris.ChDir

Cirris.ChDir (x:\\directory)
This function changes the current directory to the drive, path and directory specified by the
input string x:\\directory. This allows the drive, path and directory to not have to be
restated in subsequent file functions.
The function also returns two outputs, result and error as shown.
result, error = Cirris.ChDir (x:\\directory)
If the function is successful in making the directory, it returns 1 to result and nil to
error. If unsuccessful, the function returns a 0 to result and a string describing the error
to error.

Example:
iCopyGood, sCopyError = Cirris.ChDir (“c:\\junk”)
The function attempts to make the current directory c:\junk for further file functions. If
successful, 1 will be returned to iCopyGood and nil to sCopyError.

Note: When using Easy Touch Scripting to control an 1100 tester, this command affects
only the current directory of the computer controlling the tester, not the directories in the
embedded memory of the tester.

Cirris.CloseDir

Cirris.CloseDir (handle)
This function closes the current directory that is identified by a handle previously specified
by the Cirris.OpenDir function. The handle input to this function is a string.

Example:
DirHandle=Cirris.OpenDir (“c:\\junk”)
Cirris.CloseDir (DirHandle)
The functions above open and close the directory c:\junk.

Cirris.CopyFile

Cirris.CopyFile (x:\\source, x:\\destination)


This function copies a source file from the drive and path specified to the destination with
the specified drive and path. Both the source and destination are specified as strings.

For example,
Cirris.CopyDir (“c:\\Cirris\\Data”, “c:\\Company\\Data”)

55
File Functions

Cirris.CurrentDir

Cirris.CurrentDir
Returns a string for the value of the current directory. The current directory is set
previously set using the Cirris.ChDir function. This function will also return result and
error as shown in the full function definition below.
result, error, = Cirris.CurrentDir
If the function is successful in making the directory, it returns 1 to result and nil to
error. If unsuccessful, the function returns a 0 to result and a string describing the error
to error.

For example,
Cirris.ChDir (“c:\\junk”)
sCurDir = Cirris.CurrentDir

Makes sCurDir equal to c:\junk.

Cirris.DirExists

Cirris.DirExists (x:\\directory)
Returns 1 if the directory on the given path exists or 0 if it doesn’t.

For example, iDirThere = c:\\ProgramFiles\\Cirris\\Mydir


returns a 1 to iDirThere if the directory c:\ProgramFiles\Cirris\Mydir
exists.

Cirris.MkDir

Cirris.MkDir (x:\\directory)
Creates a new directory as specified. If the directory given in the path does not yet exist,
Cirris.MkDir attempts to create it. Cirris.MkDir returns 1 if it successfully creates all
necessary directories, 0 if it could not create a needed directory.

For example, iDirMade = Cirris.MkDir (c:\\junk)


if successful, makes the directory c:\junk and returns a 1 to iDirMade.

56
File Functions

Cirris.OpenDir

Cirris.OpenDir (x:\\directory, [files, subdirectories])


Returns a handle for the specified directory. The handle can be used for the
Cirris.ReadDir. The optional input mask allows you to specify a string such as *.txt to limit
the available files of the opened directory. If optional input subdirectories is set to 0
subdirectories will not be available. If subdirectories is 1 or is unused, subdirectories
are available. After opening and using a directory, use the CirrisCloseDir function to free
memory resources.

For example, iJunkHandle=Cirris.OpenDir (“c:\\junk”)


opens the directory c:\junk and returns the directory handle to iJunkHandle.

Cirris.OpenFileDialog

Cirris.OpenFileDialog
This function opens a dialog box so the user can browse to and select a file. To select a
file the user clicks the file and clicks OK. The function returns the path and name of the
selected file as a string.

Cirris.OpenFolderDialog

Cirris.OpenFolderDialog
This function opens a dialog box so the user can browse to and select a folder. To select
a folder the user clicks on a folder and clicks OK. The function returns the path and name
of the selected folder as a string.

57
File Functions

Cirris.ReadDir

Cirris.ReadDir (handle)
This function provides information on the contents of a directory. The directory must be
referenced by handle. Previous to using Cirris.ReadDir, use the function Cirris.OpenDir to
return handle. The Cirris.ReadDir function is used in a while loop. Each time the function
executes it attempts to read one entry of a directory. The function returns the name of a
file or directory, and returns 0 for a file or 1 for a directory. After reading all of the entries
of a directory, Cirris.ReadDir returns a nil value to the directory name.

Examples:

iDirHandle, sDirError = Cirris.OpenDir("C:\\Users\\Public\\Documents")


sDirEntries = ""
bDone = 0
while bDone == 0 do
sReadName, bIsFolder = Cirris.ReadDir(iDirHandle)
if sReadName == nil then
bDone = 1
else
sDirEntries = sDirEntries..Format("Name: %s, Folder: %d\r\n", sReadName, bIsFolder)
end
end
MessageBox(sDirEntries)

The code above opens the directory Documents. The Cirris.ReadDir function is used
inside a while loop to read and identify each of the directory entries. Each entry name and
its folder/file designation is added to the string sDirEntries using the Lua Format function.
The MessageBox function is then called to display this string. Each file name will have a 0
displayed next it; each folder will have a 1.

Cirris.RmDir

Cirris.RmDir (directory)
Removes the specified directory.

For example, Cirris.RmDir (“c:\\junk”) removes the directory c:\junk.

58
Low Level Function

Low Level Function

LowLevelCmd (Easy Touch & 1100 only)


)
The Low Level command allows you to control the bare internal workings of the tester to
extend its testing methods. These low level commands are designed for use by a very
experienced programmer or engineer. Read the entire section thoroughly before
attempting to use these functions. After running a script that has executed any of the low
level commands, you should call LowLevelCmd (9) to return the tester to a known state.
This is the appropriate cleanup function.

Critical: While using these function to test complex circuitry, never connect an outside
power supply over 5.5 volts to the testers test points. If you break this rule, you will void
the tester's warranty and damage the tester. If you follow this rule, it is impossible for the
commands listed below to damage the tester.
Sink / Unsink

Low Level Function: Sink / Unsink


Sink means pull the point to ground. You can sink as many points as you like but you
have to call this function for each point you sink. Once a point is sunk, it remains sunk until
you clear it. The low level function format to sink or unsink a test point is:

result, error = LowLevelCmd(command, point, set)

where the inputs and outputs are defined as follows:

command point set result error


1 = Sink or Text string containing the point 0 = Unsink 0 = error nil = No error
Unsink Point as a default or custom label 1 = Sink 1 = no error 1 = Bad point
OR 5 = Bad
Sink means pull Integer containing the point command #
the point to where J1-001 = 1, J3-001 = 65
ground. (The number increments the
same as an AHED-64 adapter).

Example:
result = LowLevelCmd(1,"J1-001", 1)
This example sinks point J1-001.

59
Low Level Function

Turn On Relay
Low Level Function: Turn On Relay (Easy Touch & 1100 only)
)
This low level command allows you to turn on a relay that controls a scanner point. Why
would you turn on a test point relay? The test point relays switch out the analog hardware
on a scanner point and connect the point to the high voltage system. The high voltage
hardware can be used for hipot testing or measuring capacitance. The current source can
be routed through the high voltage system, allowing you to apply current to more than one
point at a time for complex measurements.

Notes:
a. You can turn on as many relays as you want but you have to call this function for each
point. The relay remains on until you turn it off.
b. You cannot directly measure the voltage on a point when the relay is turned on for that
point.
c. It takes time for a relay to turn on. You can turn on a lot of relays and then call Delay
(0.010) to give the relay's contact time to move before performing any measurements.

The low level function format to turn on or off a relay is:

result, error = LowLevelCmd(command, point, set)

where the inputs and outputs are defined as follows:

command point set result error


2 = Turn Text string containing the 0 = Off 0 = error nil = No error
Relay On or point as a default or 1 = On 1 = no error 1 = Bad point
Off custom label 2 = Bad integer
OR 5 = Bad
Integer containing the command #
point where J1-001 = 1,
J3-001 = 65 (The number
increments the same as
an AHED-64 adapter).

Example:
result = LowLevelCmd(2, 3, 0)
This example turns off the relay connected to point, J1-003.

60
Low Level Function

Source / Clear Source Vector


Low Level Function: Source / Clear Source Vector (Easy Touch & 1100 only)
This low level command is needed when you want to measure devices that are nonlinear )
and require a fixed current, or when you want to source one point and measure voltage on
another and therefore cannot use the resistance measurement command.

Note: Only one point can be connected to the current source at a time. Whenever you
pick a new point, the current is removed from any prior point. This command doesn't
actually turn on the current source but simply connects it to the point you choose. It does
not affect the current source just the current source vector.

The low level function format to source clear a vector is:

result, error = LowLevelCmd(command, point, set)

where the inputs and outputs are defined as follows:


command point set result error
3 = Source or Text string containing the 0 = Clear 0 = error nil = No error
Clear Point point as a default or source 1 = no error 1 = Bad point
custom label vector. 5 = Bad
OR 1 = Source command #
Integer containing the point
where J1-001 = 1, J3-001
= 65 (The number
increments the same as an
AHED-64 adapter).

Example:
result = LowLevelCmd(3, "J3-001", 1)
This example sources the point, J3-001.

61
Low Level Function

Read / Clear Read Vector


Low Level Function: Read / Clear Read Vector (Easy Touch & 1100 only)
This low level command operates similar to the source function. It points the read vector )
(vmpoint) to the desired point but does not actually read anything.

Note: Currently, there is no reason to call this function. It is here for future use.

command point set result error


4 = Read or Text string containing the 0 = clear 0 = error nil = No error
Clear Point point as a default or 1 = read 1 = no error 1 = Bad point
custom label 2 = Bad integer
OR 5 = Bad command #
Integer containing the point
where J1-001 = 1, J3-001
= 65 (The number
increments the same as an
AHED-64 adapter).

62
Low Level Function

Set Current
Low Level Function: Set Current (Easy Touch & 1100 only)
This low level command simply turns on/off the current source and sets its value. It does )
not send the current anywhere. Use the SetSourceVector function to send the current
through the normal analog channels or use the RouteCurrentToRelay and
TurnOnRelay functions to send the current through the relays. The input currents given
below are approximate. The actual current (in amperes) is returned in the result.

The low level function format to set current is:


result, error = LowLevelCmd(command, level)
where the inputs and outputs are defined as follows:

command level result error


5 = Set Current (approximations) Floating point nil = No error
On or Off 0 = current off number of the actual 2 = Bad integer
1 = 3 uA current in amperes 4 = Current out of range
2 = 12uA 0 = error 5 = Bad command #
3 = 30 uA
4 = 110uA
5 = 376uA
6 = 2mA
7 = 6mA

Example:
fCurrent = LowLevelCmd(5,7)
This example turns on 6 mA of current.

63
Low Level Function

Measure Voltage
Low Level Function: Measure Voltage (Easy Touch & 1100 only)
The greatest accuracy for this low level command will be obtained if at least one of the )
points is at two volts or less with respect to ground. This is always the case if that point is
sunk. See LowLevelCmd 1 on how to sink a point.

If you are using relays to route the current to a point, you cannot directly measure its
voltage using this command. Add an external connection to tie that point to another point
on the tester so you can measure its voltage there.

Note: YOU CANNOT MEASURE ANY VOLTAGE GREATER THAN 5.5 VOLTS.
APPLYING EXTERNAL VOLTAGE TO THE TESTER CAN DESTROY IT.

The low level function format to measure voltage is:

result, error = LowLevelCmd(command, highpoint, lowpoint)

where the inputs and outputs are defined as follows:

command highpoint lowpoint result error


6 = Measure For each of two points: Floating point nil = No error
voltage Text string containing the number 1 = Bad point
between two point as a default or containing the 2 = Bad integer
points custom label measured
5 = Bad command
OR OR voltage (positive
#
or negative) in
one input to just Integer containing the
volts.
measure the point where J1-001 = 1, J3-
001 = 65 (The number 0 = error
voltage
on that point increments the same as an
AHED-64 adapter).

Example:
fVoltage = LowLevelCmd(6, 3, "J1-001")
This example will return the measured voltage between J1-003 and J1-001 if using an
AHED-64 adapter. The first point given is expected to be the high point similar to the "red"
lead on a voltmeter.

64
Low Level Function

Route Current to Relay


Low Level Function: Route Current to Relay (Easy Touch & 1100 only)
Use this low level setting if you want to perform four-wire resistance measurements using )
the low current sources, or if you want to source more than one point at a time. The
current does not normally route through the relays. For a normal resistance
measurement, leave the current in its default state.

Use the Delay (0.010) command after calling this command to allow time for the current
source to be switched over.
The normal resistance measurement and other functions won't work properly if you forget
and leave the current routed through the relays.

The low level function format to route current to relay is:


result, error = LowLevelCmd(command, through)
where the inputs and outputs are defined as follows:

command through result error


7 = Route 0 = through normal source vector (default 0 = error nil = No error
Current through state) 1 = no error 1 = Bad point
Source Vector 1 = through relays 2 = Bad integer
or through The tester normally vectors the current 5 = Bad
Relays through the source vector. command #
5 = SCSI scripts require that we test without
relays connected to the current source.
1500V hardware has a wire connecting
them unless we turn on a relay on the HV
card connecting the HV source to the
outside.

Example:
result = LowLevelCmd(7, 1)
This example will route the current through the relays.

65
Low Level Function

Master Clear
Low Level Function: Master Clear (Easy Touch & 1100 only)
)
Use this low level setting to unsink and turn off relays for all points. It disconnects the
current source from the test points. It does not affect where the current is routed (to
relays).

The low level function format for Master Clear is:


result, error = LowLevelCmd(command)
where the inputs and outputs are defined as follows:
command result error
8 = Master Clear 0 = error nil = No error
1 = no error 5 = Bad command #

Example:
result = LowLevelCmd(8)
This example will unsink and turn off relays for all points.

Set All Default


Low Level Function: Set All Default (Easy Touch & 1100 only)
)
Use this low level setting to reset the current source in addition to the Master Clear setting.
Use this function to return the tester to its normal operating mode. It is a good idea to call
this after finishing a script containing low level commands so the tester does not get
confused with any stuff set up within the script. Also, use this command in the middle of a
script to restore the hardware to a default state. This function does not affect any digital
I/O or the serial port.

The low level function format to set all default is:


result, error = LowLevelCmd(command)
where the inputs and outputs are defined as follows:
command result error
9 = Set All Defaults 0 = error nil = No error
1 = no error 5 = Bad command #

Example:
result = LowLevelCmd(9)

This example will reset the tester for further testing.

66
Low Level Function

Set High Current


Low Level Function: Set High Current (Easy Touch & 1100 only)
Use this low level setting to set the high current source. It can be used to measure highly )
inductive devices using the high current source since you can put in your own stabilization
time. Using the High Current Source requires that you instruct the High Voltage card to
route the current onto the HV buss. You also need to engage relays to source and sink the
current. This means the current must flow out of and back into the High Current Source
electronics. Due to the restrictions for using this command, it should be used with Cirris
Systems’ engineer direction only. Contact Cirris for application details.

Note: The high current source must only be used for short time periods. Turn it off as soon
as you are done measuring or it can damage the circuit on the high voltage card.

The low level function format to set all default is:

result, error = LowLevelCmd(command)


where the inputs and outputs are defined as follows:

command current result error


12 = Set High 0 = Turn current -1 = Current source nil = No error
Current source off off 1 = Bad point
or or 2 = Bad integer
Floating point number Floating point 5 = Bad command #
containing the current number containing 6 = Bad float
in amperes. Current the measured
must be > .009 & < current in amps
1.1 amps or
0 = error

Example:
local fCurWanted = 1.0 – default current to 1 amp
if aCur[1] = = 2 then
fCurWanted = 0.25 – want current at ¼ amp
end
local fCur = LowLevelCmd(12, fCurWanted) – turn current on
local fVolts, err = LowLevelCmd(6, wSenseHi, wSenseLo)
if (err ~= nil) and (err ~= 0) then
error(“Invalid test point(s)”)
end
LowLevelCmd(12, 0) – turn current off
LowLevelCmd(9) – reset tester to default state

This function sets the high current source to ¼ amp. It measures the voltage and then
turns the high current source off. It then resets everything back to a default state.

67
Measurement and Test Functions

Measurement and Test Functions


Cirris.HipotNetTiedToPoints

Cirris.HipotNetTiedToPoints (CH2 only)

This function is used for the CH2 tester. This function has the same use and parameters
as the function HipotNetsTiedToPoints used by the Easy Touch and 1100H Testers. See
HipotNetsTiedToPoints on page 76 for more information.

Cirris.HipotPointMask

Cirris.HipotPointMask (CH2 only)

This function is used for the CH2 tester, and has the same use and parameters as the
function HipotPointMask used by the Easy Touch and 1100H Testers. See
HipotPointMask on page 80 for more information.

68
Measurement and Test Functions

EPROM

EEPROM 1100 & Easy Touch Only

Use this function to talk to an I2C (like 24LC00). See the MicroLan function to talk to
Dallas Memory tokens using the MicroLan protocol. The valid address range for writing to
and reading from is the address range of the eeprom. For example on an eeprom with 8
bytes, the valid range is 1-8. To talk to an eeprom on the scanner test points, some setup
is needed. Connect a 10 K ohm resistor from VCC (pin 8) to sclk (pin 6) and another one
from VCC (pin 8) to sdata (pin 5). Tie pins 1-4 (address & GND) together to establish an
address for the part. Leave pin 7 floating (low) or pull to ground (pin 4).

The full format of this function is:

myResults = EEPROM (myInputs)


where myInputs and myResults are defined in the table below.

myInputs myResults
1, GndPt, VCCPt, ClkPt, DataPt Setup nil = OK
OR
Error code
2 Clean up and disconnect nil = OK
from the device. OR
Error code
3, [fromAddress] Read a byte from the nil = OK and returns byte
EEPROM read
OR
Error code
4, toAddress, Data Write a byte to the nil = OK
EEPROM OR
Error code
5, fromAddress, MaxNumChars Read text nil = OK and returns text
read
OR
Error code
6, toAddress, Data Write text nil = OK
OR
Error code

69
Measurement and Test Functions

Example
EEPROM(1, GroundPt, VCCPt, ClkPt, DataPt)
EEPROM(6, 0, "testkd") -- write "testkd" to eeprom
theResult = EEPROM(5, 0, 90) -- read "testkd" (90 chars max) from eeprom
EEPROM(4, 4, ascii("e")) -- replace the "k" with a "e"
theResult = EEPROM(5, 0, 90) -- read "tested" from eeprom
print(theResult)
EEPROM(4, 5, 248) -- write a 248 to location 5
theCharNum = EEPROM(3, 5) -- read the 248 from where "d" once was
print(theCharNum) -- get the non-ascii number
EEPROM(2)

This example sets up the eeprom and then writes "testkd" to the eeprom. It reads back up
to 90 characters maximum, including the "testkd". It then replaces the "k" with an "e" to
form "tested" and again reads from the eeprom. It then writes a byte 248 to location 5 and
then reads it out again from location 5. Finally, it does cleanup setting everything back to
a default state.

70
Measurement and Test Functions

GetCapMeasurement

GetCapMeasurement (point1, point2)


The full format of this function is:
capacitance, error = GetCapMeasurement (point1, point2)

This function returns the measured capacitance between two points. The points can be
integer values representing system points, or strings representing point labels. Depending
on whether the points are valid, the function returns capacitance and error as shown in
the table below.
capacitance error
If the input points are valid Floating point number representing Nil
the capacitance measurement
If the input points are not valid 0 -99

It is good practice to check that error value is nil before using it in further calculations.

Example:
sPoint1 = "J1-001"
sPoint2 = "J2-005"
fCapacitance, iError = GetCapMeasurement(sPoint1, sPoint2)
if(iError == nil) then
MessageBox(format(“Capacitance between %s and %s is %.2f nF”, sPoint1, sPoint2,
fCapacitance/1e-9))
end

In the example, GetCapMeasurement returns the measured capacitance value between "J1-
001" and "J2-005" to fCapacitance. It displays a message box with the measured
capacitance value.

71
Measurement and Test Functions

GetRelCapMeasurement

GetRelCapMeasurement (shield, reference) 1100 & Easy Touch Only

Use this function to identify that a shield is in a given position. Cable shields are in close
proximity to other many nets in a cable; hence shields have higher capacitance relative
to the other wires in the cable.
This function measures the capacitance between a test point, which you believe is
connected to the shield, to all other cable nets. This function also measures the
capacitance of another test point that you believe can be used as a reference of a wire in
the cable. Finally, this function divides the shield measurement by the reference
measurement to return a floating point number representing the ratio. For example, if a
shield were five times more capacitive than the reference point, the function will output a
floating point number of about 5. The function also returns value that verifies the
selected shield and reference points are valid.

The full function definition is as follows:


ratio, valid, = GetRelCapMeasurement (shield, reference)
The value of ratio can be between a floating point number between 0.01 and 100. If one
of the points is invalid, the ratio will be zero and valid will return -99. If both points are
valid, valid will return nil. The inputs shield and reference are string inputs
representing any system points (such as 35 and 87), default labels (such as J2-003 and
J3-22), or custom point labels (such as Shield and Brown wire).

Example
sShieldPoint = "J1-026"
sReferencePoint = "J1-005"
fRatio, myResult = GetRelCapMeasurement(sShieldPoint, sReferencePoint)

The example above will find the ratio of capacitance of a shield with respect to the
reference point, J1-005. The shield point is a point tied to the shield. The reference point
is used as a point within the shield.

72
Measurement and Test Functions

GetResistanceMeasurement

GetResistanceMeasurement (point1, point2)


This function returns the measured resistance value between two points. The returned
resistance measurement is returned as a floating point number. The input point1 and
point2 may be integers representing system points (6, 57), strings representing system
points (“6”, “57”), strings representing attached test points (“J2-003”, “J3-22”), or strings
representing custom pin labels (“Wire 207”, “Shield”).

The full function definition is:


resistance, valid = GetResistanceMeasurement (point1, point2)
If one or both of the input points is invalid, the function returns 0 for the resistance
measurement and returns a -99 for valid. If both points are valid, the function returns nil
for valid. It is good practice to check the valid is nil before using the resistance
measurement in further calculations.

Example1
myPoint1 = "J1-001"
myPoint2 = "J2-005"
fMeasuredValue, myResult = GetResistanceMeasurement(myPoint1, myPoint2)

The function will return the measured resistance value between "J1-001" and "J2-005" in
fMeasuredValue. The result, myResult, will be nil if there is no error.

Example2
local fStrapRes = GetResistanceMeasurement(VPlusStrap, ConnectingStrap)
if fStrapRes > 1.0 then
MessageBox("AD5P-68A Adapter Not Found")
end

The example gets the measured resistance value to check if the adapter strapping is
correct.

See the function GetResistanceMeasurement4W on the next page to get measured


resistance values between two four-wire points.

73
Measurement and Test Functions

GetResistanceMeasurement4W

GetResistanceMeasurement4W (point1, point2)


This function returns the measured resistance value between two 4-wire test points.
Note that each of the 4-wire points should be designated as a 4-wire point in the wire list,
and be physically connected to a 4-wire force or 4-wire sense mate. Note also, the tester
also has requirements as to which test points can be used as 4-wire force and 4-wire
sense points.

The returned resistance measurement is returned as a floating point number. The input
points point1 and point2 may be either a force or sense points, but each must have its
four wire mate. The input points must be strings representing system points (“35”, “87”),
strings representing labeled test points (“J2-003”, “J3-22”), or a string representing
custom pin labels (“Force1” or “Force3”).

The full function definition is:


resistance, valid = GetResistanceMeasurement4W (point1, point2)

If only one of the input points is not a valid 4-wire point, the function returns 0 to
resistance and -99 to valid. If both points are valid, the function returns nil for
valid. It is good practice to check that valid is nil before using the resistance
measurement in further calculations.

Example

my4WPt1 = "J1-003"
my4WPt2 = "J1-005"
fMeasuredValue, myResult = GetResistanceMeasurement4W(my4WPt1, my4WPt2)
if myResult == nil then
MessageBox(“4W Resistance Value is:”..fMeasuredValue)
end

The function will return the measured four-wire resistance value between "J1-003" and
"J1-005" in fMeasuredValue. myResult will be nil since there is no error.

Frequently you may use the GetPtType and Get4WPairPt functions in conjunction with
this function. See the function GetResistanceMeasurement on the previous page to do
a standard resistance measurement between two test points.

74
Measurement and Test Functions

GetTotalCapMeasurement

GetTotalCapMeasurement (points) 1100 & Easy Touch only

The full format of this function is:


capacitance, error = GetTotalCapMeasurement (points)

This function returns the total capacitance between one or more points specified in
points and all other points of the device under test. The input points is a string with
multiple points being separated by a space. Points can be integer values representing
system points, or strings representing point labels. Depending on whether the points are
valid, the function returns capacitance and error as shown in the table below.
total capacitance error
If the input points are valid Floating point number representing Nil
the capacitance measurement
If the input points are not valid 0 -99

It is good practice to check that value of error is nil before using it in further
calculations.

Example:
sPoints = “J1-003 J1-005”
fCap, iError = GetTotalCapMeasurement(sPoints)
if iError == nil then
MessageBox(format("Point: %s, Cap: %0.1f pF", sPoints, fCap / 1e-12))
else
MessageBox(format("Point/s: %s is/are not valid", sPoints))
end

If the specified points J1-003 and J1-005 are valid, a message box will display the
capacitance between these points and all other points in the device under test. If the
specified points are invalid, a message box will display the invalid points.

75
Measurement and Test Functions

HipotNetTiedToPoint

HipotNetTiedToPoint (Easy Touch and 1100 only)

This function causes hipot to be applied to a single net and returns the leakage
resistance value and the test results of the hipotted net. All points of the DUT outside
the net are held at ground while the net is hipotted. The input of this function is a single
point; however the tester will apply hipot simultaneously to all points that are defined in
the wire list as being connected to the defined point.
The function HipotNetTiedToPoints can perform the same task as this function, or
apply hipot to multiple nets at the same time. Inputs and outputs are identical to both
functions, with the exception that function HipotNetTiedToPoint only allows you to input
a single point. Since HipotNetTiedToPoints is more versatile, we suggest using it
rather than this function. See function HipotNetTiedToPoints for more information.

HipotNetsTiedToPoints

HipotNetsTiedToPoints (Easy Touch and 1100 only)

This function causes a high voltage test to be applied to one or more nets. An
equivalent command, Cirris.HipotNetTiedToPoints is used for the CH2 tester. The input
to this function is one or more points. Each point may be an isolated point such as an
unused connector contact, or one point of a larger net on the tested device. If the point
is part of a net, the tester will hipot all points of the net. While a hipot is applied, all other
DUT points are held at ground. This allows a hipot test to ensure the hipotted net or
nets are sufficiently isolated from other nets. The function returns the leakage
resistance in terms of ohms and the test results of the hipotted net or nets.
If you want to use this function to apply hipot to only one or to certain nets in a tested
device, turn off hipot in the test program. This function will apply hipot even with high
voltage testing turned off in the test program. If the optional high voltage parameters for
this function are not specified, the function will use the hipot settings used in the test
program.
You may choose one of three different formats depending on the high voltage testing
complexity and whether the tester has AC voltage capability. The advanced format
allows you to control all the high voltage settings you can control in the easy-wire
software. When using the advanced settings, note that the DW Voltage must be equal
to or higher than the IR voltage. Additionally, the IR voltage must be set sufficiently high
for the tester to measure some IR resistances. Using the test window to try advanced
settings will ensure the settings are valid. The three different formats are as shown on
the following pages.

76
Measurement and Test Functions

Simplified Format
result, measured = HipotNetsTiedToPoints(point1 [point2…,voltage, insulres, dwell,
maxsoak]
Advanced DC Format
result, measured = HipotNetsTiedToPoints(point1, [point2…,voltagetype, DWVvoltage,
DWVcurrent, dwell, IRvoltage, IRinsulres, timegoodfor, soaktime, soakuntilgood])
Advanced AC Format
result, measured = HipotNetsTiedToPoints(point1, [point2…,voltagetype, frequency,
DWVvoltage, DWVcurrent, dwell, IRvoltage, IRinsulres, timegoodfor, soaktime,
soakuntilgood])

Inputs and outputs to these functions are defined in the following tables.

inputs input description


point This input can be a string representing the adapter or attached connector
point label such as “J1-0017”, a string or integer representing the system
point such as 189, or a string representing a pin label such as “RED WIRE”.
Multiple points are designated with a space such as “J1-A J2-K J3-19”.
voltage This input is a floating point number representing the DC high voltage
applied during both the Dielectric Withstand (DW) test and Insulation
Resistances (IR) test.
voltagetype This input is a string representing the voltage type, either AC or DC, applied
during the DWV test. The string value is either “AC” or “DC”.
frequency If AC is specified for voltagetype, use frequency to specify the AC
frequency in terms of hertz. This input can be specified as 25, 30, 50 or 60.
If DC is specified for voltage type, no frequency input is used.
DWvoltage This input is a floating point number representing voltage applied during the
Dielectric Withstand (DW) Test. DWvoltage can be specified as any within
the high voltage range of the tester. The tester will only allow a DW voltage
that is equal to or higher than the IR voltage.
DWcurrent This input is a floating point number that represents the maximum current in
terms of amps that can flow into the hipotted net during the Dielectric
Withstand (DW) test.
dwell If used with a DC Dielectric Withstand (DW) Voltage, this input is a floating
point number (0.01 to 120) that represents the time in seconds that high
voltage is applied to each net during the DWV test.
If used with an AC Dielectric Withstand (DW) Voltage, this input is a integer
representing the number of AC cycles that are applied to each net during
the DWV test. The range is 1 to 7200 with a frequency of 60 Hertz is used.
However, the range varies depending on the selected frequency.
IRvoltage This input is a floating point number that represents the voltage that is
applied during the Insulation Resistance (IR) Test. The range for this
number is determined by the high voltage capability of the tester.

77
Measurement and Test Functions

Inputs continued

inputs Input Description


IRinsulRes This input is a floating point number that represents the minimum resistance
in terms of ohms allowed between unintended connections. The range for
this value is 50000000 to 1000000000, which equates to 50MΩ to 1GΩ.
timegoodfor This input is a floating point number that represents the duration of the
Insulation Resistance (IR) Test in terms of seconds. The range for this input
is .002 to 120.
soaktime This input Is a floating point number that represents the time in terms of
seconds high voltage is applied to stabilize the measurement before doing
the Insulation Resistance (IR) Test. The range for this input is .002 to 120. If
soak until good is turned on, the actual soak time may be less.
soakuntilgood This input is set to either 0 or 1. If set to 0, the Soak Until Good setting is off
meaning the IR Voltage will be applied for the entire soak time. If set to 1,
Soak Until Good is on, meaning once the cable has reached a passing
insulation resistance (IR) test threshold, the soak will terminate and the IR
test time will start.

Output Output Description


result 0 = Passed Test
1 = Has leakage
2 = Overcurrent
3 = Dielectric Failure
99 = Other Failure
100 = Invalid Test Point
110 = * Invalid Frequency
111 = * Invalid DWV Voltage
112 = * Invalid DWV Max. Current
113 = * Invalid DWV AC Duration
115 = * Invalid IR Voltage
116 = * Invalid IR Insulation Resistance
117 = * Invalid IR Good For
118 = * Invalid Soak
119 = * Invalid Soak Until Good

* = If these errors occur, the hipot test will not be performed.


measured Floating point number representing the measured leakage resistance
OR
0 for some RESULT1 errors (2, 3, 99)

78
Measurement and Test Functions

Examples:
This example hipots the net tied to the point, J1-001, using the high voltage parameters in
the test program. The variable iResult will contain the test result.
iResult = HipotNetsTiedToPoints("J1-001")

This example uses the simplified format to hipot the net tied to the custom test point label,
Blue. It uses the inputs which are independent of the settings in the test program. High
voltage Is set 50 volts, insulation resistance to 5M ohms, and duration to 30 seconds. No
soak time was given so it will be set to zero. The variable iResult will contain the test
result and fMeasResis will contain the measured leakage resistance.
iResult, fMeasResis = HipotNetsTiedToPoints("Blue", 50, 5000000,30)

This example hipots the points using optional parameters, which are independent of high
voltage test settings in the test program. A high voltage warning message will display
during the hipot. If an error occurs, a message box will display the error.

sPoints = "J1-001 J1-002 J1-003"


fVoltage = 50.0
fHipotInsRes = 10000000
fDuration = 0.100
fMaxsoak = 0.010

local iDNum = DialogOpen("Warning: High Voltage")


local iErr, fRes =
HipotNetsTiedToPoints(sPoints, fVoltage,
fHipotInsRes, fDuration, fMaxsoak)
DialogClose(iDNum)

local sErr
if iErr == 1 then
sErr = format("Has leakage (%i M ohms)", fRes/1000000)
elseif iErr == 2 then
sErr = "Overcurrent"
elseif iErr == 3 then
sErr = "Dielectric Failure"
elseif iErr ~= 0 then
sErr = format("Unexpected error #%i", iErr)
end

if iErr ~= 0 then
MessageBox(sErr)
end

79
Measurement and Test Functions

HipotPointMask

HipotPointMask (Easy Touch and 1100 only)

When high voltage testing is turned on, high voltage is applied to each of the nets
defined in the test program. This function allows you to mask a point that would
normally be high voltage tested in the test program. If you use this function to mask one
point of a net, no other point of the net will have high voltage applied to it during the high
voltage test. Note the CH2 tester uses an equivalent function, Cirris.HipotPointMask.

While you can use this function to subtract points from the tester’s list of points that will
be high voltage tested, you can also use this function to add points back to this list. Note
however, that un-checking the setting Hipot All Adapter Pins (Not just Connection),
means that unconnected test points in the DUT will not be in the tester’s list of points to
be tested. You cannot use this function to mask these points on.

The full format for this function is:

hipotpoints, invalidpoints = HipotPointMask (select [,testpoints])

The optional input testpoints is a string of the point or points that can be added to hipot
point list when the input select is 1. On the other hand, testpoints will be subtracted
from the hipot list when select is 0. The input select is an integer value that directs the
function as follows:
If select equals, the function will:
0 Subtract point or points from the hipot list
1 Add point or points to hipot list
2 Subtract all points from hipot list
3 Add all points to hipot list
Note the function can return hipotpoints, a string value of the points to be high voltage
tested. Additionally the function can return invalidpoints, a string of the points from
the hipot list that are invalid because they are not defined for the test. Test points can
be specified by their connector points, or by their test point label.

Examples:
sNewHipotPoint = HipotPointMask (0, J1-013)

Point J1-13 is removed from the tester’s existing list of points to be high voltage tested.
The points that will be tested are returned to the string variable sNewHipotPoint.

80
Measurement and Test Functions

LearnCable

LearnCable (Easy Touch and 1100 only)

Use this function to learn a cable that is connected to the tester. The cable is learned as
a wirelist and saved to the tester’s embedded memory.

The full format for this function is:


result, error = LearnCable([1, filename,][2, description,][3, testparameters,]
[4, learncomponents,][8, noconnectlearn])

The function can return two outputs. The output result, is a text string containing
messages. The output error is a text string containing errors.

To control learn settings, the following optional inputs may be used to the function:
1, filename String filename specifies a test wire list file for the learned
cable. This name cannot be the same as the wirelist currently
in memory.
2, description String description specifies a description for the cable.
3, testparameters String testparameters specifies the low and high voltage
parameters used for the test.
4, learncomponents Integer learncomponents specifies the components types
learned in the test. 1 = resistor, 2 = capacitor, 4 = diode,
8 = twisted pair, 11 = all but diodes, 15 = all
8, noconnectlearn If noconnectionlearn is the integer 0, the learn will not occur if
no connections are found. If greater than 0, the learn will
happen even if no connections are learned.

If no optional inputs are given, the function will learn a cable with the following test
settings:
filename = untitled.wir
cable description = last learned
connection resistance = 10 
lv insulation resistance = 100k 
hipot = off
components to learn = no
Learn with event or custom component scripts = no
learn if no connections = yes

The functions CopyPcFileToEmbedded and CopyEmbeddedFileToPc are often used in


conjunction with the LearnCable function.

81
Measurement and Test Functions

Examples:
sResultMessage, sErrorText = LearnCable (1,”batch1.wir”, 4, 1)
This example will learn the cable and save the wirelist as batch1.wir. The cable will be
learned with the default low voltage and high voltage parameters. It will also learn
resistors.

sResultMessage, sErrorText = LearnCable(3,“connection resis 5


ohm\nlv insulation resis 10k ohm\nhipot voltage 1000V\ninsulation
resis 500 M ohm\nhipot duration 0.100 sec\napply hipot to all
adapter pins”)
In this example, the cable will be learned with the supplied low and high voltage settings.
The default wire list file name and cable description will be used.

MicroLan

MicroLan (Easy Touch and 1100 only)

Use the MicroLan function to talk to Dallas Memory tokens using the MicroLan protocol.
See EEPROM to talk to an I2C like a 24LC00.

The full format for this function is:


result = MicroLan(input)
Where result and input are described in the table below.

input Description result


Nothing Returns function description
1, DataPt, GroundPt Setup
2 Cleanup – Disconnects from
device.
3 Read a byte from the memory Returns byte read
token using MicroLan protocol.
4, Data Write a byte to the memory
token.
5 iPresent. 1 (yes) or 0 (no)
6, NumChars DS1993 specific command:
Read a text string from memory.
Skips over ROM bytes.
7, Data, NumChars DS1993 specific command:
Write a text string to memory.
8, SpecPin= 1(J1),2(J3),… Prepare to communicate to Only used
special pin. internally by Cirris.

82
Measurement and Test Functions

Examples:

The following example sets up the Dallas DS1993 (or DS1994) chip. It then checks to
see if it is present. If it is present, it writes the text "Hello There Fred" and reads it back
out.

MicroLan(1, dataPt, gndPt) -- setup


isPresent = MicroLan(5) -- is present
if isPresent == 1 then
outtextxy(2,20,"Is attached ")
MicroLan(7, "Hello There Fred", 17) -- write text
local theText = MicroLan(6,80) -- read text
outtextxy(2,21,theText)
else
outtextxy(2,20,"Not attached ")
end
MicroLan(2) -- cleanup

The following example verifies the chip is attached to the tester, reads the product code
identifying the part type and the first byte of the product serial number. See the Dallas
Semiconductor product documentation for the bytes to send to your components to get
the data you want out.

MicroLan(1, dataPt, gndPt) -- setup


isPresent = MicroLan(5) -- is present
if isPresent == 1 then
outtextxy(2,18,"Is attached ")

MicroLan(4, 51) -- write data byte and read ROM command(33h)


theProductCode = MicroLan(3) -- read data byte.
theFirstSerNumByte = MicroLan(3) -- read data byte.
else
outtextxy(1,18," Not attached ")
end
MicroLan(2) -- cleanup

83
Measurement and Test Functions

TestWirelist

TestWirelist (Easy Touch and 1100 only)

The full format for this function is:


result = TestWirelist (testnum)

This function performs one of the three tests on the wirelist of the loaded test program.
The input, testnum, is an integer number that identifies which of the three tests to
perform as shown in the table below.
testnum test
3 LV test only
4 HV test only
255 LV, Components, & HV tests

The function returns result, an integer that identifies the results of the test as shown in
the table below.
result test
0 Test Passed
3 LV tested failed (includes components test)
4 HV test failed

If the test fails, you can also use the function TWLGetErrorText to return the error text
that relates to the value of result.

Use the function UseChildWirelist to load the child wire list before calling TestWirelist to
test. When TestWirelist is used to perform a high voltage test, the high voltage test is
performed on all the nets. If you want to hipot one or selected nets, use the functions
HipotNetTiedToPoint or HipotNetTiedToPoints. The TestWirelist function does not affect
SPC Data Collection or the cable test counters.

Examples:
local iTestVal = TestWirelist(3)
The function will perform the low voltage and components test on the current wirelist.

local iTestVal = TestWirelist(255)


The function will perform all tests (low voltage, components, high voltage) on the current
child wirelist.

See also the example in the function, UseChildWirelist.

84
Measurement and Test Functions

UseChildWirelist

UseChildWirelist (Easy Touch and 1100 only)

result = UseChildWirelist(wirelist)

This function has two formats. In the format shown above the UseChildWirelist function
loads a wire list from memory or disk. The function TestWirelist can then be called to test
the wire list. The input wirelist is a string that defines an optional path and the wire list
name. The function returns 0 to result to indicate the wire list loaded successfully, or a
nonzero integer if the wire list failed to load.

UseChildWirelist(stop)

In this format, the function will stop using the wire list, and depending on the integer
value of stop, either leave the wirelist in memory or free the wire list from memory as
shown below.
stop Description
0 Stop using the current child wire list but leave it in memory.
1 Stop using the current child wire list and free the memory.

This function allows you to load multiple child wire lists into memory where they can be
quickly recalled and used at one at a time. After finishing using all the wire wirelists,
remove all of the wire lists from memory by calling this function again.

Example 1
iCouldntLoad = UseChildWirelist(sChildWLFilename)

This example will load the named wire list contained in the string, myChildWLFilename and
make it the current wire list running on the tester.

85
Measurement and Test Functions

Example 2
TestArray = {"test1.wir", "test2.wir", "test3.wir" }
iNumTests = 3
iTesting = 1
while iTesting == 1 do
iButtonNum = MessageBox("Test all", "Yes", "Done")
if iButtonNum == 1 then
iTestIndex = 0
while iTestIndex < iNumTests do
MessageBox(format("Ready to test # %i", iTestIndex+1))
-- display the test number so user can get ready
iLoadFailed = UseChildWirelist(TestArray[iTestIndex])
-- make it current, loading wirelist from disk or memory as needed
if iLoadFailed ~= 0 then
MessageBox("Couldn't load wirelist")
else
iTestResult = TestWirelist(255) -- perform all tests
if iTestResult ~= 0 then
sErrors = TWLGetErrorText(iTestResult)
MessageBox(sErrors) -- Show them what failed
end
UseChildWirelist(0)--Leave in memory, to get quickly next time
end
end
else
iTesting = 0 –- Done, will cause tester to exit loop
end
end
iTestIndex = 0
while iTestIndex < iNumTests do
UseChildWirelist(TestArray[iTestIndex]) -- make it current
UseChildWirelist(1) -- free it from memory
end

This example will loop through the child wirelists: test1.wir, test2.wir and
test3.wir. Test1.wir will be loaded and if no errors occur during loading, testing will
be done using test1.wir. After testing, the child wirelist will be left in memory for
quick access in the future. The script will continue for each of the child wirelists. At the
end of loading and testing all the child wirelists, each child wirelist will be loaded and
freed from memory.

86
Printer Functions

Printer Functions

Notes on Printing
When formatting strings to print, the Cirris print functions in this section allow for either
the c-like or decimal escape codes such as those in the following table:

c-like code decimal code description


\n \10 new line
\f \12 form feed

Refer to the 5.1 Lua Manual for more information on formatting strings.

Printer Status Codes


Some Cirris print functions return an integer to reflect the printer status. The meaning of
these integers is shown table below.
status description
0 ready
1 printer not selected
2 timeout
3 I/O error
4 out of paper
5 printer busy

Cirris.EndPrintJob

Cirris.EndPrintJob()
Ends the print job. Used after Cirris.StartPrintJob and Cirris.Print.

87
Printer Functions

Cirris.GetPrinterNameByIndex

Cirris.GetPrinterNameByIndex(number)
This function is useful to find the exact name of a local Windows printer or a network
printer with its server path. The exact printer name is required for the Cirris.SetPrinter
function, which is used to direct printing to a printer other than the default printer.

The Cirris.GetPrinterNameByIndex function returns the name of a printer as a string.


The input number is an integer corresponding to one of the printers accessible to the test
system. The function Cirris.GetNumPrinters can be used to get the number of printers
accessible to the test system. For example, if Cirris.GetNumPrinters returned 3, you
could input a 1, 2, or 3 into Cirris.GetPrinterNameByIndex to see the exact names of
each of the three printers.

Example:
iNumberOfPrinters = Cirris.GetNumPrinters()
printer_names = ""
for i=0, iNumberOfPrinters-1 do
printer_names = printer_names..i..". "..Cirris.GetPrinterNameByIndex(i).."\n"
end
MessageBox("~Cirris.Print~".."Available Printers:\n"..printer_names.."\n")

The example above uses the function GetNumPrinters to find the number of printers,
and then uses the function GetPrinterNameByIndex to make a string of printers that are
then displayed using the message box function.

Cirris.GetNumPrinters

Cirris.GetNumPrinters()
Returns the number of Windows printers that are available to the tester. The number of
printers is returned as an integer, which can then be used in conjunction with the Get
PrinterNameByIndex to return the printer names.

Cirris.NewPage

Cirris.NewPage [(immediate)]
Starts a new print page. Subsequent data to print will be on the new page. If the
optional input immediate is 1, the function immediately causes the printer to output the
current page. Any data previously sent to printer will print on this page. If immediate is
not used or is 0, the printer waits until Cirris.EndPrintJob is called to print the page.

88
Printer Functions

Cirris.Print

Cirris.Print (string)
Outputs a string to the print spool. The function Cirris.EndPrintJob will cause the string
to be printed. The string can include the ASCII text to be printed, and escape codes
such as \n or \f to be applied to the string.

The full function definition is shown below. Note that three outputs can be returned.
number, status, error = Cirris.Print (string)
The output number identifies the number of characters sent to the print spool; status is
and integer that identifies the printer state (see
Printer Status Codes on page 87); error is a string that describes a print error.

Cirris.SetPrinter

Cirris.SetPrinter (name)
Selects the printer that will be used to print the subsequent print job. The input name is a
string that must exactly match a local Windows printer name or network printer name
with its server path. Use the function Cirris.GetPrinterNameByIndex to get the exact
system names of printers.

Note the function can return two outputs as shown below.


status, error = Cirris.SetPrinter (name)
The output status is an integer that identifies the printer state (see
Printer Status Codes on page 87); error is a string that describes a print error.

Cirris.StartPrintJob

Cirris.StartPrintJob()
Tells the print driver to start spooling the print job. This function will direct printing to the
Windows default printer, or to the printer selected by the function Cirris.SetPrinter. The
Cirris.StartPrintJob function is always followed by Cirris.Print and Cirris.EndPrintJob
functions.

The function has no inputs, but can return two outputs as shown below.
status, error = Cirris.StartPrintJob()
The output status is an integer that identifies the printer state (see
Printer Status Codes on page 87); error is a string that describes a print error.

89
Printer Functions

SendTextToParallelPrinter

SendTextToParallelPrinter(string [,return])
This function has been preserved so that scripts previously written for the Touch 1 and
1100 testers can be used with Easy Touch Scripting. When run in the Touch 1 and
1100 testers, the function would send a string to a parallel printer. However now when
used with Easy Touch scripting, this function sends the string to the Windows default
printer’s print spool, not the parallel port on the tester. The string can include the ascii
text to be printed, and escape codes such as \n or \f to be applied to the string.

There are a few notable differences when using this command with a modern printer as
opposed to a parallel printer. When sending a string to a parallel printer, the printer
prints immediately. On a modern printer no text is printed until a form feed (\f) is
received. Also, parallel printers accepted the escape code \r (return to beginning of line)
to overprint text at the beginning of a line. However, modern printers do not support this
feature and will replace, not overprint, existing text when a \r is used. Additionally some
parallel printers do not return to beginning of a line when a new line code (\n) is
received. Windows printers return to the beginning of a line when a new line code is
received.

This function allows an input return. If return is non zero, a carriage return (\r) is
always added with a new line code (\n). This setting was used to ensure a parallel
printer would return to the beginning of a line when it received a new line code (\n).

The function can return two outputs as shown:

number, status = SendTextToParallelPrinter(string, return)

The output number, is an integer representing the number of the characters that were
printed. The function also returns an integer to status. This integer identifies the
printer’s status as defined in printer status code table on page 87.

Examples:
sTextToPrint = "Text string to be printed"
iNumCharsPrinted, iStatus = SendTextToParallelPrinter(sTextToPrint)
The function will output "Text string to be printed" to the default printer.
iNumCharsPrinted will contain the number of characters printed and iStatus will contain a
number describing the current status of the printer.

SendTextToParallelPrinter("GOOD CABLE\f")

The function will cause "GOOD CABLE" to be printed on the default printer.

90
Test Information Functions

Tester Information Functions


Get4WPairPt

Get4WPairPt (point)
This function determines if a given point is a four-wire pair point. If the point is a four-
wire point, the function returns a string containing the label for the point. If not, or if the
function is unsuccessful, the function returns nil. The point can be specified as an
integer value representing the system point, or a string representing a point label.

Example:
iPinNumber = 3
testPoint = Get4WPairPt(iPinNumber)
if testPoint == nil then
error(iPinNumber .. “ is not a part of a 4W pair)
end
The RESULT, testPoint, will contain the label text if it is a fourwire pair point or nil if it is
not. If it is not a four-wire pair point, a message box listing the point will be displayed.

GetHardWareVersion

GetHardWareVersion()
This function returns the hardware version running on the tester. There are no inputs to
this function. The version is returned as a string.

GetProbedPin

GetProbedPin ( )
Use this function to get the number of the test point of the currently probed pin.

GetRawPointNum

GetRawPointNum (label)
This function returns the system pin number of a custom label. System pin numbers can
range be 1 and 1024 depending on the size of your test system. If the label string is
invalid, the function returns nil. If no input is supplied, this function returns a description
of itself.

Examples:
sLabelText = “GROUND”
iPinNumber = GetRawPointNum(sLabelText)
The function will return the pin number in iPinNumber for the GROUND custom label.

91
Tester Information Functions

GetPtType

GetPtType (point)
This function returns a value to identify whether a given point is Stress High or Stress
Low. Half of the test points on the tester can be used to supply current from the high
current source in the tester. Stress High is used to supply the current and Stress Low is
used to sink the current. This function is used ONLY for commands dealing with four-
wire resistance measurement and the high current source.

returned point type point

Integer containing one of the following An integer containing the pin


codes: number such as 82
1 = Stress High (can source high current) OR
2 = Stress Low (can sink high current) A string containing the point label
such as “J3-008”

GetTimeAsText

GetTimeAsText (select)
This function returns current tester time information as a text string. The returned time
information is determined by the integer input used as shown below. See also the
related function GetTimeasInteger.

Returned Time Information select


Current tester hour 0 - 23 1
Current tester minutes 0 - 59 2
Current seconds 0 - 59 3
Current time in the format HH:MM:SS 4
Number of “clock ticks” since the tester was turned on. See the definition 5
of clock ticks in GetTimeAsInteger function.

92
Tester Information Functions

GetTimeAsInteger

GetTimeAsInteger (input)
This function returns current tester time information as an integer. The type of returned
time information is determined by the input number as shown below. See also the
related function GetTimeasText.

Returned Tester Time Information input


Current tester hour 0 - 23 1
Current tester minutes 0 - 59 2
Current tester seconds 0 - 59 3
Number of “clock ticks” since the tester was turned on. 4
There are 1000 clock ticks per second. Clock ticks begin incrementing from 0
when you turn on the tester, increment up to 2147483, the begin at -2147483
and again increment to 2147483 again and so forth.

GetSystemInfoAsText

GetSystemInfoAsText (select)
This function returns system information about the tester as a string. The system
information that is returned is determined by the integer value of select, as shown in the
table below.
returned tester information select
Tester serial number (8 characters) 1
Login name that was used to log into the tester 2
Software version of the tester 3
Hardware version of the tester 4
Number of system test points 5
Maximum scanner voltage of the tester 6
Tester type 7

WiresAttached

WiresAttached ()
Use this function to determine if a cable is present. It checks only the
adapters/connectors listed in the currently loaded test. The function returns nil if the
tester does not sense a wire connection, and 1 if a connection is sensed. There are no
inputs to this function.

93
Test Information Functions

Test Information Functions


Cirris.BadCount

Cirris.BadCount
Returns the total of assemblies tested bad in all test runs.

Cirris.CableID

Cirris.CableID
Returns the cable ID for the cable being tested. For cable ID’s to be recorded, a method
for serial numbering must be selected under the Test Defaults Tab in the Test Editor.

Cirris.GetAdapters

Cirris.GetAdapters(mode, [index]) (Easy Touch and 1100 only)

This function returns information on the adapters involved with a test. There are three
modes in which this function can be called as detailed below:
Mode Mode Description Number of Return Value
Return Descriptions
Values
Learn – Performs a “Learn” operation and
Number of
discovers all adapters attached to the tester
0 1 Learned
and then returns the number found (only used
adapters
in EVT script, event 1)
Get Index – Returns the position, signature,
Position,
and strapping of the adapter at the index
1 3 Signature,
specified by the second parameter to the
Strapping
function call (first adapter is at index 0)
Get Count – Returns the number of attached
adapters as determined by the loading of the Number of
2 1
wirelist (i.e. only adapters specified in the verified adapters
wirelist will be considered)

The Learn mode can only be called in an event script triggering upon event 1. This is
because the “Learn” operation performed by GetAdapters will erase test state data and
will cause the error “Not Ready to Test” when the test continues to execute after the Lua
call. Calling GetAdapters during event 1 is allowed because it occurs before the test is
initialized.

To get adapter information from a component script or other event number, use the Get
Count mode to get the number of adapters available.

After calling GetAdapters in either Learn or Get Count mode, the function can be called

94
Test Information Functions

in Get Index mode with a second parameter (index) in order to get information on a
specific adapter. The index provided must be in the range of 0 to (AdapterCount – 1)
where AdapterCount is the value returned from GetAdapters in Learn or Get Count
mode.

Example:

local sOutput = "Adapter Information:\n"


local iCount = GetAdapters(2)

for iIndex = 0, iCount-1 do


local Position, Signature, Strapping = GetAdapters(1, iIndex)
if Position == nil then
sOutput = sOutput.. "Invalid index: "..tostring(iIndex)
else
sOutput = sOutput.. tostring(iIndex).."\n"
sOutput = sOutput.. "Pos: "..Position.."\n"
sOutput = sOutput.. "Sig: "..Signature.."\n"
sOutput = sOutput.. "Str: "..Strapping.."\n\n"
end
end
MessageBox(sOutput)

The example above could be called in a component script to print out all the information
for adapters used in the test.

95
Tester Information Functions

Cirris.GoodCount

Cirris.GoodCount
Returns the number of cables that were tested good in the current test run.

Cirris.LotID

Cirris.LotID
Returns the Lot ID for the current test run. For Lot ID to be recorded, the Enter Lot ID
option must be checked under the Set Test Defaults Tab of the Test Editor.

Cirris.RunBadCount

Cirris.RunBadCount
Returns the number of cables tested bad in the current test run. A test run begins when
a test program is loaded and the first test completes, and ends when the test program is
closed.

Cirris.RunGoodCount

Cirris.RunGoodCount
Returns the number of cables tested good, in the current test run. A test run begins
when a test program is loaded and a first test completes, and ends when the test
program is closed.

Cirris.RunNumber

Cirris.RunNumber
Returns the number of the current test run. A test run begins when a test program is
loaded and the first test completes, and ends when the test program is closed.

Cirris.RunTotalCount

Cirris.RunTotalCount
Returns the number of all cables tested, good or bad, in the current test run. A test run
begins when a test program is loaded and a first test completes. A test run ends when
the test program is closed.

Cirris.StationID

Cirris.StationID
Returns the Station ID number. This is a unique number that that identifies the tester or
test station. The Station ID number is generated when the Cirris easy-wire software is
installed.

96
Test Information Functions

Cirris.TotalCount

Cirris.TotalCount
Returns the total count of all cables tested in all test runs. The total count continues to
accumulate for any test that completes until the total counts are cleared in the test
window

GetCableStatus

GetCableStatus () (Easy Touch and 1100 only)

This function returns the good or bad status for the cable tested. The function has no
inputs. If the cable status is good 0 is returned; if bad, -99 is returned.
Example
if GetCableStatus() ~= 0 then
iNumberBadCables = iNumberBadCables + 1
end

The integer, iNumBadCables, will be incremented if the cable test result is bad.

GetComponentCount

GetComponentCount ()
This function returns an integer value of the number of components in the loaded Test
Program. Components include custom components, resistors, diodes, capacitors and so
forth. The function has no inputs.

Example:
iCount = GetComponentCount()
MessageBox(“Number of components = ”..tostring(iCount))

This example will display a message on the tester’s screen that contains the number of
components in the current wirelist.

97
Tester Information Functions

GetComponentDetails

GetComponentDetails (index, select)


This function returns test details about components in the loaded test program. The full
function format is:
error, detail = GetComponentDetails (index, select)

The table below relates the function outputs and inputs.


error detail index select
Component Type 0 = Component Type
0 = No error, 1 = Resistor Position of the
detail is valid. 2 = Diode component in
3 = Link the wirelist.
-9999 = Error, 4 = Capacitor (integer)
detail is not 5 = Relative Capacitance
valid 6 = Twisted Pair
7 = 4 Wire Resistor
(integer) 8 = 4 Wire Wire
9 = Wire
Component’s Pass/Fail Status 1 = Pass Fail Status
0 = Fail
1 = Pass
From Test Point 2 = From Test Point
Represented as a zero based
system test point. (integer)
To Test Point 3 = To Test Point
Represented as a zero based
system test point. (integer)
Nominal or expected value 4 = Expected Value
applied to the component
setup.
(floating point)
Tolerance applied to the 5 = Tolerance
component setup. (integer)
Measured values from most 6 = Measured Value 1
recent test. (floating point)
Reverse voltage from diode 7 = Measured Value 2
component returned from
most recent test. (floating
point)

98
Test Information Functions

GetErrorSignature

GetErrorSignature (Easy Touch and 1100 only)

This function returns the error signature for a bad cable as a string. If a cable is good,
this function returns the cable signature as a string. There are no inputs to this function.

Example
if GetCableStatus() == -99 then
sErrorSig = GetErrorSignature()
MessageBox(sErrorSig)
end

This example will output the error signature to the screen if the cable tested was bad.ple,
"8062B5-6F8NO" would be displayed on the screen.

GetErrorText

GetErrorText ( )
This function returns error text on cables that have tested as bad on the tester. This error
text is the same error text displayed on the error screens during cable testing. If the
cable is not attached, the errors returned for this function are the same as the errors for
SPC data collection. If the cable is still attached, the errors returned for this function are
intermittent or low voltage errors. There are no inputs to this function. If the cable tests
as good, the function returns an empty string, "".

GetNumberTested

GetNumberTested (input) (Easy Touch and 1100 only)

This function returns the counts of the cables tested (Total, Good, and Bad) in the
current test run. These are the same counts displayed in the Test Window on the
tester. Each input number will return a different count type in the table below. If the
function has no input, it will return a description of itself.

returned total (integer) input


total tested 1
tested good 2
tested bad 3

99
Tester Information Functions

GetPinLabel

GetPinLabel (pin,[select])
This function returns a default or custom label for a raw system pin number. Pin
numbers (test points) are between 1 and 128 for a base tester with no addons, between
1 and 256 for a tester with one addon, and so forth. If the function has no input, it
returns an error describing the function.
returned label (string) pin (integer) select (integer)
Default Label assigned to the raw A raw test point number. Any integer greater equal
system test point. such as 56 to or greater than one.
For example, “J2-024”.
Custom Label assigned to the A raw test point number. Not used
raw system test point For example, 56
For example, “Red Wire”

Example
sCustomLabelText = GetPinLabel(25)
The function will return the custom label text assigned to pin number 25 as a string in the
variable sCustomLabelText.

iPinNumber = 5
iReturnDefaultLabel = 1
sDefaultLabel = GetPinLabel(iPinNumber, iReturnDefaultLabel)
The function will return the default label format for pin number 5 because
iReturnDefaultLabel is set to one. It returns a string such as J1-005 in
sDefaultLabel.

100
Test Information Functions

GetWirelistInfoAsText

GetWirelistInfoAsText (input) (Easy Touch and 1100 only)

Use this function to get text information on the loaded test program. Each input number
will return different information about the test program.

input Returned Test Program Information


(intetger)
1 The loaded test program
2 The current location or path of the easy-wire database test program
without the filename (up to 144 characters)
3 The description of the test program. (Up to 30 characters
4 The cable signature
5 The cable signature (complex cables only)
6 The insulation test parameter signature (complex cables only)
7 The adapter position (Jx), a space, and then the adapter signature (six
characters)
8 The adapter position and signature followed by a * separator followed by
the adapter description (up to 30 characters)
10 The Low Voltage Settings with each parameter on a separate line
11 The High Voltage Settings with each parameter on a separate line
12 Each net with its connections on a separate line.
These connections will not be labeled even if custom labels are used in the
wirelist.
13 Each component on a separate line
14 Each custom or default test point label on a separate line
15 Each fourwire pair on a separate line
16 The CRC Signature
17 The name & location of the Custom Component Script
18 The name & location of the Test Event Script
19 SPC Data Collection Settings

Examples:
sWirelistText = GetWirelistInfoAsText(1)
The function returns the current wirelist filename as a text string in, sWirelistText. For
example, sWirelistText = "TESTFILE.WIR".

101
Tester Information Functions

sCableDescription = GetWirelistInfoAsText(3)
The function returns the cable description of the current wirelist as a text string in
sCableDescription. For example, sCableDescription = "Cable for batch 10".

sCableSignature = GetWirelistInfoAsText(5)
The function returns the cable signature of the current wirelist as a text string in
sCableSignature. For example, sCableSignature = "5760A5-6F0Z2".

sLowVoltSettings = GetWirelistInfoAsText(10)
The function returns the low voltage settings as text with each parameter on a separate
line in sLowVoltSettings. For example, sLowVoltSettings =
"CONNECTION RESIS 2.00 K ohm
LV INSULATION RESIS 6.00 K ohm"
sWirelistLabels = GetWirelistInfoAsText(14)
The function returns each label as a text string on a separate line in sWirelistLabels.
For example, sWirelistLabels =
"J1-001 = BLUE
J1-002 = RED
J5-006 = GREEN"
functionDescription = GetWirelistInfoAsText()
The function returns the function description as a text string in functionDescription.

102
Test Information Functions

IsSPCDataCollectionOn

IsSPCDataCollectionOn() (Easy Touch and 1100 only)

This function returns a 1 if data collection is on in the test program, or a 0 if data


collection is off. There is no input for this function. Note that that data collection is a
purchased option on the Easy Touch and the 1100 testers. Additionally, in the tester’s
software interface you must select Stored Measured Test Values for a test program to
use this feature.

Example:
iDataCollectionOn = IsSPCDataCollectionOn()

iDataCollectionOn will contain a zero if SPC data collection is OFF in the current
wirelist or a one if SPC data collection is ON in the loaded test program.

TWLGetErrorText

TWLGetErrorText (Easy Touch and 1100 only)

error = TWLGetErrorText(result)

This function returns a text string, error, that describes an error from the last test after
the function TestWirelist was called. The function TestWirelist function returns result
which is used as an input to TWLGetErrorText. Using TWLGetErrorText is the only
reliable way to get error text when testing wirelists using TestWirelist.

Example:
iTestVal = TestWirelist(255) -- 255 selects LV, component and HV test
if iTestVal > 0 then -- error are greater than 0
sErrText = TWLGetErrorText(iTestVal)
end

This example will get the error text for the failed wirelist test.

WiresAttached

WiresAttached()
The WiresAttached function determines whether a cable is present. It checks only the
adapters listed in the currently loaded wirelist. This function has no inputs. The function
returns nil if nothing is attached, or a 1 one or more connection is sensed.

Example:
iAttached = WiresAttached ()

iAttached will contain nil if no wires are attached, or 1 if wires are attached.

103
User Interface Functions

User Interface Functions


Cirris.GetWrappedText

Cirris.GetWrappedText(text [, length, center])


This function applies the control codes to a text string so the text will be wrapped at a
defined maximum line length. Codes may also be applied to center the text. See the
table below.
input description
text A string containing the text which will be wrapped.
length Integer indicating the maximum number of characters per line for the
wrapped text. If unspecified, the default is 20 characters.
center 0 = Text is not centered
1 = Center text
If unspecified, the default is 0.

If the input text contains a line feed code (LF) by itself, this function replaces it with a
carriage return and a linefeed code (CRLF).

In Easy Touch Scripting the legacy Cirris function GetWrappedText behaves identically
to the Cirris.GetWrappedText function. Note that previously a third input allowed the
legacy GetWrappedText function to control whether linefeed codes would be replaced
with carriage return line feeds. If used this input now ignored.

Example:
sWrappedText = GetWrappedText(sTextToWrap, 80)
The function returns the text wrapped at 80 characters per line as a string in
sWrappedText. The text will be left justified.

Cirris.HideBackgroundImage

Cirris.HideBackgroundImage
This function closes the background image file previously displayed using
Cirris.ShowBackgroundImage function. The Cirris Test Window and other open
application windows will again be visible on the test monitor.

104
User Interface Function

Cirris.PlaySoundFile

Cirris.PlaySoundFile (soundfile) (CR, CH2, & CH+ only)

This function plays a sound file (.wav) on the PC controlling the tester. The string
soundfile specifies the image file name and path.

Cirris.PressDoneButton

Cirris.PressDoneButton
This function effectively presses the Done button in the test window while in a script.
This command allows event script that could be in a mode to run repeatedly to exit.

Cirris.ShowBackgroundImage

Cirris.ShowBackgroundImage (image [,s] [,p])


This function displays a background image file to hide the easy-wire test window and
other open application windows. The image file can serve as a background in an event
script so that operator focus can be on subsequent script messages. This function is
most typically used in an event script that takes control of the test. The string image
specifies the image file name and path. The setting s can be set to 1 to stretch the
image to the nearest horizontal or vertical monitor restraint. If p is additionally set to 0,
the image can be stretched non proportionally to entirely fill the monitor. Image files
may include png, jpeg, bmp, and gif file types.

105
User Interface Functions

DialogCheckBtn

button = DialogCheckBtn (handle)


The DialogCheckBtn function is used in a while loop to identify a dialog box button push.
The function returns an integer to button corresponding to the button that was pressed
in an open dialog box. While no button is pushed, this function returns a 0. The dialog
box is referenced by its handle that was created using the DialogOpen function. The
script is still running when a dialog box is displayed on the screen unlike a message box.
Because operations are still running, any tester pop-ups will display on top of a dialog
box. You can check digital I/O or perform test functions while waiting for a dialog box
button to be pressed.

See the example dialog box for the DialogOpen function on the next page. The code
below would identify which button is pushed for the example dialog box.

iDia=DialogOpen ("~Wire Color~".."What color is the wire?", "Red", "White",


"Green")
iButton = 0
while iButton == 0 do
iButton = DialogCheckBtn(iDia)
if iButton == 1 then
MessageBox("You pressed Red")
end
if iButton == 2 then
MessageBox("You pressed White")
end
if iButton == 3 then
MessageBox("You pressed Green")
end
end
DialogClose(iDia)

DialogClose

DialogClose (handle)
Closes a dialog box identified by the input number. This function is used along with the
functions DialogOpen and DialogCheckBtn. The script is still running when a dialog box
is displayed on the screen unlike a message box. Because operations are still running,
any tester pop-ups will display on top of a dialog box. This function is used to clean up
memory. For every DialogOpen function there should be a DialogClose function.

106
User Interface Function

DialogOpen

DialogOpen
handle = DialogOpen ([~title~..]message [, button1] [, button2] … [,sbutton6])

The DialogOpen function displays a dialog box containing custom text and up to six
dialog buttons. This function also returns a handle to identify the dialog box. This
handle is used with the DialogCheckBtn and DialogClose functions. The dialog box will
not have a default CANCEL button if no other custom buttons are created. The script is
still running when a dialog box is displayed on the screen unlike a message box.
Because operations are still running, any pop-ups from the tester will display on top of
these dialog boxes.

For example, the following statement creates a dialog box like the one below
iDia = DialogOpen ("~Wire Color~".."What color is the wire?", "Red", "White”, “Green”)

MessageBox

MessageBox
This function displays a message box on the tester’s display to display a message to the
operator. Up to six buttons can be displayed on the message box to allow a selection.
Unlike dialog boxes, the tester and script do not continue to run when a message box is
displayed. The full format for this function is as follows:

button = MessageBox ([~title~]..message [, button1] [, button2] …


[,sbutton6])

The function returns an integer (1 to 6) to button to identify a pressed button. Strings


are also used to define the message box message as well as the optional title and
button names. If no buttons are specified, the message box will contain an OK button
that the operator will have to select to continue.

107
User Interface Functions

Examples:

MessageBox ("Attach tie wraps")

Results in the message box below.

button=MessageBox ("~Voltage~".."Choose a test voltage", "1000", "1100", "1200")

Results in the message box below:

108
User Interface Function

PlaySound

PlaySound (pitch, duration, volume)


This function plays a sound at a specified pitch, duration and volume. The volume is
dependent upon the tester’s volume setting. For a maximum sound, set the tester’s
volume at its maximum setting.
input description
pitch An integer indicating the pitch of the sound in Hertz.
duration An integer indicating the duration of the sound in seconds.
volume An integer from 1 to 100 indicating the volume of the
sound where 100 is the loudest.

Example:
iPitch = 300
iDuration = .5
iVolume = 100
PlaySound(iPitch, iDuration, iVolume)

This example will play the sound for 500 milliseconds at 300 Hz at full volume.

PromptForUserInformation

PromptForUserInformation
This function displays a user prompt window on the tester and returns the valid user
entry. The prompt window can receive user entry that is alphanumeric, numeric, or
“password”. When the password entry is used, alphanumeric entry is accepted, but
asterisks hide the operator’s entry characters. Numeric entry accepts only integers. At
the bottom of every prompt window an OK and CANCEL button. The full format for the
function is as follows:
entry = PromptForUserInformation(type, firstline, secondline, maxchar[, initial])
Inputs to this function are described in the table below.
Input Description
type An integer value that defines the type of user input.
1 = alphanumeric
2 = numeric (integers)
5 = password
firstline String of text - up to 30 characters - for the first prompt line.
secondline String of text - up to 30 characters - for the second prompt line.
maxchar Integer of the maximum number of characters the user can enter. The
range for this value is 1 to 30.
initial Contains an initial value displayed in the prompt entry box. An
alphanumeric string or an integer depending the value of type

109
User Interface Functions

The function will return the text the user enters to entry, or if the user presses Cancel,
the function returns nil to entry. Always test for the value of nil and replace it with a
valid string so subsequent routines will not break when they expect a string

Example:
sInput1 = PromptForUserInformation(1, "Enter the assembly part number", "five digit extention", 10,
"80-");

Results in the message box:

110
1100 Embedded File Functions

1100 Embedded File Functions


The following scripting functions allow Easy Touch Scripting, run on a PC, to control files
stored in the embedded memory of the Cirris 1100R and 1100H testers.

Many scripts were written with Cirris Scripting functions designed to run internally to
Cirris 1100R and 1100H testers. Many of the functions below are the similar equivalent
to the Cirris Scripting functions designed for controlling files internally to the tester. To
differentiate many of these functions from the previous scripting functions an underscore
“_“ has been added at the beginning of the function’s file name. For example the first
function described below, _appendto has the previous similar function, appendto.

Therefore, if you want to use a script written with Cirris Scripting functions for internal file
control, you will have to do one of two things. You can change the functions used in the
script to the new files names, or you may make an argument statement at the beginning
of the script file equating the old function file name with the new. For example,
appendto=_appendto will make the new internal function _appendto take the place of the
previous appendto function.
_appendto

_appendto (x:\\file) (Easy Touch & 1100 only)

This function opens a file from the 1100 internal memory and returns a handle for the
file. If no file is opened, nil is returned to the handle. If the function is unsuccessful, a
separate error message is also returned. Use this function when you want to add
something to the file. This function will not erase the contents of a file. This function
does not close the current output file so when done use the _closefile or _writeto
functions to close the file.
Example:
serialNumFile, sErrMsg = appendto(“c:\\cableser.dat”)
write(“Serial Number: 12345678”)
writeto() -- This closes the file
Returns the file handle in serialNumFile if the file “cableser.dat” opens successfully.
If it fails opening the file, it will return a nil in serialNumFile and an error string in
sErrMsg. The write function will write to the file and the writeto function will close
the file.

111
1100 Embedded File Functions

CopyEmbeddedFileToPc

CopyEmbeddedFileToPc (source, x:\\destination) (Easy Touch


& 1100 only)
This function copies a file from internal memory of an 1100 tester to PC controlling the
tester. The input source is the filename on the 1100; destination, the path and
filename on the PC. If the function is successful, it returns nil. If unsuccessful, it returns
an error string describing the error. See also the related function
CopyPcFileToEmbedded.

Example:
sCopyErrror = CopyEmbeddedFileToPc (“lastlrnd.sys”, “c:\\myfolder\\last.wir”)
In this example the last learned file from an 1100 tester, lastlrnd.sys is copied to a
new file name last.wir in the folder my folder on the PC.

_copyfile

_copyfile (source, destination) (Easy Touch & 1100 only)

This function copies a source file to a destination file within the 1100 internal memory. If
there is a copy error, its description is returned.

Example:
_copyfile (“test1.wir”, “test1.bak”)

CopyPcFileToEmbedded

CopyPcFileToEmbedded (x:\\source, destination) (Easy Touch


& 1100 only)
This function copies a file from the PC running the easy wire software to the embedded
memory of the 1100 tester. The input source is the path and filename on the PC;
destination, the filename in the 1100 memory. If this function is successful, it returns
nil. If unsuccessful, it returns an error string describing the error. See also the related
function CopyEmbeddedFileToPc.

112
1100 Embedded File Functions

DirUtils

DirUtils (input1, [input2]) (Easy Touch & 1100 only)

This function can perform directory services for the 1100 embedded memory. These
services include changing the current directory, displaying the current directories
contents, and getting the current directory’s path. The table below shows the
relationship between the inputs of this function and returned directory information.

returned information input 1 input2

New current directory’s path is 1 String containing the directory path that
returned as a string, or nil if will be the current directory.
unsuccessful.
Contents of the current directory 2 String containing a linefeed delimited list
of the specified file type returned of file types to display.
as a string, or nil if unsuccessful.
Examples:
“*.wir” or “*.*” or
“*.wir\n*.lua\n*.evt” or
“*.rpt\n*.cmp”

default: “*.*”
Current directory’s path returned 3 Not used
as a string, or nil

Example:
sCurDir = DirUtils(3)
sResult = DirUtils(1, sNewDir)
sDirContents = DirUtils(2,”*.wir”)
sResult = DirUtils(1, sCurDir)

This example stores the original directory path in sCurDir. The current directory then
becomes the directory contained in the string sNewDir. All the wirelist files in the
directory and their available descriptions are then retrieved into sDirContents before
changing back to the original directory.

113
1100 Embedded File Functions

_openfile

_openfile (x:\\filename, mode) (Easy Touch & 1100 only)

This function opens a file in the mode specified in the string mode. It returns a new file
handle, or, in case of errors, nil plus a string describing the error. Potential values of
mode are defined as follows:
mode description
"r" read mode
"w" write mode
"a" append mode
"r+"; update mode, all previous data is preserved
“w+” update mode, all previous data is erased;
"a+" append update mode, previous data is preserved, writing is only allowed
at the end of file

_read

_read ([readpattern]) (Easy Touch & 1100 only)

This function reads a file according to a read pattern. If you call the function without
readpattern, it defaults to reading the next line or the first line for the first read. The
function returns a string containing the characters read, or a nil if it fails to read anything.
Previous to using the read function, the file must be opened using the _readfrom
function. Use the function, readfrom, to close the file when finished reading. Potential
read patterns are described below.

readptattern description
“*.*” Returns the next character or nil on end of file.
“.*” Reads the entire file.
".*" Returns the next line without the linefeed or nil on end of file. This
is the first line when reading a file for the first time. You do not
have to type in this default pattern, just call the function without
using any input.
"[^\n]*{\n}" Returns the next word skipping spaces if necessary or nil on end
(default pattern) of file.
"{%s*}%S%S*" Returns the next integer or nil if the next characters are not
integers.
"{%s*}[+-]?%d%d" Append update mode. Previous data is preserved. Writing is
only allowed at the end of file.

114
1100 Embedded File Functions

115
1100 Embedded File Functions

_readfrom

_readfrom (x:\\filename) (Easy Touch & 1100 only)

Use this function to open or close a file from 1100 embedded memory. The path should
be included in the filename. When used to open a file, the function returns a file handle.
If the function fails to open a file, it returns a nil, and a string describing the error. When
this function is called without a filename, it closes the file.

Example:
sFilename = “c:\\cable550.wir”
canReadFile, sErrMsg = readfrom(sFilename)
if (canReadFile ~= nil) and (sErrMsg == nil) then
local sFirstLine = read
local sSecondLine= read
readfrom ()
end

This example combines the read function with the readfrom function. It will return the file
handle in canReadFile if it successfully opens the cable550.wir file. If the function fails, it
will return a nil in canReadFile and an error string in sErrMsg. If the file opens, the first
line will be read into the string sFirstLine using the read function. The second line will
be read into the string, sSecondLine using the read function. The file is then closed
calling the function readfrom again.

_remove

_remove (x:\\filename) (Easy Touch & 1100 only)

This function deletes the file with the given name in 1100 embedded memory. If this
function fails, it returns nil, plus a string describing the error.

Example
sFilename = "temp.wir"
error, sErrMsg = remove(sFilename)

The function removes the file "temp.wir”. If the function should fail, it will return a nil to
error and an error string such as "No such file or directory" in sErrMsg.

116
1100 Embedded File Functions

_rename

_rename (x:\\filename) (Easy Touch & 1100 only)

This function to renames a file in 1100 embedded memory. If the function fails to
rename the file, it returns a nil, plus a string describing the error.

Example:
sOldFilename = "c:/temp.fil"
sNewFilename = "c:/values.fil"
error, sErrMsg = rename(sOldFilename, sNewFilename)

The function will rename the file, temp.fil to values.fil. If the function fails, it will
return a nil in error and an error string in sErrMsg.

_seek

_seek (handle [,base] [, offset]) _seek (Easy Touch


& 1100 only)
This function sets and gets the file position for 1100 an embedded memory file. The file
position is measured in bytes by offset from base. The value of base is a string with
one of the following values.
base description
set base is position 0 (beginning of the file)
cur base is current position
end base is the end of the file

In case of success, the _seek function returns the file position, measured in bytes from
the beginning of the file. If the call fails, it returns nil, plus a string describing the error.
The default value for base is cur, and for offset is 0. Therefore, the call _seek(file)
returns the current file position, without changing it; the call seek(file, "set") sets the
position to the beginning of the file (and returns 0); and the call seek(file, "end") sets
the position to the end of the file, and returns its size.

_write

_write (x:\\filehandle, value1, value2, …) (Easy Touch


& 1100 only)
Use this function to write to a file. Note, before using this function the file is opened or
created in embedded memory using the _writeto function. After you are finished writing
use _writeto to close the file. The _write function returns status and error values as
shown in the full format statement below.
status, error = write(filehandle, value1, value2, ...)
If the function fails to write the file, it will return nil to error and a string describing the
error to error. If the function successfully writes a file, it will return a value other than
nil to status and nil to error.

117
1100 Embedded File Functions

_writeto

_writeto ([x:\\fileame]) (Easy Touch & 1100 only)

The full format of this function is:


filehandle, error = writeto ([x:\\filename])
This function can be used in one of two ways. One use is to open a new file in 1100
embedded memory so you can write something to it. Include the path and the extension
for the filename. This command works with files with the following file extensions: .txt,
.wir, .lua, .evt, .rpt, and .cmp. If successful, this function will return a handle for the
opened file. If the function fails, nil is returned to handle and an error description to
error. Take note, if this function is run on an existing file, the contents of the existing
file will be completely erased.

The other use of this function is to close the current output file. When a file is opened it
becomes the current output file until it is closed or another file is opened. To close the
current output file use this function without a filename.

Example

sFile = “c:\\storage.txt"
iCanWriteFile, errMsg = _writeto(sFile)
if iCanWriteFile then
_write("Company XYZ")
_writeto() -- Close the file
end

In this example the function writeto will return the file handle in iCanWriteFile if it
successfully opens the storage.dat file. If it fails, it will return a nil in iCanWritefile and
an error string in sErrMsg. The function _write, writes the string, Company XYZ, to the file
and _writeto then closes the file.

118
Preserved Lua 3.2 Functions
Easy-wire scripting uses Lua version 5.1. However scripts that executed within the
Touch1 and 1100 testers were written in Lua version 3.2. Some Lua 3.2 functions have
become obsolete in Lua 5.1. To allow you to more easily run the older 3.2 Lua scripts,
the functionality of these obsolete functions is preserved in Cirris easy-wire Scripting.
Preserved Lua 3.2 New Lua 5.1 Preserved Lua 3.2 New Lua 5.1
functions functions functions functions
abs math.abs. log10 math.log10
acos* math.acos max math.max
ascii string.byte. min math.min
asin* math.asin mod math.fmod
atan* math.atan pi math.pi
atan2* math.atan2 pow math.pow
ceil math.ceil rad math.rad
cos† math.cos random math.random
cosh† cosh.cos randomseed math.randomseed
date os.date sin† math.sin
deg math.deg sinh† math.sinh
execute os.execute sort sable.sort
exp math.exp. sqrt math.sqrt
getn table.getn strbyte string.byte
ldexp math.ldexp strchar string.char
log math.log. strfind string.find
floor math.floor strlen string.len
foreach table.foreach strlower string.lower
foreachi table.foreachi strrep string.rep
format string.format strsub string.sub
frexp math.frexp strupper string.upper
gsub string.gsub tanh† math.tanh
Idexp math.idexp tinsert table.insert
log math.log tremove table.remove

* This function assumes an angle is specified in terms of degrees, whereas its replacement assumes an angle
in terms of radians.
† This function returns an angle in terms of degrees, whereas its replacement Lua 5.1 function returns an
angle in terms of radians.
119
Unsupported Cirris Functions
The following scripting functions may have been used in scripts executed within the
Cirris Touch1 and 1100 testers, but are no longer supported in Easy Touch Scripting.
Unsupported Notes
Function
appendto see io.output. You can use _appendto for 1100 embedded
memory files.
remove You can use “_remove” for 1100 embedded memory files.
rename You can use “_rename” for 1100 embedded memory files.
Seek Use “_seek” for embedded files.
remove
rename
call See pcall and xpcall.
cleardirectory See os.remove.
copyfile See the Lua 5.1 functions io.input, io.output, io.open, and
io.write. You can use _copyfile for 1100 embedded memory
files.
Dofile
GetButtonPress
LoadWirelist
LuaError
openfile You can use _openfile for 1100 embedded memory files.
outtextxy
read You can use _read for 1100 embedded memory files.
ReadBlockFromSerial
readfrom You can use _readfrom for 1100 embedded memory files.
ReadFromSerial
remove
rename
SaveSPCData
Seek
SetCableSerialNumber
SetSerialParams
TestPreference Preferences can now be saved on each test.
tmpname
write You can use _write for 1100 embedded memory files.
WriteBlockToSerial
writeto You can use _writeto for 1100 embedded memory files.
WriteToSerial

120
Index
Cirris.RunBadCount, 89
_ Cirris.RunGoodCount, 89
_appendto, 104 Cirris.RunNumber, 89
_copyfile, 105 Cirris.RunTotalCount, 89
_openfile, 107 Cirris.SetBuiltInOutputStates, 48
_readfrom, 108 Cirris.SetPrinter, 82
_readpattern, 107 Cirris.ShowBackgroundImage, 98
_remove, 108 Cirris.StartPrintJob, 82
_rename, 109 Cirris.StationID, 89
_write, 109 Cirris.TotalCount, 90
_writeto, 110 component scripts
examples, 15
1 inserting in a test, 16
1100 embedded file functions, 104 overview, 13
syntax, 14
C
CopyEmbeddedFileToPc, 105
Cirris. PressDoneButton, 98 CopyPcFileToEmbedded, 105
Cirris.BadCount, 87
Cirris.CableID, 87 D
Cirris.ChDir, 49 debugging, 32, 33
Cirris.CloseDir, 49 Delay, 38
Cirris.CopyDir, 49 DialogCheckBtn, 99
Cirris.CurrentDir, 50 DialogClose, 99
Cirris.DirExists, 50 DialogOpen, 100
Cirris.EndPrintJob, 80 DirUtils, 106
Cirris.GetNumPrinters, 81
Cirris.GetPrinterNameByIndex, 81 E
Cirris.GetWrappedText, 97 EEPROM, 63
Cirris.GoodCount, 89 embedded blocks
Cirris.HideBackgroundImage, 97 calling sub-functions, 27
Cirris.HipotPointMask, 62 changing default, 26
Cirris.LotID, 89 global variables, 25
Cirris.MkDir, 50 implementation, 21
Cirris.NewPage, 81 introduction, 20
Cirris.OpenDir, 51 EVT test event script
Cirris.OpenFileDiaglog, 51 overview, 8
Cirris.OpenFolderDiaglog, 51 parameters, 12, 14
Cirris.Print, 82 required syntax, 9
Cirris.ReadBuiltInTesterInputStates, 48 selecting, 10
Cirris.ReadDir, 52
Cirris.RmDir, 52

121
F L
file functions, 49 LearnCable, 74
functions low level function, 53
alphabetically, 36 sink / unsink, 53
by category, 34 LUA Test Event Script
required syntax, 6
G selecting, 7
Get4WPairPt, 84
GetAdapters, 87 M
GetBuiltInTesterOutputStates, 47 measurement and test functions, 62
GetCableStatus, 90 MessageBox, 100
GetCapMeasurement, 64, 68 MicroLan, 75
GetComponentCount, 90
GetComponentDetails, 91 P
GetDateAsText, 38 parameter types and values, 12, 14
GetErrorSignature, 92 PlaySound, 102
GetErrorText, 92 PlaySoundFile, 98
GetHardWareVersion, 84 preserved lua 3.2 functions, 111
GetNumberTested, 92 printer functions, 80
GetPinLabel, 93 PromptForUserInformation, 102
GetPLCOutputStates, 44
GetProbedPin, 84 R
GetPtType, 85 ReadPLCInputStates, 45
GetRawPointNum, 84 ReadUserInputStates, 42
GetRelCapMeasurement, 65 remove, 112
GetResistanceMeasurement, 66 rename, 112
GetResistanceMeasurement4W, 67 report scripts
GetSystemInfoAsText, 86 overview, 18
GetTimeAsInteger, 86 setting up, 18
GetTimeAsText, 85 syntax, 19
GetTotalCapMeasurement, 68
S
GetUserOutputStates, 41, 44, 47, 48
GetWirelistInfoAsText, 94 script errors, 32
scripting
H Easy Touch scripting defined, 1
HipotNetTiedToPoint, 69 enabling scripting, 2
HipotNetTiedToPoints, 62, 69 getting a script, 3
HipotPointMask, 73 SendTextToParallelPrinter, 83
SetDelayTimeInMilliseconds, 39
I SetPLCOutputStates, 46
IsSPCDataCollectionOn, 96 SetUserOutputStates, 43

122
T TWLGetErrorText, 96
test information functions, 87
U
tester information functions, 84
TestWirelist, 77 unsupported cirris functions, 112
TimePassed, 39 UseChildWirelist, 78
TimerClose, 39 user interface functions, 97
TimerDone, 40 W
TimerReset, 40
WiresAttached, 86, 96

123

You might also like