CAUTION: This information refers to an earlier version of the file format (version 1.2).
The circuit element table (ITEMS) consists of a number of contiguous circuit definitions (ITEMs), each of which contains all the information about a specific element.
The location (relative to the file) and size of the table are specified in the following fields, respectively, depending on where used:
•by the RUNG.ITEMSOFF and RUNG.ITEMSSIZE fields, if used in block circuit (RUNG).
•by the fields LIVECMD.ITEMSOFF and LIVECMD.ITEMSSIZE, if used in live change commands (LIVECMD).
Circuit element definition
Circuit elements (ITEMs) have a common initial part, then a specific data area for each type of element. The common part is as follows:
Name |
Offset |
Type |
Description |
---|---|---|---|
CODE |
+0 |
U16 |
Item type code. |
SIZE |
+2 |
U16 |
Full size of element (all fields). |
DATE |
+4 |
... |
Specific data (optional). |
The expected elements are as follows:
Symbolic |
ID |
Type |
Data |
Description |
---|---|---|---|---|
BB |
0x0001 |
|
|
Start of branch. |
NL |
0x0002 |
|
|
Next branch level . Notes: must always be between a BB and an EB. |
EB |
0x0003 |
|
|
End of branch . Notes: must always correspond to a BB. |
OC |
0x0004 |
|
U32=Destination (#2): BOOL types only. |
Open contact. |
CC |
0x0005 |
|
U32=Destination (#2): BOOL types only. |
Closed contact. |
RE |
0x0006 |
|
U32=Destination (#2): EDGE types only. |
Rising edge. |
FE |
0x0007 |
|
U32=Destination (#2): EDGE types only. |
Falling edge. |
AF |
0x0008 |
|
|
Always false. |
OUT |
0x0009 |
F |
U32=Destination (#2): BOOL types only. |
Output. |
OL |
0x000A |
F |
U32=Destination (#2): BOOL types only. |
Output latch (set). |
OUL |
0x000B |
F |
U32=Destination (#2): BOOL types only. |
Output unlatch (reset). |
NOUT |
0x000C |
F |
U32=Destination (#2): BOOL types only |
Output denied |
CLR |
0x000D |
F |
Zeroing (clear). |
|
TP |
0x000E |
F |
U32=Destination (#2): TIMER types only U32=Preset value 1 (#4) U32=Preset value 2 (#4). |
Enable timer pulse. |
TON |
0x000F |
F |
U32=Preset value 2 (#2): TIMER types only. U32=Preset value 1 (#4) U32=Preset value 2 (#4). |
Enable timer on delay. |
TOFF |
0x0010 |
F |
U32=Preset value 2 (#2): TIMER types only. U32=Preset value 1 (#4) U32=Preset value 2 (#4). |
Enable timer off delay. |
TSQ |
0x0011 |
F |
U32=Preset value 2 (#2): TIMER types only. U32=Preset value 1 (#4) U32=Preset value 2 (#4). |
Enable square wave timer. |
TINT |
0x0012 |
F |
U32=Preset value 2 (#2): TIMER types only. U32=Preset value 1 (#4) U32=Preset value 2 (#4). |
Enable integral timer. |
CU |
0x0013 |
F |
U32=Preset value (#2): COUNTER types only U32=Preset value (#4). |
Count up. |
CD |
0x0014 |
F |
U32=Preset value (#2): COUNTER types only U32=Preset value (#4). |
Count down. |
CUR |
0x0015 |
F |
U32=Preset value (#2): COUNTER types only. U32=Preset value (#4). |
Rotary count up. |
CDR |
0x0016 |
F |
U32=Preset value (#2): COUNTER types only. U32=Preset value (#4). |
Count down rotary. |
LD |
0x0017 |
F |
U32=Preset value (#2): COUNTER types only. |
Preset on counter. |
MATH |
0x0018 |
F |
U32=Expression (#5) U32=Destination (#2) U8[]=Mathematical expression data. |
Math block. |
EQ |
0x0019 |
|
U32=Source A (#2) U32=Source B (#2). |
Equality comparison block (A == B). |
NE |
0x001A |
|
U32=Source A (#2) U32=Source B (#2) |
Different comparison block (A != B). |
GT |
0x001B |
|
U32=Source A (#2) U32=Source B (#2) |
Major comparison block (A > B). |
GE |
0x001C |
|
U32=Source A (#2) U32=Source B (#2) |
Major/equal comparison block (A >= B). |
LT |
0x001D |
|
U32=Source A (#2) U32=Source B (#2) |
Minor comparison block (A < B). |
LE |
0x001E |
|
U32=Source A (#2) U32=Source B (#2) |
Minor/equal comparison block (A <= B). |
COPY |
0x001F |
F |
U32=Source (#2) U32=Destination (#2) U32=N. Elements (#2) |
Copies data from source to destination, for the specified no. of elements. |
CALL |
0x0020 |
F |
U32 Block ID to call |
Call of a block (sub-routine). |
RET |
0x0021 |
F |
|
Return from a block to the inside. |
ADD |
0x0022 |
F |
U32=Source A (#2) U32=Source B (#2) U32=Destination (#2) |
Sum (A + B). |
SUB |
0x0023 |
F |
U32=Source A (#2) U32=Source B (#2) U32=Destination (#2) |
Subtraction (A - B). |
MUL |
0x0024 |
F |
U32=Source A (#2) U32=Source B (#2) U32=Destination (#2) |
Multiplication (A * B). |
DIV |
0x0025 |
F |
U32=Source A (#2) U32=Source B (#2) U32=Destination (#2) |
Division (A / B). |
AND |
0x0026 |
F |
U32=Source A (#2) U32=Source B (#2) U32=Destination (#2) |
AND binary (A & B). |
OR |
0x0027 |
F |
U32=Source A (#2) U32=Source B (#2) U32=Destination (#2) |
Binary OR (A | B). |
NOT |
0x0028 |
F |
U32=Source A (#2) U32=Destination (#2) |
NOT binary (~A). |
XOR |
0x0029 |
F |
U32=Source A (#2) U32=Source B (#2) U32=Destination (#2) |
XOR binary (A ^ B). |
SQRT |
0x002A |
F |
U32=Source A (#2) U32=Destination (#2) |
Square root of A. |
MOD |
0x002B |
F |
U32=Source A (#2) U32=Source B (#2) U32=Destination (#2) |
Module (A mod B). |
POW |
0x002C |
F |
U32=Source A (#2) U32=Source B (#2) U32=Destination (#2) |
Power elevation (A pow B). |
SIN |
0x002D |
F |
U32=Source A (#2) U32=Destination (#2) |
Sine of A. |
COS |
0x002E |
F |
U32=Source A (#2) U32=Destination (#2) |
Cosine of A. |
TAN |
0x002F |
F |
U32=Source A (#2) U32=Destination (#2) |
Tangent of A. |
ASIN |
0x0030 |
F |
U32=Source A (#2) U32=Destination (#2) |
Archosene of A. |
ACOS |
0x0031 |
F |
U32=Source A (#2) U32=Destination (#2) |
Arcocosene of A. |
ATAN |
0x0032 |
F |
U32=Source A (#2) U32=Destination (#2) |
Arcotangent of A. |
ATAN2 |
0x0033 |
F |
U32=Source A (#2) U32=Source B (#2) U32=Destination (#2) |
Arcotangent of A, B. |
LOG |
0x0034 |
F |
U32=Source A (#2) U32=Destination (#2) |
Base-10 logarithm of A. |
LN |
0x0035 |
F |
U32=Source A (#2) U32=Destination (#2) |
Base E logarithm of A. |
ABS |
0x0036 |
F |
U32=Source A (#2) U32=Destination (#2) |
Absolute value of A |
SIGN |
0x0037 |
F |
U32=Source A (#2) U32=Destination (#2) |
A sign. |
ROUND |
0x0038 |
F |
U32=Source A (#2) U32=Destination (#2) |
Rounding to the nearest integer to A. |
MIN |
0x0039 |
F |
U32=Source A (#2) U32=Source B (#2) U32=Destination (#2) |
Minimum between A and B. |
MAX |
0x003A |
F |
U32=Source A (#2) U32=Source B (#2) U32=Destination (#2) |
Maximum between A and B. |
RANGE |
0x003B |
F |
U32=Source A (#2) U32=Source B (#2) U32=Source C (#2) U32=Destination (#2): BOOL types only. |
Checks whether A contained in the range B-C. |
LIMIT |
0x003C |
F |
U32=Source A (#2) U32=Source B (#2) U32=Source C (#2) U32=Destination (#2) |
Limit A to the B-C range. |
ROR |
0x003D |
F |
U32=Source A (#2) U32=Source B (#2) U32=Destination (#2) |
Right bit rotation (A >> B). |
ROL |
0x003E |
F |
U32=Source A (#2) U32=Source B (#2) U32=Destination (#2) |
Left bit rotation (A << B). |
SHR |
0x003F |
F |
U32=Source A (#2) U32=Source B (#2) U32=Destination (#2) |
Shift bit to the right (A >> B). |
SHL |
0x0040 |
F |
U32=Source A (#2) U32=Source B (#2) U32=Destination (#2) |
Shift bit to the left (A << B). |
MOV |
0x0041 |
F |
U32=Source A (#2) U32=Destination (#2) |
Assign A. |
TODEG |
0x0042 |
F |
U32=Source A (#2) U32=Destination (#2) |
Conversion of A from RAD to DEG. |
TORAD |
0x0043 |
F |
U32=Source A (#2) U32=Destination (#2) |
Conversion of A from DEG to RAD. |
NEG |
0x0044 |
|
|
Negation of logical state. |
NOP |
0x0045 |
F |
|
No operation. |
EVAL |
0x0046 |
|
U32=Expression (#5) U8[]=Mathematical expression data |
Expression evaluation (boolean) |
((#1) Local bit variable (I32 or U32 type) with direct addressing (any constant indexes and number of bits).
(#2) Source/destination means either a variable name or the ascii representation of a numeric value (source only), or an offset to the string table.
(#4) Value (or preset value) means a numeric value in string format: empty string (or offset 0) means no value assigned.
(#5) Expression means string with offset to string table.
Mathematical expression data
Mathematical expression data (MATH element) is a series of contiguous operations (ordered in inverse polar) with the following common header:
Name |
Offset |
Type |
Description |
---|---|---|---|
CODE |
+0 |
U8 |
Operation code. |
DATE |
+1 |
... |
Specific data (optional). |
The planned operations are as follows:
Symbolic |
ID |
Data |
In (stack) |
Out (stack) |
Description |
---|---|---|---|---|---|
PUSH |
0x01 |
DBL=value |
-- |
DBL |
Push value into stack. |
PUSHV |
0x02 |
U32=Source (#1) |
-- |
DBL |
Push variable value into stack. |
ADD |
0x03 |
|
DBL0,DBL1 |
DBL |
Sum. |
SUB |
0x04 |
|
DBL0,DBL1 |
DBL |
Subtraction (#2). |
MUL |
0x05 |
|
DBL0,DBL1 |
DBL |
Multiplication (#2). |
DIV |
0x06 |
|
DBL0,DBL1 |
DBL |
Division (#2). |
MOD |
0x07 |
|
DBL |
DBL |
Module (#3). |
ABS |
0x08 |
|
DBL |
DBL |
Absolute value (#3). |
SIN |
0x09 |
|
DBL |
DBL |
Sine. |
COS |
0X0A |
|
DBL |
DBL |
Cosine. |
TAN |
0x0B |
|
DBL |
DBL |
Tangent. |
ASIN |
0x0C |
|
DBL |
DBL |
Arcosene. |
ACOS |
0x0D |
|
DBL |
DBL |
Arcocosene. |
ATAN |
0x0E |
|
DBL |
DBL |
Arcotangent. |
POW |
0x0F |
|
DBL |
DBL |
Exponent. |
LOG10 |
0x10 |
|
DBL |
DBL |
Logarithm base 10. |
LOG |
0x11 |
|
DBL |
DBL |
Natural logarithm. |
R_AND |
0x12 |
|
U32 |
U32 |
Binary AND. |
R_OR |
0x13 |
|
U32 |
U32 |
OR binary. |
R_NOT |
0x14 |
|
U32 |
U32 |
NOT binary. |
R_XOR |
0x15 |
|
U32 |
U32 |
XOR binary. |
POPV |
0x16 |
U32=Destination (#1) |
DBL |
-- |
Pop value from stack to variable. |
R_ROR |
0x17 |
|
U32 |
U32 |
Right-hand bit rotation. |
R_ROL |
0x18 |
|
U32 |
U32 |
Left-hand bit rotation. |
R_SHR |
0x19 |
|
U32 |
U32 |
Shift bit to the right. |
R_SHL |
0x1A |
|
U32 |
U32 |
Shift bit to the left. |
TOBIN |
0x1B |
|
U32 |
U32 |
BCD to binary conversion. |
TOBCD |
0x1C |
|
U32 |
U32 |
Binary to BCD conversion. |
TODEG |
0x1D |
|
DBL |
DBL |
Conversion from radians to degrees. |
TORAD |
0x1E |
|
DBL |
DBL |
Conversion from degrees to radians. |
ATAN2 |
0x1F |
|
DBL0,DBL1 |
DBL |
Arcotangent with two parameters. |
PUSHVB |
0x20 |
U32=Source (#1) |
DBL |
-- |
Push variable bit value into stack. |
POPVB |
0x21 |
U32=Destination (#1) |
DBL |
-- |
Pop value from stack to variable bit. |
POPL |
0x22 |
|
BOOL |
-- |
Pop logical value (0=false, otherwise true). |
|
0x23 |
|
|
|
(reserved) |
EQ |
0x24 |
|
DBL0,DBL1 |
BOOL |
Comparison: equal. |
NE |
0x25 |
|
DBL0,DBL1 |
BOOL |
Comparison: different. |
LT |
0x26 |
|
DBL0,DBL1 |
BOOL |
Comparison: minor. |
LE |
0x27 |
|
DBL0,DBL1 |
BOOL |
Comparison: less than or equal to. |
GT |
0x28 |
|
DBL0,DBL1 |
BOOL |
Comparison: greater than. |
GE |
0x29 |
|
DBL0,DBL1 |
BOOL |
Comparison: greater than or equal to. |
AND |
0x2A |
|
BOOL,BOOL |
BOOL |
AND logical. |
OR |
0x2B |
|
BOOL,BOOL |
BOOL |
OR logical. |
NOT |
0x2C |
|
BOOL |
BOOL |
NOT logical. |
XOR |
0x2D |
|
BOOL,BOOL |
BOOL |
logical XOR. |
CHS |
0x2E |
|
DBL |
DBL |
Sign change. |
SHR |
0x2F |
|
U32 |
U32 |
Logical shift to the right. |
SHL |
0x30 |
|
U32 |
U32 |
Logical shift to the left |
(#1) Source/destination means name of a variable, i.e., an offset to the string table.