[Up]
3.1 Connecting the inputs and outputs in the control algorithm
The inputs and outputs of the driver must be interconnected with the individual tasks (.mdl files). The individual tasks (QTASK or TASK blocks) are connected to the QTask, Level0,…, Level3 outputs of the main EXEC block. Use the blocks depicted in Fig. 3.2 to interchange data between the control algorithm and the S7Drv driver.
The From block allowing the user to read one input signal has the Goto tag set to S7C__<IN>. The Goto block allowing the user to set one output signal has the Goto tag set to S7C__<OUT>, where <IN> and <OUT> are strings referring to the so-called emphobject dictionary (see below). All the strings used for accessing data provided or accepted by the driver always have the S7C prefix right at the beginning of the tag mandatory followed by two _ characters (underscore).
The use of multi-input/output blocks is recommended to preserve bandwidth. See the function block reference manual [3] for details about the INQUAD, INOCT, INHEXD, OUTQUAD, OUTOCT and OUTHEXD blocks.
The rest of the input or output string reference is interpreted by the driver. The syntax follows the IEC 61131-3 recommendation and also the STEP7 syntax, the only difference is using the underscore character instead of dots. Therefore the syntax can be:
- <area><type><index>
- <area><index>
- <area><index>_<subindex>
- <area><type><index>_<subindex>
The <area> string in the above notation can be:
- – memory flag
- – input
- – output
- – data block (format no. 4)
- – timer (format no. 2)
- – counter (format no 2)
Similarly the <type> string has the following options:
- – byte (0…255)
- – word (0…65535)
- – dword (0…4294967295)
- – short (-32768…32767)
- – long (-2147483648…2147483647)
- – integer, see type long
- – float (-3.4E+38…3.4E+38)
Finally the <subindex> is a number defining the object in the object dictionary, whose value is read or written.
It is possible to read/write additional auxiliary signals of the given object. This can be achieved by appending the following strings:
- – allias for basic signal value
- – read enable
- – write enable
- – write force
- – number of seconds since the last valid value was read (read-only)
- – allow change area code of the object (expert only)
- – allow change index (offset) of the object (expert only)
- – allow change Datablock number of the object (expert only)
The driver supports multi-flags, therefore it is possible to read/write several signals at once. See the (INQUAD, OUTQUAD, INOCT, OUTOCT and INHEXD, OUTHEXD) function blocks as displayed in Figure 3.2. In this case the block name references the first object and the signals are mapped to this object and the consecutive ones (groups of 4, 8 or 16). This preserves communication bandwidth and also clarity of the algorithm.
[Back to top] [Up]