How does S7-1200 determine program changes through programming?

Publisher:幸福花开Latest update time:2023-01-30 Source: elecfansKeywords:S7-1200 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Introduction to recipe related instructions

The recipe function mainly uses four instructions. READ_DBL and WRIT_DBL are used to read and write recipe data blocks. RecipeExport and RecipeImport are used to convert between recipe data blocks and CSV files. The following describes the use of these four instructions.


READ_DBL

The purpose of the instruction is to transfer the value of the load memory part of the data block variable to the working memory part of the data block variable, as shown in Figure 1.


Typically used in recipes to read recipe data that is stored only in load memory into the active recipe.

1dafa55e-9802-11ed-bfe3-dac502259ad0.png

Figure 1 READ_DBL and WRIT_DBL principles

Table 1 Parameter list

parameter statement Data Types illustrate
REQ Input Bool REQ = 1: Read request, usually edge triggered
SRCBLK Input Variant The data block variable to be read
RET_VAL Return Int Status, error messages
BUSY Output Bool BUSY = 1: Reading
DSTBLK Output Variant The data block variable to be written has the same data type and optimization properties as SRCBLK

Take the example program for quick introduction to recipe function as an example

1dd3bc0a-9802-11ed-bfe3-dac502259ad0.png

Figure 2 READ_DBL application

As shown in Figure 2, the actual parameter of SRCBLK is "DB1_Cake Recipe".Static_1["DB3_Operation".Index], where "DB1_Cake Recipe".Static_1 is an array of UDT type (cake recipe), and with the following ["DB3_Operation".Index], it becomes an element in the array, that is, "DB1_Cake Recipe".Static_1["DB3_Operation".Index] is a UDT type (cake recipe).


The actual parameter of DSTBLK is "DB2_Activity Recipe". "DB2_Activity Recipe" is a DB established based on the UDT type (cake recipe), which means that "DB2_Activity Recipe" can be regarded as a UDT type.


The actual parameters of SRCBLK and DSTBLK are both of UDT type. You can use the READ_DBL instruction to read "DB1_cake recipe".Static_1["DB3_operation".Index], which is a group in the recipe, into the active recipe.


WRIT_DBL

The purpose of the instruction is to write the working memory part of the data block variable to the load memory part of the data block variable, as shown in Figure 1.


Typically used in recipes to write the active recipe to recipe data stored only in load memory.

Table 2 Parameter list

parameter statement Data Types illustrate
REQ Input Bool REQ = 1: Write request, usually edge triggered
SRCBLK Input Variant The data block variable to be read
RET_VAL Return Int Status, error messages
BUSY Output Bool BUSY = 1: Reading
DSTBLK Output Variant The data block variable to be written has the same data type and optimization properties as SRCBLK

Take the example program for quick introduction to recipe function as an example

1df751ec-9802-11ed-bfe3-dac502259ad0.png

Figure 3 WRIT_DBL application

As shown in Figure 3, the actual parameter of SRCBLK is "DB2_Activity Recipe". "DB2_Activity Recipe" is a DB established based on the UDT type (cake recipe), which means that "DB2_Activity Recipe" can be regarded as a UDT type.


The actual parameter of DSTBLK is "DB1_Cake Recipe".Static_1["DB3_Operation".Index], where "DB1_Cake Recipe".Static_1 is an array of UDT type (cake recipe), and with the following ["DB3_Operation".Index], it becomes an element in the array, that is to say, "DB1_Cake Recipe".Static_1["DB3_Operation".Index] is a UDT type (cake recipe).


The actual parameters of SRCBLK and DSTBLK are both of UDT type. You can use the WRIT_DBL instruction to write the active recipe to "DB1_Cake Recipe".Static_1["DB3_Operation".Index], which is a group in the recipe.


RecipeExport

The purpose of the instruction is to export the recipe data (UDT array) stored only in the working memory into a .csv file for easy editing in the EXCEL or ASCII editor on the computer.

Table 3 Parameter list

parameter statement Data Types illustrate
REQ Input Bool Edge trigger: Activate request
RECIPE_DB InOut Variant The recipe data block variables to be exported, usually an array of recipe UDT
DONE Output Bool DONE= 1: Export completed, only one scan cycle is maintained
BUSY Output Bool BUSY = 1: Export in progress
ERROR Output Bool ERROR= 1: Export error, only one scan cycle is maintained, error code see STATUS
STATUS Output Word Status or error code. Error code only lasts for one scan cycle.

Take the example program for quick introduction to recipe function as an example

1e128264-9802-11ed-bfe3-dac502259ad0.png

Figure 4 RecipeExport application

"DB1_Cake Recipe".Static_1 is an array of UDT type (cake recipe), which generates DB1_Cake Recipe.csv file after export.


RecipeImport

The purpose of the instruction is to import the .csv file edited by EXCEL or ASCII editor on the computer into recipe data (UDT array) stored only in the working memory.


Table 4 Parameter list

parameter statement Data Types illustrate
REQ Input Bool Edge trigger: Activate request
RECIPE_DB InOut Variant Imported recipe data block variables, usually array of recipe UDT
DONE Output Bool DONE= 1: Import completed, only one scan cycle is maintained
BUSY Output Bool BUSY = 1: Importing
ERROR Output Bool ERROR= 1: Import error, only one scan cycle is maintained, error code see STATUS
STATUS Output Word Status or error code. Error code only lasts for one scan cycle.

Take the example program for quick introduction to recipe function as an example

1e32a53a-9802-11ed-bfe3-dac502259ad0.png

Figure 5 RecipeImport application

After importing the DB1_cake recipe.csv file, you need to overwrite the value of the array of UDT type (cake recipe) "DB1_cake recipe".Static_1.


Keywords:S7-1200 Reference address:How does S7-1200 determine program changes through programming?

Previous article:A brief analysis of the trend and data recording curves in WINCC flexible
Next article:PLC troubleshooting flow chart share power failure check operation failure check input and output failure check

Recommended ReadingLatest update time:2024-11-16 14:56

An article analyzing S7-1200 and S7-1500 S7 communication
S7-1200 and S7-1200/S7-1500 S7 communication The PROFINET communication port of S7-1200 can be used as the server or client of S7 communication (CPU V2.0 and above). S7-1200 only supports S7 unilateral communication, which only requires configuration and programming on the client side, while the server side onl
[Embedded]
An article analyzing S7-1200 and S7-1500 S7 communication
Latest Embedded Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号