Siemens PLC Learning Note 19-(FB programming)

Source: Internet
Author: User

The FB block can be called multiple times by the OB1, and all parameters and static data of the function are stored in a separate data block (DB) that is assigned to the function block, which is referred to as the background data block. When the FB is called, the background data block is automatically opened, the value of the actual parameter is stored in the background data block, and when the block exits, the data in the background data block remains.

Below through the case design introduction FB how to write it.

Case: There are currently 3 tanks, each tank has 2 liquid level sensors, UH1, UH2, UH3 for high level sensor, "1" effective; UL1, UL2, UL3 for low level sensors, "0" effective. Y1, Y2, Y3 respectively are 3 water tank inlet solenoid valve, Y4, Y5, Y6 respectively, 3 water storage tank discharge solenoid valve. SB1, SB2, SB3 respectively for 3 water tank discharge solenoid valve Manual Open button, SB4, SB5, SB6 respectively, 3 water tank drain solenoid valve manual Close button. Now need to achieve the following control: SB1, SB2, SB3 in the PLC external operation set, through the artificial way, in a random order of the tank emptying. As soon as the tank "empty" signal is detected, the system will automatically inject water into the tank until the tank "full" signal is detected. The order of water tank injection is the same as the tank emptying order, each time only one water tank for water injection operation. Control systems such as:



The program is as follows:

1. Symbol table


2. Program Module General diagram


3.FB

FB parameter setting diagram:




FB Program diagram:


4.OB100 (initialization function before program start)

This module realizes the function is when SB1, SB2, SB3 as long as has one to be pressed, then the water tank valve control becomes the automatic control, each water tank valve resets


5.ob1

Just an example of 1 tank call diagram, 2, 3 water tank call the FB1 way, just the background data block needs to become DB2, DB3


The program code can be downloaded here.


Siemens PLC Learning Note 19-(FB programming)

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.