Hardware environment:
S7-1200 CPU V2.0 (6ES7214-1AE30-0XB0)
Software Environment:
(1) Windows 7 Professional SP1 64-bit
(2) STEP7 V11 SP2
step
1. Creating a DB block: After you have added an S7-1200 device to your project, you can add new data blocks under the "Program block" of this PLC in the project tree.
Figure 1 DB block creation
Select the data block under the "Add New Block" window that opens. The following is a description of the configuration under this window:
Name: Here you can type the symbolic name of the DB block. If no changes are made, the default symbolic name assigned by the system will be retained. For example, the symbol name assigned to the DB block here is "Data_block_2";
Type: Here you can select the type of data block you want to create - global data block or instance data block via the drop-down menu. If you want to create an instance DB, the drop-down menu lists the FBs already in the project for the user to select.
Language: For creating a data block, it cannot be changed here.
No.: The default configuration is “Autoâ€, that is, the system automatically assigns a block number to the generated data block. Of course, you can also select “Manualâ€, then the down menu at “Number†will be highlighted, so that the user can assign the DB block number by himself.
Block access: The default option is “Optimizedâ€. When this option is selected, the variables in the data block have only the symbolic name and there is no information about the address offset. The data block can only be accessed by symbolic addressing. Select "Optimized" to create data blocks to optimize the CPU's allocation and access to the storage space, improve CPU performance; users can also choose "Standard - compatible with S7-300/400" to obtain the same data block as S7-300/400 Features, variables in data blocks have symbolic names and offsets for symbolic access and absolute address access.
Note: The block access properties of a data block can only be defined when the data block is created. The access properties of the data block cannot be modified after the creation is complete. If absolute address access to the data block is required during programming, the block access must be set to "Standard - compatible with S7-300/400" when creating the data block.
When the above data block attributes are all defined, click the "OK" button to create a data block. The user can see the data block just created in the project tree, as shown in Figure 2:
Figure 2 DB block in the project tree
2. Define variables for the data block: Double-click to open the data block to add variables line by line, as shown in Figure 3.
Figure 3 Editing of the DB block
If the data block is selected "Standard - compatible with S7-300/400", the "Offset" column can be seen in the data block and the system generates the address offset for each variable in the column after compilation. The data block set to optimize access does not have this column.
By default, some variable attribute columns are not displayed. You can choose to show hidden columns in the menu that appears by right-clicking on any column heading, as shown in Figure 4:
Figure 4 shows the hidden column
Table 1 is a description of all the columns defined by the data block variable:
Table 1 Column Attributes in DB Blocks
Define the data type of the variable: you can define basic data types for variables, complex data types (time and date, strings, structures, arrays, etc.), PLC data types (such as user-defined data types), system data types, and hardware data. Types of. You can type the data type identifier directly or by selecting the selection button in the column. As shown below:
Figure 5 defines the data type
When you need to create multiple variables with the same data type, you can place the cursor in the lower right corner of the first variable name. After the cursor changes to the "+" symbol and drag the cursor down, you can easily create multiple similar attributes. variable:
Figure 6 Creating multiple variables
Retention of DB block data: For data blocks that can be optimized for access, each variable can be set to be maintained or not; standard data blocks can only be set to keep all variables unchanged or not, not for each variable. Settings. As shown in Figure 7 and Figure 8:
Figure 7 Only all variables can be set or not maintained in the standard data block.
Figure 8 The retentivity of each variable can be set separately in the data block that can be optimized for access.
3. Access to the data block:
Symbol access: .<variable name>; for example: Data_Block_1.Var1;
Absolute address access: <variable length and offset>: DB1.DBX0.0; DB1.DBB0; DB1.DBW0; DB1.DBD0.
Note: Complex data types can only be symbolically addressed.
LED Underwater light,Full colour underwater luminaires,Waterproof lighting underwater lamp
Kindwin Technology (H.K.) Limited , https://www.ktl-led.com