Function Block Sequence
The Sequence function block controls the sequence of events.
- In the step ReadDimStep, the dimensions configured in the TwinCAT System Manager, i.e. the number of axes and the number of lines in the FIFO memory, are read.
- After this, the position file is opened, and the file header read. The file header contains the number of columns and rows in the file.
- The most important step is StepReadTable. Here the data is read from the file into two alternately written buffers, each of about 64 kbytes in size (action ReadFile). The FIFO memory is continuously refilled from this intermediate buffer, keeping it as full as possible (action FillFifo). When the FIFO memory has been filled for the first time, the axes are started (action RunTable).
- After all the positions have been worked through, the FIFO group stops, and the group is dissolved by StepConfigPTP.
- Finally, the file is closed.
For the purposes of demonstration, this program reads the axis positions out of a file. The position data can of course be made available by quite different methods. They can, for example, also be directly calculated at run-time, or acquired by a measurement system.
The running of the program should not be interrupted at unsuitable times, for instance in order to load a new program version into the TwinCAT run-time system. This can lead to files remaining open, with a following inability to re-open them when the PLC next starts. In such cases the sequence will stop with an error message in one of the steps. If that happens, start the TwinCAT System again by means of the TwinCAT icon in task bar.