User Manual

Programming made easy
6.1 Easy to design your user program
Easy Book
92 Manual, 03/2014, A5E02486774-AF
6.1.3
Data blocks provide easy storage for program data
You create data blocks (DB) in your user program to store data for the code blocks. All of the
program blocks in the user program can access the data in a global DB, but an instance DB
stores data for a specific function block (FB).
Your user program can store data in the specialized memory areas of the CPU, such as for
the inputs (I), outputs (Q), and bit memory (M). In addition, you can use a data block (DB) for
fast access to data stored within the program itself.
The data stored in a DB is not deleted when the data block is closed or the execution of the
associated code block comes to an end. There are two types of DBs:
A global DB stores data for the code blocks in your program. Any OB, FB, or FC can
access the data in a global DB.
An instance DB stores the data for a specific FB. The structure of the data in an instance
DB reflects the parameters (Input, Output, and InOut) and the static data for the FB. The
Temp memory for the FB is not stored in the instance DB.
Although the instance DB reflects the data for a specific FB, any code block can access the
data in an instance DB.
6.1.4
Creating a new code block
1.
Open "Program blocks" folder.
2.
Double-click "Add new block".
3.
In the "Add new block" dialog,
click the type of block to add.
For example, click the
"Function (FC)" icon to add an
FC.
4.
Specify the programming
language for the code block by
selecting "LAD" from the drop-
down menu.
5.
Click "OK" to add the block to
the project.
Selecting the "Add new and open" option (default) opens the code block in the Project view.