Digital I/O

This section describes how can you use digital I/Os in your test sequence

#catchio (Wait for a specified IO device input)

Repetitively send the command to read inputs of IO mapping device and block executing the program until matches the expected value. When #oninput event occurs, the #catchio will break.

Examples

Command
Parameter

#catchio

cmd="r:0:2:4";accept="1:1:1"

Read inputs 0, 2 and 4 every 10ms and block program executing until all inputs become logical 1.

Return Value

Last state of inputs in colon-separated format, i.e. "0:1:1". Returns BREAK when paused while debugging or #oninput event.

Command Overview

Command
Parameter
#catchio

cmd=[string];accept=[string]{;accept2=[string];...;acceptN=[string]} {;timeout=[number]}{;interval=[number]}{set-cnt=[number]}

Parameter Description

Parameter
Type
Options

cmd

[string]

Command of funTEST IO mapping device to read specified inputs. Alias or input numbers can be used, separated by a colon ":".

accept

[string]

Return string sequence of IO command to be accepted. The #catchio command blocks executing the program until one of these string will match the return value. Since funTEST version 1.0.1912.410 the accept argument support wild-cards (? for any one charater and * for any number of charaters).

timeout

[number]

Time limit in [ms] to wait to pass all accept strings. If the timeout is reached, the #catchio command return status will be one and current state of inputs will be returned. Default: (no timeout)

interval

[number]

Interval in [ms] between executing of IO commands. Default: 10 [ms]

set-cnt

[number]

Needed count of internal iteration before "accept filter" will be accepted. Interval between iteration is depended on interval parameter Default: 1

#oninput (External input interrupt)

This command controls external input interrupt. Functionality requires IO mapping to be configured with used inputs enabled. When interrupt is configured, funTEST checks for change of specified input. If there is a transition on input of configured interrupt, the funTEST will go to a specified label or call a specified function. More than one interrupt can be set. Each interrupt is identified by its input pin number or alias. Interrupts are bounded to thread from which they were configured. If specific thread finishes, all bounded interrupts to this thread are cleared.

Examples

Command
Parameter

#oninput

goto:start:pin=fixture-closed:change=tohigh

This example requires a defined label "start" and input pin with "fixture-closed" alias. If pin value raises from low to high, funTEST will go to on the label "start".

Return Value

No return value.

Command Overview

Command
Parameter
#oninput

<command>:<label>:pin=[string/number]:change=[enum]{:single=[bool]}

Parameter Description

Parameter
Type
Options

command

[enum]

What should be done if error or fail has occurred. It can be on of these option: • goto - go to line with a specified label, no return • call - asynchronously call specified function block, there is no blocking of running program

label

[string]

Target label to go to or name of function block to call. Function block must ends with #return command.

pin

[string] or [number]

Input pin number or alias that can cause an extern interrupt. It must be defined in teststation's IO mapping.

change

[enum]

Specify a pin level transition. It can be: tohigh - a transition from low to high tolow - a transition from high to low

single

[bool]

Single-shot option. If true, the configured interrupt is automatically disabled when first occur.

Controlling and Reading I/Os from IO Column

You can also read and control digital I/Os in a dedicated column IO.

Commands available:

Command
Parameter
Return Value
Example

*rst Clear all outputs (without applying outputs) and clear current segment setting.

No parameters

No return value

s: <out> Set specified output(s) to ON state. The command reflect current segment settings.

out [int] or [string] Pin number or pin alias of output

No return value

s:3:7:gnd:vcc Set outputs with numbers 3 and 7 and all outputs with aliases "gnd" and "vcc" in currently active segment (s).

c:<out> Set specified output(s) to OFF state (clear). The command reflect current segment settings.

out [int] or [string] Pin number or pin alias of output

No return value

c:3:7:gnd:vcc Clears outputs with numbers 3 and 7 and all outputs with aliases "gnd" and "vcc" in currently active segment(s).

r:<in> Read state of specified inputs(s). The command reflect current segment settings.

in [int] or [string] Pin number or pin alias of input

1 = ON 0 = OFF

r:state Read all inputs with alias "state" in currently active segment(s).

IO mapping system accepts more commands in a chain at once.

Last updated

Was this helpful?