Data Block (Data Initializer)

Use one of the following methods to access the data block (IEC data initializer):

·Click the Data Block button on the Navigation Bar.

·Select the menu command View > Data Block (in the IEC 1131-3 editor, select View > Data Initializer).

·Click the Data Block icon in the Instruction Tree.

This topic discusses the following subjects:

Making Address and Data Value Assignments in the Data Block

Example Data Block

Using Cut, Copy, and Paste in the Data Block Editor

Restrictions on the Use of ASCII Constants

Understanding and Resolving Errors

Downloading the Data Block to the PLC

Uploading a Data Block from the PLC

Creating a Data Block from CPU RAM

Making Address and Data Value Assignments in the Data Block

Back to Top

The data block allows you to make initial data assignments to V memory (variable memory) only. You can make assignments to bytes, words, or double words of V memory.

·A typical line in the data block editor contains a starting address and one or more data values. Comments (preceded by double forward slashes) are optional. The first line of the data block must have an explicit address assignment. Subsequent lines can have explicit or implicit address assignments. An implicit address assignment is made by the editor when you type multiple data values after a single address assignment, or type a line that contains only data values. The editor assigns an appropriate amount of V memory based on your previous address allocations and the size (byte, word, or double word) of the data value(s).

·The data block editor is a free-form text editor; that is, no specific fields are defined for particular types of information. After you finish typing a line and press the ENTER key, the data block editor formats the line (aligns columns of addresses, data, comments; capitalizes V memory addresses) and redisplays it. The data block editor accepts uppercase or lowercase letters and allows commas, tabs, or spaces to serve as separators between addresses and data values.

Example Data Block

Back to Top

Using Cut, Copy, and Paste in the Data Block Editor

Back to Top

You can use the Cut, Copy, and Paste commands and the Windows Clipboard to transfer data block source text in/out of STEP 7-Micro/WIN 32 (to/from the window of any text editor).

Restrictions on the Use of ASCII Constants

Back to Top

WORD addressing is limited to ASCII constants that are multiples of two: for example, 'ab', 'abcd', 'abcdef' are legal.

DWORD addressing is limited to ASCII constants that are multiples of four: for example, 'abcd', 'abcdefgh' are legal.

BYTE and undefined addressing accept any number: for example, 'a', 'ab', 'abc', 'abcd', 'abcde' are legal.

A single line in the data block can contain no more than 250 typed characters of data values, plus an (optional) address specification. Consequently, the maximum length possible for an ASCII constant in the data block editor is 250 characters. Escape sequence characters count as part of the 250 character limit. For example, '$00$01$$F' counts as 9 characters with respect to the line length limitation, even though when the data block is compiled, this string is interpreted to contain only 4 byte characters (0, 1, $, and an F).

Understanding And Resolving Errors

Back to Top

Entry errors are indicated in the left margin of the data block as soon as you press the ENTER key at the end of a line that contains errors. You must correct all entry errors before you can compile successfully.

Conditions that would cause an entry error include the following:

·Specifying the wrong memory area (V is the only memory area allowed)

·Specifying a certain memory size (byte or word) in an address assignment when the data value actually requires a greater size (for example, the data value 256 is too large to store in a VB address—a VW address is required)

·Using the wrong sequence on a line: typing the memory address after the data value(s) instead of before them

·Using illegal syntax or an invalid value

·Attempting to use a symbol instead of an absolute V memory address (symbols are not permitted in the data block)

·Failing to properly designate a comment (double forward slashes must precede the comment: //Sample comment )

If the data block is the active window, then you can compile the data block by using the menu command PLC > Compile. If the data block is not the active window, you can still compile it: use the menu command PLC > Compile All.

If the compiler finds errors when you compile your data block, the errors are displayed in the Output Window. Place the cursor on an error message in the Output Window and double-click to display the offending line in the data block window.

Errors that only show up after compilation include the following:

·Duplicate address assignments (for example, if you enter a line like "VB1 249, 250" you are making an implicit assignment of 250 to VB2—you cannot make a different data value assignment elsewhere to the address VB2)

·Address overlap (for example, if you assign a double word value like 65536 to VD0, you cannot make other assignments to V1, V2, or V3, because they are in use: they are part of the double word that begins at VD0)

Downloading the Data Block to the PLC

Back to Top

If you edit the data block, you need to download the data block to the PLC. Your editing does not take effect until the modified block is downloaded.

Uploading a Data Block from the PLC

Back to Top

You must have a project open in STEP 7-Micro/WIN before you can upload a data block.

If the data block in the PLC does not match the data block in your open project (or if there is no data block in your open project), then you can only upload the address and data value portions of the PLC's data block, and not the comments. The addresses are uploaded as byte values and the data values (including any literals) are uploaded in hexadecimal format.

Creating a Data Block from CPU RAM

Back to Top

Select the PLC > Create Data Block from RAM menu command to save CPU V memory to the EEPROM.

The current values of V memory will be read from the CPU. The V memory image is then downloaded as a Data Block.

Note:

The CPU must be in STOP mode for this operation.

See Also:

Data Retention after PLC Power Interruption

Constants

Communication Configuration

PLC Type Selection

System Block (PLC Configuration)

Error Messages

Getting Started Contents

Application User Reference