Remanent Data - Beckhoff BC3150 Documentation

Bus terminal controller for profibus-dp
Table of Contents

Advertisement

Programming
5.4

Remanent data

2000 kbyte of remanent data are available for the BX controller. These data are declared as VAR RETAIN in
PLC Control:
Example
VAR RETAIN
    Test    :BOOL;
    Count   :INT;
END_VAR
Retain data are located between VAR RETAIN and END_VAR. These data are stored in a NOVRAM and
are consistent across the whole 2 kbyte range. The RETAIN data are stored in the NOVRAM after each
cycle. For 2 kbyte approx. 2 ms are required (for 1 kbyte approx. 1 ms). The variables can be configured
locally or globally. Allocated variables (%MB, %QB, %IB) cannot be used as remanent data.
Do not use VAR_RETAIN in function blocks
VAR_RETAIN should not be used in function blocks. All FB data are copied into the retain
memory. This leads to an unnecessary increase in cycle time, and the retain memory is
Note
filled with unnecessary data.
Do not use variables with address as remanent data
Variables that have been assigned an address (%MB, %QB, %IB) must not be used as re-
manent data.
Note
Example for remanent data in the function block
This should be avoided, if possible, since all the data of a function block, in which even just a single
remanent bit is found, are stored by default. A program sample can be found below.
Function block test (no program code required - in ST semicolon is sufficient)
FUNCTION_BLOCK Test
VAR_INPUT
END_VAR
VAR_OUTPUT
END_VAR
VAR
END_VAR
VAR_IN_OUT 
    Counter   :INT;
END_VAR
MAIN program
PROGRAM MAIN
VAR
    fb_Test:Test;
END_VAR
VAR RETAIN
    iCounter1:INT;
END_VAR
fb_Test(Counter:=iCounter1);
58
Version: 2.1.0
BC3150

Advertisement

Table of Contents
loading

Table of Contents