Siemens PLC Learning Note 16-(Structure of logical blocks)

Source: Internet
Author: User

Logical blocks include: function (FC), function block (FB), organization block (OB), which are made up of variable declaration tables, code snippets, and their properties.

1. local Variable Declaration table

Each logical block is preceded by a variable declaration table, which is called a local variable declaration table.



Local data includes parameters, local variables.

Local variables include static variables, temporary variables.

1) function (FC) variable Introduction

FC has no background data block, that is, FC cannot use static variables, and temporary variables can be used. The input, output, and I/O parameters are stored as pointers to arguments in the extra space reserved by the operating system for parameter passing.

2) function block (FB) variable Introduction

FB In addition to temporary variables, all parameters of the storage space in the background data block.

3) Tissue block (OB)

OB has only temporary variables, other variables are managed by the operating system, and users cannot participate.

2. Data types for local variables

A local variable can be defined as a basic data type, a duplex data type, or a parameter type that is specifically used for parameter passing, such as a timer, a counter, an address or a pointer to a block, and so on.



3. How to use variables

1) Use the variable name, preceded by the prefix "#", to distinguish it from the symbolic address in the symbol table. In incremental mode, the prefix is automatically generated.

2) directly use the address of the local variable, which is only valid for the background data block and the L stack.

In addition, when calling the FB block, the background data block needs to be generated before the call, and its sequential format needs to be consistent with the variable declaration table.



Siemens PLC Learning Note 16-(Structure of logical blocks)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.