IDC sequence file commands

From WICE Wiki v2.89
Revision as of 12:01, 13 April 2021 by Mathias (talk | contribs) (Created page with "IDC can read sequence files with the following general syntax: [channel specifier-]<ECU id> <Diagnostic request bytes>;[wait];[ECU name and request description];[subnode id];...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

IDC can read sequence files with the following general syntax:

[channel specifier-]<ECU id> <Diagnostic request bytes>;[wait];[ECU name and request description];[subnode id];[PIN=code];[AREA=code]

where channel specifier, if specified, is an integer specifying a can channel number followed by a hyphen, ECU id is the ECU identifier of a diagnostic request, Diagnostic request bytes are the hexadecimal codes of the diagnostic request, wait is the time in milliseconds to wait after a request until the next, ECU name and request description is a textual description of the target ECU and the diagnostic request, subnode id is the subnode address of the ECU, if used, PIN code is the secret code used for security access, if required, and AREA is the security access area code.

An example sequence file line would be:
0-7E0 22 F4 0D;;ECM Bosch EDC16C_Y286 I5D Bosch EDC16C Diesel\Read Data By Identifier\Vehicle speed

Sequence file lines starting with # or // are treated as comments and ignored.

Sequence file lines starting with > are treated as commands.


Variables

Variables can be assigned values. The only valid data types are integers and diagnostic responses. This sets the variable 'foo' to the value 1:

 > set foo 1

When referencing a variable, the '$' symbol before the name gives the variable's value, i.e. to set variable 'x' to the value or variable 'foo' is done as follows:

 > set x $foo

To set a variable to a diagnostic response use the special keyword '$$' as follows:

> set foo $$

This will set the variable 'foo' to the response to the diagnostic request on the line following immediately after the directive.

Variables containing diagnostic responses can be used in subsequent diagnostic requests, as the following example illustrates.

> set x $$
 1001 22 20 07
 1001 2E A2 20 $x[3] $x[4]

Note how the individual bytes of the variable 'x' are referenced in the second request using '$x[n]' where n is the byte offset of the response starting at 0.

Integer variables can be increased or decreased by a value, as follows:

> set x 1
 > set y 2
 > incr x 2
 > decr x $y

This would increase variable 'x' from 1 to 3, and then decrease it by 2 (the value of y).

There are a number of built-in special purpose variables, as listed in Table 1.

Table 1: Built-in variables
Name Meaning Type
start Time in milliseconds since start of idc Integer
epoch Time in seconds since the unix epoch Integer
resplen Length in bytes of last diagnostic response Integer
majver Major version number of idc Integer
minver Minor version number of idc Integer

Labels

Lebels define positions in the sequence file that can be jumped to by the 'jnz', 'jz' and 'goto' commands.

>label name

This defines a label with the name "name".

Control Flow

The control flow of a sequence file can be altered by jumping to a label, using 'jnz', 'jz' and 'goto' commands. The 'jnz' and 'jz' takes a variable name as first parameter and a label as the second. If the value of the variable is zero (0), 'jz' will jump to the specified label, whereas 'jnz' will jump if it is not zero. The 'goto' command takes just a label as argument. For example:

> jz foo name
 > jnz foo name
 > goto name

The 'quit' command finishes execution of the sequence file.

Timing

The execution of the sequence file can be paused for a specified time using the 'wait' command. For example:

> wait 100
 > set foo 1000
 > wait $foo

The first of the above commands waits for 100 milliseconds, and the second waits for one second (the value of integer variable 'foo').

The time in milliseconds to wait for diagnostic responses after a request can be changed by the 'timeout' command.

> timeout 5000

This sets the timeout to 5 seconds.

The special variable name 'epoch' can be used to get the time in seconds since the unix epoch. The special variable name 'start' can be used to get the time in milliseconds since the start of the sequence file execution.

Printing

To print strings, including values of variables, to the output result file, use the 'print' command. For instance:

> print "Time since start is $start milliseconds. Value of foo is $foo"

To print debug output to the logfile, use instead the 'debug' command, with a debug level from 1 to 5 as first argument.

> debug 2 "This is a debug message"