Upload
others
View
3
Download
0
Embed Size (px)
Citation preview
Customized Function Blocks for DataSiteCatalog Numbers 1758-FLO301, 1758-FLO302, 1758-RTU201, 1758-RTU202Reference Manual
Important User Information
Solid state equipment has operational characteristics differing from those of electromechanical equipment. Safety Guidelines for the Application, Installation and Maintenance of Solid State Controls (publication SGI-1.1 available from your local Rockwell Automation sales office or online at http://literature.rockwellautomation.com) describes some important differences between solid state equipment and hard-wired electromechanical devices. Because of this difference, and also because of the wide variety of uses for solid state equipment, all persons responsible for applying this equipment must satisfy themselves that each intended application of this equipment is acceptable.
In no event will Rockwell Automation, Inc. be responsible or liable for indirect or consequential damages resulting from the use or application of this equipment.
The examples and diagrams in this manual are included solely for illustrative purposes. Because of the many variables and requirements associated with any particular installation, Rockwell Automation, Inc. cannot assume responsibility or liability for actual use based on the examples and diagrams.
No patent liability is assumed by Rockwell Automation, Inc. with respect to use of information, circuits, equipment, or software described in this manual.
Reproduction of the contents of this manual, in whole or in part, without written permission of Rockwell Automation, Inc., is prohibited.
Throughout this manual, when necessary, we use notes to make you aware of safety considerations.
Allen-Bradley, Datasite, Rockwell Automation, and TechConnect are trademarks of Rockwell Automation, Inc.
Trademarks not belonging to Rockwell Automation are property of their respective companies.
WARNINGIdentifies information about practices or circumstances that can cause an explosion in a hazardous environment, which may lead to personal injury or death, property damage, or economic loss.
IMPORTANT Identifies information that is critical for successful application and understanding of the product.
ATTENTIONIdentifies information about practices or circumstances that can lead to: personal injury or death, property damage, or economic loss. Attentions help you identify a hazard, avoid a hazard, and recognize the consequence.
SHOCK HAZARD
Labels may be on or inside the equipment, such as a drive or motor, to alert people that dangerous voltage may be present.
BURN HAZARDLabels may be on or inside the equipment, such as a drive or motor, to alert people that surfaces may reach dangerous temperatures.
Table of ContentsTable of Contents Preface
Who Should Use this Manual . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7Purpose of this Manual . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7Related Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Chapter 1Customized Function Blocks for 1758-RTU Controllers
B_AERR_CLR. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9B_ERR_CLR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10B_ERR_GET. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11BIT_EXPAND . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12BIT_MERGE. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14BLOCK_ADD. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16BLOCK_CLR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18CAL_LINE_N . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19CAL_LINE_X . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20CLOCK_GET . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21CLOCK_SET. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22COM_MSG . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23COM_MSG_STATUS. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24COM_US_CFG . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25COM_US_SET . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26EN_LED . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27EN_NET . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28EN_RS485 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29EV_CALE_CFG . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30EV_CLK_CFG . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31EV_GET . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33EV_RTC_SET . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34EV_SEC_CFG. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35EV_TIME_CFG . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36HARTB_ADD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37HARTB_AEC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39HARTB_CLR. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40HARTB_EC. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41HARTB_EG . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42HARTT_CFG . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43HARTT_ST . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44PW_SHDN. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45REG_MOVE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46REG_R_REAL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47REG_R_STR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48REG_R_UDINT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49REG_R_UINT. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50REG_W_REAL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51REG_W_STR. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52REG_W_UDINT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53REG_W_UINT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
3 Publication 1758-RM001C-EN-P - October 2010
4 Table of Contents
SWAP_DWORD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55SWAP_WORD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56SYS_AD_GET. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57SYS_ERR_GET. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58SYS_ERR_RST . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
Chapter 2Customized Function Blocks for 1758-FLO Controllers
B_AERR_CLR. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61B_ERR_CLR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62B_ERR_GET. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63BIT_EXPAND . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64BIT_MERGE. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66BLOCK_ADD. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68BLOCK_CLR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70COM_MSG . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71COM_MSG_STATUS. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72COM_US_CFG . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73COM_US_SET . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74CAL_LINE_N . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75CAL_LINE_X . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76CLOCK_GET . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77CLOCK_SET. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78EN_LED . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79EN_NET . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80EN_RS485 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81ENRON_CFG. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82GET_3_PARA. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83GET_7_PARA. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85GET_C_ALL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86GET_C_TIME. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87GET_C_TODAY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88GET_C_YESTERDAY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89GET_ENG_VAL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90GET_FLOW . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91GET_GX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92GET_MR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94HARTB_ADD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95HARTB_AEC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97HARTB_CLR. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98HARTB_EC. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99HARTB_EG . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100HARTT_CFG . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101HARTT_ST . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102PW_SHDN. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103REG_MOVE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104REG_R_REAL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
Publication 1758-RM001C-EN-P - October 2010
Table of Contents 5
REG_R_STR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106REG_R_UDINT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107REG_R_UINT. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108REG_W_REAL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109REG_W_STR. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110REG_W_UDINT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111REG_W_UINT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112SWAP_DWORD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113SWAP_WORD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114SYS_AD_GET. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115SYS_ERR_GET. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116SYS_ERR_RST . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
Publication 1758-RM001C-EN-P - October 2010
6 Table of Contents
Publication 1758-RM001C-EN-P - October 2010
Preface
Read this preface to familiarize yourself with the rest of the manual. It provides information concerning:
• who should use this manual
• the purpose of this manual
• related documentation
Who Should Use this Manual
Use this manual if you are responsible for programming or troubleshooting DataSite controllers.
You should have a basic understanding of electrical circuitry and familiarity with relay logic. If you do not, obtain the proper training before using this product.
Purpose of this Manual This manual is a reference guide that describes the customized function blocks you can use in DataSite Workbench for programming DataSite controllers.
Related Documentation The publications listed in this table contain more information on the DataSite controllers.
Related publications for DataSite controllers
Pub. Title Pub. Number Description
DataSite Electronic Flow Meter and Remote Terminal Unit Installation Instructions
1758-IN001 Information on how to install a DataSite controller.
DataSite Electronic Flow Meter and Remote Terminal Unit Hardware User Manual
1758-UM001 Information on how to install and wire a DataSite controller.
DataSite Electronic Flow Meter and Remote Terminal Unit Software User Manual
1758-UM002 Information on how to install and use the software tools, DS Settings, DS FloConfig, and DS DNP3 to configure and monitor DataSite controllers.
DataSite Screen Builder user documentation available on the DataSite CD and from http://www.isagraf.com
— Information on using the DataSite Screen Builder to create graphical user interfaces.
DataSite Workbench user documentation available on the DataSite CD and from http://www.isagraf.com
— Information on using the DataSite Workbench to develop multi-process control projects for use with DataSite controllers.
Modbus Protocol Specifications available from www.modbus.org
— Information about the Modbus protocol.
Allen-Bradley Programmable Controller Grounding and Wiring Guidelines
1770-4.1 In-depth information on grounding and wiring Allen-Bradley programmable controllers.
Application Considerations for Solid-State Controls SGI-1.1 A description of important differences between solid-state programmable controller products and hard-wired electromechanical devices.
7 Publication 1758-RM001C-EN-P - October 2010
8
You can view or download publications at http://literature.rockwellautomation.com. To order paper copies of technical documentation, contact your local Rockwell Automation distributor or sales representative.
National Electrical Code - Published by the National Fire Protection Association of Boston, MA.
— An article on wire sizes and types for grounding electrical equipment.
Allen-Bradley Publication Index SD499 — A complete listing of current documentation, including ordering instructions. Also indicates whether the documents are available on CD-ROM or in multi-languages.
Allen-Bradley Industrial Automation Glossary AG-7.1 A glossary of industrial automation terms and abbreviations.
Related publications for DataSite controllers (Continued)
Pub. Title Pub. Number Description
Publication 1758-RM001C-EN-P - October 2010
Chapter 1
Customized Function Blocks for 1758-RTU Controllers
This chapter provides information on the customized function blocks you can use in DataSite Workbench for programming the 1758-RTU DataSite controllers.
B_AERR_CLR Function
Clear all the scan setting errors.
Statement Instance
TIP The function block B_AERR_CLR executes the same function as the Clear Error function in the Scan Settings of the DS Settings tool. For more information, refer to the DataSite Software User Manual, publication 1758-UM002.
B_AERR_CLR
44642
9 Publication 1758-RM001C-EN-P - October 2010
10 Customized Function Blocks for 1758-RTU Controllers
B_ERR_CLR Function
Clear the corresponding scan block configuration error.
Statement Instance
Parameter Explanation
B_ERR_CLR parameter explanation
Input Return Data Type Description Parameter Value
NUM — UINT Scan data block number —
B_ERR_CLR
NUM
44643
Publication 1758-RM001C-EN-P - October 2010
Customized Function Blocks for 1758-RTU Controllers 11
B_ERR_GET Function
Get the corresponding scan block configuration error.
Statement Instance
Parameter Explanation
If you encounter a communication error, check the connection between the port and the instrument, and the parameter settings of the scan block.
B_ERR_GET parameter explanation
Input Return Data Type Description Parameter Value
NUM — UINT Scan data block number —
— ERR UINT Error of scan block 0: Normal1: Communication error
— CON UINT Count of scan block communication errors.
Error count
B_ERR_GET
NUM
ERR
CON
44644
Publication 1758-RM001C-EN-P - October 2010
12 Customized Function Blocks for 1758-RTU Controllers
BIT_EXPAND Function
Bit manipulation operations. One word is expanded to 16 bits.
Statement Instance
Parameter Explanation
BIT_EXPAND parameter explanation
Input Return Data Type Description Parameter Value
IN — WORD Input value —
— B00 BOOL Bit value 0 or 1
— B01 BOOL Bit value 0 or 1
— B02 BOOL Bit value 0 or 1
— B03 BOOL Bit value 0 or 1
— B04 BOOL Bit value 0 or 1
— B05 BOOL Bit value 0 or 1
— B06 BOOL Bit value 0 or 1
— B07 BOOL Bit value 0 or 1
— B08 BOOL Bit value 0 or 1
— B09 BOOL Bit value 0 or 1
— B10 BOOL Bit value 0 or 1
BIT_EXPANDB00
B01
B02
B03
B04
B05
B06
B07
B08
B09
B10
B11
B12
B13
B14
B15
IN
44955
Publication 1758-RM001C-EN-P - October 2010
Customized Function Blocks for 1758-RTU Controllers 13
— B11 BOOL Bit value 0 or 1
— B12 BOOL Bit value 0 or 1
— B13 BOOL Bit value 0 or 1
— B14 BOOL Bit value 0 or 1
— B15 BOOL Bit value 0 or 1
BIT_EXPAND parameter explanation (Continued)
Input Return Data Type Description Parameter Value
Publication 1758-RM001C-EN-P - October 2010
14 Customized Function Blocks for 1758-RTU Controllers
BIT_MERGE Function
Bit manipulation operations. 16 bits are merged into one word.
Statement Instance
Parameter Explanation
BIT_MERGE parameter explanation
Input Return Data Type Description Parameter Value
B00 — BOOL Bit value 0 or 1
B01 — BOOL Bit value 0 or 1
B02 — BOOL Bit value 0 or 1
B03 — BOOL Bit value 0 or 1
B04 — BOOL Bit value 0 or 1
B05 — BOOL Bit value 0 or 1
B06 — BOOL Bit value 0 or 1
B07 — BOOL Bit value 0 or 1
B08 — BOOL Bit value 0 or 1
B09 — BOOL Bit value 0 or 1
B10 — BOOL Bit value 0 or 1
B11 — BOOL Bit value 0 or 1
BIT_MERGEB00
B01
B02
B03
B04
B05
B06
B07
B08
B09
B10
B11
B12
B13
B14
B15
VAL
44956
Publication 1758-RM001C-EN-P - October 2010
Customized Function Blocks for 1758-RTU Controllers 15
B12 — BOOL Bit value 0 or 1
B13 — BOOL Bit value 0 or 1
B14 — BOOL Bit value 0 or 1
B15 — BOOL Bit value 0 or 1
— VAL WORD Output value —
BIT_MERGE parameter explanation (Continued)
Input Return Data Type Description Parameter Value
Publication 1758-RM001C-EN-P - October 2010
16 Customized Function Blocks for 1758-RTU Controllers
BLOCK_ADD Function
Add scan block.
Statement Instance
Parameter Explanation
BLOCK_ADD parameter explanation
Input Return Data Type Description Parameter Value
PORT — UINT Select COM port 1: COM12: COM2
ADR — UINT Module address 0…247
SIG — UINT Signal type 1: Read coil register2: Read state register3: Read hold register4: Read input register5: Write 1Coil Register6: Write 1Hold Register15: Write multi-coil register16: Write multi-hold register
BLOCK_ADDPORT
ADR
SIG
TIME
M
S
NUM
B_NO
44646
Publication 1758-RM001C-EN-P - October 2010
Customized Function Blocks for 1758-RTU Controllers 17
TIME — UINT Scan time Bits 7 through 0
Bits 7 through 5 indicate the time unit as follows:
Bit 7 Bit 6 Bit 5 Time units0 0 0 50 ms0 0 1 500 ms0 1 0 5 s0 1 1 50 s1 0 0 5 min1 0 1 50 min1 1 0 5 h1 1 1 50 h
Bits 4 through 0 indicate the time value. Range is 1…9.
M — UINT Master address —
S — UINT Slave address —
NUM — UINT Number of registers
—
— B_NO UINT Data block number —
TIP The function block BLOCK_ADD executes the same function as the Edit function in the Scan Settings of the DS Settings tool. For more information, refer to the DataSite Software User Manual, publication 1758-UM002.
BLOCK_ADD parameter explanation (Continued)
Input Return Data Type Description Parameter Value
Publication 1758-RM001C-EN-P - October 2010
18 Customized Function Blocks for 1758-RTU Controllers
BLOCK_CLR Function
Clear all scan block configuration.
Statement Instance
BLOCK_CLR
44645
Publication 1758-RM001C-EN-P - October 2010
Customized Function Blocks for 1758-RTU Controllers 19
CAL_LINE_N Function
Perform a linear calculation to transform the engineering value X to the standard value N.
Engineering algorithm N=(X-X0)*(N1-N0)/(X1-X0)+N0
where
N1: maximum standard valueN0: minimum standard valueX1: maximum engineering valueX0: minimum engineering value
Statement Instance
Parameter Explanation
CAL_LINE_N parameter explanation
Input Return Data Type Description
X — REAL Engineering value
X1 — REAL Maximum engineering value
X0 — REAL Minimum engineering value
N1 — UINT Maximum standard value
N0 — UINT Minimum standard value
— N UINT Standard value
CAL_LINE_NX
X1
X0
N1
N0
N
44641
Publication 1758-RM001C-EN-P - October 2010
20 Customized Function Blocks for 1758-RTU Controllers
CAL_LINE_X Function
Perform a linear calculation to transform the standard value N to the engineering value X.
Engineering Algorithm: X=(X1-X0)*(N-N0)/(N1-N0)+X0
where
N1: the maximum standard valueN0: the minimum standard valueX1: the maximum engineering valueX0: the minimum engineering value
Statement Instance
Parameter Explanation
CAL_LINE_X parameter explanation
Input Return Data Type Description
N — UINT Standard value
N1 — UINT Maximum standard value
N0 — UINT Minimum standard value
X1 — REAL Maximum engineering value
X0 — REAL Minimum engineering value
— X REAL Engineering value
CAL_LINE_XN
N1
N0
X1
X0
X
44640
Publication 1758-RM001C-EN-P - October 2010
Customized Function Blocks for 1758-RTU Controllers 21
CLOCK_GET Function
Get the system time.
Statement Instance
Parameter Explanation
CLOCK_GET parameter explanation
Input Return Data Type Description Parameter Value
— HOUR UINT Hour 00…23
— MINU UINT Minute 00…59
— SEC UINT Second 00…59
— YEAR UINT Year 00…99
— MON UINT Month 01…12
— DAY UINT Day 01…31
— WEEK UINT Week 01…07
CLOCK_GETHOUR
MINU
SEC
YEAR
MON
DAY
WEEK
44647
Publication 1758-RM001C-EN-P - October 2010
22 Customized Function Blocks for 1758-RTU Controllers
CLOCK_SET Function
Set the system clock.
Statement Instance
Parameter Explanation
CLOCK_SET parameter explanation
Input Return Data Type Description Parameter Value
SET — UINT Enable setting 1: Enable0: Disable
HOUR — UINT Hour 00…23
MINU — UINT Minute 00…59
SEC — UINT Second 00…59
YEAR — UINT Year 00…99
MON — UINT Month 01…12
DAY — UINT Day 01…31
WEEK — UINT Week 01…07
CLOCK_SET
HOUR
SET
MINU
SEC
YEAR
MON
DAY
WEEK
44648
Publication 1758-RM001C-EN-P - October 2010
Customized Function Blocks for 1758-RTU Controllers 23
COM_MSG Function
Trigger a scan via the COM port.
Statement Instance
Parameter Explanation
COM_MSGEN
PORT
ADR
SIG
M
S
NUM44957
COM_MSG parameter explanation
Input Return Data Type Description Parameter Value
EN — BOOL Enable or disable 0: Disable1: Enable
PORT — BYTE Select the COM port 1: COM12: COM2
ADR — BYTE Address for slave station 1…247
SIG — BYTE Modbus command 1: Read coil register2: Read state register3: Read hold register4: Read input register5: Write 1Coil Register6: Write 1Hold Register15: Write multi-coil register16: Write multi-hold register
M — UINT Address for master —
S — UINT Address for slave —
NUM — UINT Total numbers for exchange 1…120
Publication 1758-RM001C-EN-P - October 2010
24 Customized Function Blocks for 1758-RTU Controllers
COM_MSG_STATUS Function
Get status of the COM0 or COM1 message block.
Statement Instance
Parameter Explanation
If you encounter a communication error, check the connection between the COM port and the DataSite controller or an equivalent device, and the settings for the COM_MSG function block.
COM_MSG_STATUS parameter explanation
Input Return Data Type Description Parameter Value
TYPE — BYTE COM port number 1: COM12: COM2
— STAT BYTE Status of the COM_MSG function block return value
0: COM_MSG configuration OK1: COM_MSG trigger on (in progress)2: COM_MSG trigger OK (completed)3: COM_MSG configuration error255: COM_MSG trigger error
COM_MSG_STATUS
TYPE STAT
44958
Publication 1758-RM001C-EN-P - October 2010
Customized Function Blocks for 1758-RTU Controllers 25
COM_US_CFG Function
Configure the serial port (COM1 and COM2) parameter.
Statement Instance
Parameter Explanation
USART_CFG Data typeSTRUCT
STATION UINT 1…247, Slave device Module AddressPROTOCOL UINT 1: MODBUS RTU protocol,
2: MODBUS ASCII protocolSTATE UINT 0: Slave,
1: MasterDUPLEX UINT 0: Full-duplex,
1: Half-duplexBAUD UDINT 2400,4800,9600,14400,19200,38400,
56000,57600,115200, Baud RatePARITY UINT 0: EVEN,
1: ODD,4: NONE
DATA_BITS UINT 2: 7 data bits,3: 8 data bits
STOP_BITS UINT 0: 1 stop bit2: 2 stop bits
PORT_TYPE UINT 0: RS2321: RS485
TIMEOUT UINT 1…1000, in 10ms unitsTIMEDELAY UINT 1…300, in 10ms units
END_STRUCT
COM_US_CFG parameter explanation
Input Return Data Type Description Parameter Value
ID — BYTE Input value 1: COM12: COM2
SET — USART_CFG Serial port parameter
COM_US_CFG
ID
SET45586
Publication 1758-RM001C-EN-P - October 2010
26 Customized Function Blocks for 1758-RTU Controllers
COM_US_SET Function
Activate the parameter for serial port (COM1 and COM2).
Statement Instance
Parameter Explanation
COM_US_CFG parameter explanation
Input Return Data Type Description Parameter Value
ID — BYTE The serial port to be activated
1: COM12: COM2
COM_US_SET
ID45587
Publication 1758-RM001C-EN-P - October 2010
Customized Function Blocks for 1758-RTU Controllers 27
EN_LED Function
Enable LED power supply.
Statement Instance
Parameter Explanation
EN_LED parameter explanation
Input Return Data Type Description Parameter Value
EN None BOOL LED power supply enable indication
0: Disable LED power supply1: Enable LED power supply
TIP This function is similar to the Power Enable setting for controller communication settings in DS Settings. For more information, refer to the DataSite Software User Manual, publication 1758-UM002.
EN_LED
EN
44638
Publication 1758-RM001C-EN-P - October 2010
28 Customized Function Blocks for 1758-RTU Controllers
EN_NET Function
Enable Ethernet power supply.
Statement Instance
Parameter Explanation
EN_NET parameter explanation
Input Return Data Type Description Parameter Value
EN None BOOL Ethernet power supply enable indication
0: Disable Ethernet power supply1: Enable Ethernet power supply
TIP This function is similar to the Power Enable setting for controller communication settings in DS Settings. For more information, refer to the DataSite Software User Manual, publication 1758-UM002.
EN_NET
EN
44637
Publication 1758-RM001C-EN-P - October 2010
Customized Function Blocks for 1758-RTU Controllers 29
EN_RS485 Function
Enable RS485 power supply.
Statement Instance
Parameter Explanation
EN_RS485 parameter explanation
Input Return Data Type Description Parameter Value
EN None BOOL RS485 power supply enable indication
0: Disable RS485 power supply1: Enable RS485 power supply
TIP This function is similar to the Power Enable setting for controller communication settings in DS Settings. For more information, refer to the DataSite Software User Manual, publication 1758-UM002.
44636
EN_RS485
EN
Publication 1758-RM001C-EN-P - October 2010
30 Customized Function Blocks for 1758-RTU Controllers
EV_CALE_CFG Function
Configure the calendar event parameters.
Use this function block together with the function block EV_RTC_SET to configure a calendar event. EV_RTC_SET is used to enable settings in the CFG function blocks based on the real-time clock.
Statement Instance
Parameter Explanation
EV_CALE_CFG
MODE
ENAB
44651
EV_CALE_CFG parameter explanation
Input Return Data Type Description Parameter Value
ENABLE — BOOL Calendar Event Enable symbol
TRUEFALSE
MODE — UINT Calendar Event Mode
• 0: Week. When the week of the real-time clock changes, implement a corresponding time interrupt task at 0 seconds, 0 minutes, 0 hours, Monday, every week.
• 1: Month. When the month of the real-time clock changes, implement a corresponding time interrupt task at 0 seconds, 0 minutes, 0 hours, the first day, every month.
• 2: Year. When the year of the real-time clock changes, Implement a corresponding time interrupt task at 0 seconds, 0 minutes, 0 hours, January 1, every year.
TIP Using EV_CALE_CFG and EV_RTC_SET is equivalent to setting the Calendar Event configuration in the Event Settings of the DS Settings tool. For more information, refer to the DataSite Software User Manual, publication 1758-UM002.
Publication 1758-RM001C-EN-P - October 2010
Customized Function Blocks for 1758-RTU Controllers 31
EV_CLK_CFG Function
Configure the alarm event parameters.
Use this function block together with the function block EV_RTC_SET to configure an alarm event. EV_RTC_SET is used to enable settings in the CFG function blocks based on the real-time clock.
Statement Instance
Parameter Explanation
EV_CLK_CFGEN
MON
DAY
HOUR
MIN
SEC
44652
EV_CLK_CFG parameter explanation
Input Return Data Type Description Parameter Value
EN — UINT The Enable setting of an alarm event
Bit 7: Enable bit of an Alarm event. TRUE for Enable, and FALSE for Disable. When bit 7 is FALSE, bit 0…bit 4 settings are all invalid.Bit 0: Bit for value of seconds of an Alarm event. 1 for Enable, and 0 for Disable.Bit 1: Bit for value of minutes of an Alarm event. 1 for Enable, and 0 for Disable.Bit 2: Bit for value of hours of an Alarm event. 1 for Enable, and 0 for Disable.Bit 3: Bit for value of day of an Alarm event. 1 for Enable, and 0 for Disable.Bit 4: Bit for value of month of an Alarm event. 1 for Enable, and 0 for Disable.
MON — UINT The Month value of an alarm event.
1…12
DAY — UINT The Day value of an alarm event.
1…31
Publication 1758-RM001C-EN-P - October 2010
32 Customized Function Blocks for 1758-RTU Controllers
HOUR — UINT The Hour value of an alarm event.
0…23
MIN — UINT The Minute value of an alarm event.
0…59
SEC — UINT The Second value of an alarm event.
0…59
EV_CLK_CFG parameter explanation (Continued)
Input Return Data Type Description Parameter Value
TIP Using EV_CLK_CFG and EV_RTC_SET together is equivalent to setting the Alarm Event configuration in the Event Settings of the DS Settings tool. For more information, refer to the DataSite Software User Manual, publication 1758-UM002.
Publication 1758-RM001C-EN-P - October 2010
Customized Function Blocks for 1758-RTU Controllers 33
EV_GET Function
Get the state of system events, RTC events, and second-based events.
Statement Instance
Parameter Explanation
EV_GET parameter explanation
Input Return Data Type Description Parameter Value
— SYS UINT System event Symbol
Bit 0: Power-on reset eventBit 1: Watchdog reset eventBit 2: Check-time event
— RTC UINT RTC event RTC event symbol
Bit 0: Second-based eventBit 1: Time eventBit 2: Calendar eventBit 3: Alarm event
— RTCN UDINT Number of times a second-based event occurs.
—
EV_GETSYS
RTC
RTCN
44796
Publication 1758-RM001C-EN-P - October 2010
34 Customized Function Blocks for 1758-RTU Controllers
EV_RTC_SET Function
Enable real-time clock events. That is, to enable all event configurations.
Use this function block to enable settings in the CFG function blocks based on the real-time clock.
Statement Instance
TIP Using EV_RTC_SET is equivalent to changing the configurations in the Event Settings dialog box of the DS Settings tool. For more information, refer to the DataSite Software User Manual, publication 1758-UM002.
EV_RTC_SET
44653
Publication 1758-RM001C-EN-P - October 2010
Customized Function Blocks for 1758-RTU Controllers 35
EV_SEC_CFG Function
Configure an event that has an interval of 1 s.
Use this function block together with the function block EV_RTC_SET to configure a Time event. EV_RTC_SET is used to enable settings in the CFG function blocks based on the real-time clock.
Statement Instance
Parameter Explanation
EV_SEC_CFG parameter explanation
Input Return Data Type Description Parameter Value
EN — BOOL Second event enable symbol
TRUEFALSE
TIP Using EV_TIME_CFG and EV_RTC_SET is equivalent to setting the Time Event configuration in the Event Settings of the DS Settings tool. For more information, refer to the DataSite Software User Manual, publication 1758-UM002.
EV_SEC_CFG
EN
44649
Publication 1758-RM001C-EN-P - October 2010
36 Customized Function Blocks for 1758-RTU Controllers
EV_TIME_CFG Function
Configure the time event parameters.
Use this function block together with the function block EV_RTC_SET to configure a Time event. EV_RTC_SET is used to enable settings in the CFG function blocks based on the real-time clock.
Statement Instance
Parameter Explanation
EV_TIME_CFG
MODE
EN
44650
EV_TIME_CFG parameter explanation
Input Return Data Type Description Parameter Value
EN — BOOL Time Event Enable symbol
TRUEFALSE
MODE — UINT Time Event Mode • 0: Minute. When the minute of the real-time clock changes, implement a corresponding time interrupt task at second 0, every minute.
• 1: Hour. When the hour of the real-time clock changes, implement a corresponding time interrupt task at 0 seconds, 0 minutes of every hour.
• 2: Midnight. Implement a corresponding time interrupt task at 0 seconds, 0 minutes, 0 hours (midnight) every day.
• 3: Midday. Implement a corresponding time interrupt task at 0 seconds, 0 minutes, 12 hours (noon) every day.
TIP Using EV_TIME_CFG and EV_RTC_SET is equivalent to setting the Time Event configuration in the Event Settings of the DS Settings tool. For more information, refer to the DataSite Software User Manual, publication 1758-UM002.
Publication 1758-RM001C-EN-P - October 2010
Customized Function Blocks for 1758-RTU Controllers 37
HARTB_ADD Function
Add HART scan data blocks.
Statement Instance
Parameter Explanation
HARTB_ADD parameter explanation
Input Return Data Type Description
ID — UINT Channel number:0…2
ADR — UINT HART address0…15
CMD — UINT Command number: 0, 1, 2, 3, 15, 33, 48, 54
44632
HARTB_ADD
ID
ADR
CMD
TIME
CD
DD
UT
ST
NO
Publication 1758-RM001C-EN-P - October 2010
38 Customized Function Blocks for 1758-RTU Controllers
TIME — UINT Bits 7 through 0
Bits 7 through 5 indicate the time unit as follows:
Bit 7 Bit 6 Bit 5 Time units0 0 0 50 ms0 0 1 500 ms0 1 0 5 s0 1 1 50 s1 0 0 5 min1 0 1 50 min1 1 0 5 h1 1 1 50 h
Bits 4 through 0 indicate the time value. Range is 1…9.
CD — UINT Send register
DD — UINT Return register
UT — UINT Unit register
ST — UINT State register
— NO UINT Data block NUM
TIP Function blocks HARTB_CLR, HARTB_ADD, HARTB_AEC, HARTB_EC, and HARTB_EG are used in HART data timing scan. This function is similar to HART Settings in DS Settings. For more information, refer to the DataSite Software User Manual, publication 1758-UM002.
HARTB_ADD parameter explanation (Continued)
Input Return Data Type Description
Publication 1758-RM001C-EN-P - October 2010
Customized Function Blocks for 1758-RTU Controllers 39
HARTB_AEC Function
Clear all the errors of HART scan data blocks.
Statement Instance
TIP Function blocks HARTB_CLR, HARTB_ADD, HARTB_AEC, HARTB_EC, and HARTB_EG are used in HART data timing scan. This function is similar to HART Settings in DS Settings. For more information, refer to the DataSite Software User Manual, publication 1758-UM002.
44633
HARTB_AEC
Publication 1758-RM001C-EN-P - October 2010
40 Customized Function Blocks for 1758-RTU Controllers
HARTB_CLR Function
Clear all the HART scan data blocks.
Statement Instance
TIP Function blocks HARTB_CLR, HARTB_ADD, HARTB_AEC, HARTB_EC, and HARTB_EG are used in HART data timing scan. This function is similar to HART Settings in the DS Settings tool. For more information, refer to the DataSite Software User Manual, 1758-UM002.
44631
HARTB_CLR
Publication 1758-RM001C-EN-P - October 2010
Customized Function Blocks for 1758-RTU Controllers 41
HARTB_EC Function
Clear errors of the HART scan data block corresponding to the NUM.
Statement Instance
Parameter Explanation
HARTB_EC parameter explanation
Input Data Type Description
NUM UINT Scan data block NUM
TIP Function blocks HARTB_CLR, HARTB_ADD, HARTB_AEC, HARTB_EC, and HARTB_EG are used in HART data timing scan. This function is similar to HART Settings in DS Settings. For more information, refer to the DataSite Software User Manual, publication 1758-UM002.
44634
HARTB_EC
NUM
Publication 1758-RM001C-EN-P - October 2010
42 Customized Function Blocks for 1758-RTU Controllers
HARTB_EG Function
Get the error state of certain HART scan data block.
Statement Instance
Parameter Explanation
If you encounter the communication error, check the connection between the HART port and the HART instrument, and the settings for the HART scan block.
HARTB_EG parameter explanation
Input Return Data Type Description
NUM — UINT Scan data block NUM
— ERR UINT 0: Normal1: Communication error
— CON UINT Count of scan block communication errors.
TIP Function blocks HARTB_CLR, HARTB_ADD, HARTB_AEC, HARTB_EC, and HARTB_EG are used in HART data timing scan. This function is similar to HART Settings in DS Settings. For more information, refer to the DataSite Software User Manual, publication 1758-UM002.
44635
HARTB_EG
NUM
ERR
CON
Publication 1758-RM001C-EN-P - October 2010
Customized Function Blocks for 1758-RTU Controllers 43
HARTT_CFG Function
Configure the triggering of the HART Scan function via the HART channel.
Statement Instance
Parameter Explanation
HARTB_ADD parameter explanation
Input Return Data Type Description Parameter Value
EN — BOOL Enable or disable 0: Disable1: Enable
ID — BYTE HART channel number 0…2
ADR — BYTE HART instrument address 1…247
CMD — BYTE Command numbers 0, 1, 2, 3, 15, 33, 35, 38, 40, 44, 48, 54, 59
CD — UINT Send register —
DD — UINT Return register —
UT — UINT Unit register —
ST — UINT State register —
45588
HARTT_CFG
ID
ADR
CMD
CD
DD
UT
ST
EN
Publication 1758-RM001C-EN-P - October 2010
44 Customized Function Blocks for 1758-RTU Controllers
HARTT_ST Function
Get the status of the HART trigger block.
Statement Instance
Parameter Explanation
HARTT_ST parameter explanation
Input Return Data Type
Description Parameter Value
ID — BYTE HART channel number 0…2
— STAT BYTE status of the HARTT_CFG function block return value
0: HARTT_CFG configuration ok1: HARTT_CFG trigger on(in progress)2: HARTT_CFG trigger OK (completed)3: HARTT_CFG configuration error255: HARTT_CFG trigger error
45589
HARTT_ST
ID STAT
Publication 1758-RM001C-EN-P - October 2010
Customized Function Blocks for 1758-RTU Controllers 45
PW_SHDN Function
Shut down the controller, and enable or disable the RTC alarm wake-up mode.
Statement Instance
Parameter Explanation
PW_SHDN parameter explanation
Input Return Data Type Description Parameter Value
RTC — UINT RTC Alarm Wake-Up Mode Enable/Disable symbol
0: Shut down, and disable RTC alarm wake-up mode
1: Shut down, and enable RTC alarm wake-up mode
HOUR — UINT Hour 0…23
MINU — UINT Minute 0…59
SEC — UINT Second 0…59
PW_SHDN
RTC
HOUR
MINU
SEC44639
Publication 1758-RM001C-EN-P - October 2010
46 Customized Function Blocks for 1758-RTU Controllers
REG_MOVE Function
Copy the register data block.
Statement Instance
Parameter Explanation
REG_MOVE parameter explanation
Input Return Data Type Description Parameter Value
T — UINT Master register address —
R — UINT Slave register address —
NUM — UINT Register number —
SWAP — BOOL The swap sign of float high-low bits
0: low bits in front1: high bits in front
REG_MOVE
NUM
SWAP
R
T
44665
Publication 1758-RM001C-EN-P - October 2010
Customized Function Blocks for 1758-RTU Controllers 47
REG_R_REAL Function
Read floating point numbers from the register.
Statement Instance
Parameter Explanation
REG_R_REAL parameter explanation
Input Return Data Type Description Parameter Value
ADR — UINT Register address —
SWAP — BOOL Swap sign of floating high-low bits
0: low bits in front1: high bits in front
— OUT REAL Numerical value —
REG_R_REAL
SWAPOUT
ADR
44661
Publication 1758-RM001C-EN-P - October 2010
48 Customized Function Blocks for 1758-RTU Controllers
REG_R_STR Function
Read string value from the register.
Statement Instance
Parameter Explanation
REG_R_STR parameter explanation
Input Return Data Type Description Parameter Value
ADR — UINT Register address 40003 to 49999
LEN — UINT String lenth 1…254
SWAP — BOOL Swap sign of floating high-low bits
0: low bits in front1: high bits in front
— BUF STRING String buffer address —
REG_R_STR
LEN
SWAP
BUF
ADR
45590
Publication 1758-RM001C-EN-P - October 2010
Customized Function Blocks for 1758-RTU Controllers 49
REG_R_UDINT Function
Read unsigned long integer from the register.
Statement Instance
Parameter Explanation
REG_R_UDINT parameter explanation
Input Return Data Type Description Parameter Value
ADR — UINT Register address —
SWAP — BOOL The swap sign of long integer high-low bits
0: low bits in front1: high bits in front
— OUT UDINT Numerical value —
REG_R_UDINT
SWAPOUT
ADR
44663
Publication 1758-RM001C-EN-P - October 2010
50 Customized Function Blocks for 1758-RTU Controllers
REG_R_UINT Function
Read unsigned integer from the register.
Statement Instance
Parameter Explanation
REG_R_UINT
Input Return Data Type Description Parameter Value
ADR — UINT Register address —
— OUT UINT Numerical value —
REG_R_UINT
ADR OUT
44659
Publication 1758-RM001C-EN-P - October 2010
Customized Function Blocks for 1758-RTU Controllers 51
REG_W_REAL Function
Write floating point numbers to the register.
Statement Instance
Parameter Explanation
REG_W_REAL parameter explanation
Input Return Data Type Description Parameter Value
ADR — UINT Register address —
SWAP — BOOL The swap sign of float high-low bits
0: low bits in front1: high bits in front
VAL — REAL Numerical value —
REG_W_REAL
VAL
SWAP
ADR
44662
Publication 1758-RM001C-EN-P - October 2010
52 Customized Function Blocks for 1758-RTU Controllers
REG_W_STR Function
Write string value into the register.
Statement Instance
Parameter Explanation
REG_R_STR parameter explanation
Input Return Data Type Description Parameter Value
ADR — UINT Register address 40003 to 49999
BUF — STRING String buffer address —
LEN — UINT String lenth 1…254
SWAP — BOOL Swap sign of floating high-low bits
0: low bits in front1: high bits in front
REG_W_STR
LEN
SWAP
BUF
ADR
45591
Publication 1758-RM001C-EN-P - October 2010
Customized Function Blocks for 1758-RTU Controllers 53
REG_W_UDINT Function
Write unsigned long integer to the register.
Statement Instance
Parameter Explanation
REG_W_UDINT parameter explanation
Input Return Data Type Description Parameter Value
ADR — UINT Register address —
SWAP — BOOL The swap sign of long integer high-low bits
0: low bits in front1: high bits in front
VAL — UDINT Numerical value —
REG_W_UDINT
VAL
SWAP
ADR
44664
Publication 1758-RM001C-EN-P - October 2010
54 Customized Function Blocks for 1758-RTU Controllers
REG_W_UINT Function
Write unsigned integer to the register.
Statement Instance
Parameter Explanation
REG_W_UINT
Input Return Data Type Description Parameter Value
ADR — UINT Register address —
VAL — UINT Numerical value —
REG_W_UINT
VAL
ADR
44660
Publication 1758-RM001C-EN-P - October 2010
Customized Function Blocks for 1758-RTU Controllers 55
SWAP_DWORD Function
Byte manipulation operations. High byte and low byte exchange positions in a word.
Statement Instance
Parameter Explanation
SWAP_DWORD parameter explanation
Input Return Data Type Description Parameter Value
IN — DWORD Previous value —
— OUT DWORD New value —
SWAP_DWORD
IN OUT
44959
Publication 1758-RM001C-EN-P - October 2010
56 Customized Function Blocks for 1758-RTU Controllers
SWAP_WORD Function
Byte manipulation operations. High byte and low byte exchange positions in a word.
Statement Instance
Parameter Explanation
SWAP_WORD parameter explanation
Input Return Data Type Description Parameter Value
IN — WORD Previous value —
— OUT WORD New value —
SWAP_WORD
IN OUT
44960
Publication 1758-RM001C-EN-P - October 2010
Customized Function Blocks for 1758-RTU Controllers 57
SYS_AD_GET Function
Read out the integer value and engineering value of the system’s analog/digital (A/D) conversion.
Statement Instance
Parameter Explanation
SYS_AD_GET parameter explanation
Input Return Data Type Description Parameter Value
CHL — UINT Channel number of system A/D
0: reserved1: reserved2: channel 2 of system A/D for controller temperature3: channel 3 of system A/D for battery voltage
— AD_N UINT Integer value of this A/D channel
0…1024
— AD_F REAL Engineering value of this A/D channel
-40…125 °C for controller temperature0…3.60 for battery voltage
TIP The function block SYS_AD_GET retrieves the same A/D data as that shown in the Debug dialog box in Controller Debug of the DS Settings tool. An example is shown here.
For more information, refer to the DataSite Software User Manual, publication 1758-UM002.
SYS_AD_GET
CHL
AD_N
AD_F
44666
Publication 1758-RM001C-EN-P - October 2010
58 Customized Function Blocks for 1758-RTU Controllers
SYS_ERR_GET Function
Get system errors.
Statement Instance
Parameter Explanation
For example, ERR=3=0x0001 + 0x0002, means the system errors are hardware registering error and FLASH error.
SYS_ERR_GET
ERR
44667
SYS_ERR_GET parameter explanation
Input Return Data Type Description Parameter Value Possible Solution
— ERR UINT The value of all errors (summed)
0x0001:/*hardware registering error*/ Contact a Rockwell technical support representative.
0x0002:/*FLASH error*/
0x0100:/*HART error*/ Check the connection between the HART port and the HART instrument. In addition, verify the settings for the HART scan block.
0x0200:/*US1error*/ Check the connection between the COM1 port and the slave device. In addition, verify the settings for the scan block.
0x0400:/*US2 error*/ Check the connection between the COM2 port and the slave device. In addition, verify the settings for the scan block.
TIP The function block SYS_ERR_GET executes the same function as Error Record function in the Debug dialog box in Controller Debug of the DS Settings tool. The Error Record box is shown here.
For more information, refer to the DataSite Software User Manual, publication 1758-UM002.
Publication 1758-RM001C-EN-P - October 2010
Customized Function Blocks for 1758-RTU Controllers 59
SYS_ERR_RST Function
Clear all system errors.
Statement Instance
TIP The function block SYS_ERR_RST executes the same function as the Clear Error function in the Debug dialog box in Controller Debug of the DS Settings tool. For more information, refer to the DataSite Software User Manual, publication 1758-UM002.
SYS_ERR_RST
44668
Publication 1758-RM001C-EN-P - October 2010
60 Customized Function Blocks for 1758-RTU Controllers
Publication 1758-RM001C-EN-P - October 2010
Chapter 2
Customized Function Blocks for 1758-FLO Controllers
This chapter provides information on the customized function blocks you can use in DataSite Workbench for programming the 1758-FLO DataSite controllers.
B_AERR_CLR Function
Clear all the scan setting errors.
Statement Instance
TIP The function block B_AERR_CLR executes the same function as the Clear Error function in the Scan Settings of the DS Settings tool. For more information, refer to the DataSite Software User Manual, publication 1758-UM002.
B_AERR_CLR
44642
61 Publication 1758-RM001C-EN-P - October 2010
62 Customized Function Blocks for 1758-FLO Controllers
B_ERR_CLR Function
Clear the corresponding scan block configuration error.
Statement Instance
Parameter Explanation
B_ERR_CLR parameter explanation
Input Return Data Type Description Parameter Value
NUM — UINT Scan data block number —
B_ERR_CLR
NUM
44643
Publication 1758-RM001C-EN-P - October 2010
Customized Function Blocks for 1758-FLO Controllers 63
B_ERR_GET Function
Get the corresponding scan block configuration error.
Statement Instance
Parameter Explanation
If you encounter a communication error, check the connection between the port and the instrument, and the parameter settings of the scan block.
B_ERR_GET parameter explanation
Input Return Data Type Description Parameter Value
NUM — UINT Scan data block number —
— ERR UINT Error of scan block 0: Normal1: Communication error
— CON UINT Count of scan block communication errors.
Error count
B_ERR_GET
NUM
ERR
CON
44644
Publication 1758-RM001C-EN-P - October 2010
64 Customized Function Blocks for 1758-FLO Controllers
BIT_EXPAND Function
Bit manipulation operations. One word is expanded to 16 bits.
Statement Instance
Parameter Explanation
BIT_EXPAND parameter explanation
Input Return Data Type Description Parameter Value
IN — WORD Input value —
— B00 BOOL Bit value 0 or 1
— B01 BOOL Bit value 0 or 1
— B02 BOOL Bit value 0 or 1
— B03 BOOL Bit value 0 or 1
— B04 BOOL Bit value 0 or 1
— B05 BOOL Bit value 0 or 1
— B06 BOOL Bit value 0 or 1
— B07 BOOL Bit value 0 or 1
— B08 BOOL Bit value 0 or 1
— B09 BOOL Bit value 0 or 1
— B10 BOOL Bit value 0 or 1
BIT_EXPANDB00
B01
B02
B03
B04
B05
B06
B07
B08
B09
B10
B11
B12
B13
B14
B15
IN
44955
Publication 1758-RM001C-EN-P - October 2010
Customized Function Blocks for 1758-FLO Controllers 65
— B11 BOOL Bit value 0 or 1
— B12 BOOL Bit value 0 or 1
— B13 BOOL Bit value 0 or 1
— B14 BOOL Bit value 0 or 1
— B15 BOOL Bit value 0 or 1
BIT_EXPAND parameter explanation (Continued)
Input Return Data Type Description Parameter Value
Publication 1758-RM001C-EN-P - October 2010
66 Customized Function Blocks for 1758-FLO Controllers
BIT_MERGE Function
Bit manipulation operations. 16 bits are merged into one word.
Statement Instance
Parameter Explanation
BIT_MERGE parameter explanation
Input Return Data Type Description Parameter Value
B00 — BOOL Bit value 0 or 1
B01 — BOOL Bit value 0 or 1
B02 — BOOL Bit value 0 or 1
B03 — BOOL Bit value 0 or 1
B04 — BOOL Bit value 0 or 1
B05 — BOOL Bit value 0 or 1
B06 — BOOL Bit value 0 or 1
B07 — BOOL Bit value 0 or 1
B08 — BOOL Bit value 0 or 1
B09 — BOOL Bit value 0 or 1
B10 — BOOL Bit value 0 or 1
B11 — BOOL Bit value 0 or 1
BIT_MERGEB00
B01
B02
B03
B04
B05
B06
B07
B08
B09
B10
B11
B12
B13
B14
B15
VAL
44956
Publication 1758-RM001C-EN-P - October 2010
Customized Function Blocks for 1758-FLO Controllers 67
B12 — BOOL Bit value 0 or 1
B13 — BOOL Bit value 0 or 1
B14 — BOOL Bit value 0 or 1
B15 — BOOL Bit value 0 or 1
— VAL WORD Output value —
BIT_MERGE parameter explanation (Continued)
Input Return Data Type Description Parameter Value
Publication 1758-RM001C-EN-P - October 2010
68 Customized Function Blocks for 1758-FLO Controllers
BLOCK_ADD Function
Add scan block.
Statement Instance
Parameter Explanation
BLOCK_ADD parameter explanation
Input Return Data Type Description Parameter Value
PORT — UINT Select COM port 1: COM12: COM2
ADR — UINT Module address 0…247
SIG — UINT Signal type 1: Read coil register2: Read state register3: Read hold register4: Read input register5: Write 1Coil Register6: Write 1Hold Register15: Write multi-coil register16: Write multi-hold register
BLOCK_ADDPORT
ADR
SIG
TIME
M
S
NUM
B_NO
44646
Publication 1758-RM001C-EN-P - October 2010
Customized Function Blocks for 1758-FLO Controllers 69
TIME — UINT Scan time Bits 7 through 0
Bits 7 through 5 indicate the time unit as follows:
Bit 7 Bit 6 Bit 5 Time units0 0 0 50 ms0 0 1 500 ms0 1 0 5 s0 1 1 50 s1 0 0 5 min1 0 1 50 min1 1 0 5 h1 1 1 50 h
Bits 4 through 0 indicate the time value. Range is 1…9.
M — UINT Master address —
S — UINT Slave address —
NUM — UINT Number of registers
—
— B_NO UINT Data block number —
TIP The function block BLOCK_ADD executes the same function as the Edit function in the Scan Settings of the DS Settings tool. For more information, refer to the DataSite Software User Manual, publication 1758-UM002.
BLOCK_ADD parameter explanation (Continued)
Input Return Data Type Description Parameter Value
Publication 1758-RM001C-EN-P - October 2010
70 Customized Function Blocks for 1758-FLO Controllers
BLOCK_CLR Function
Clear all scan block configuration.
Statement Instance
BLOCK_CLR
44645
Publication 1758-RM001C-EN-P - October 2010
Customized Function Blocks for 1758-FLO Controllers 71
COM_MSG Function
Trigger a scan via the COM port.
Statement Instance
Parameter Explanation
COM_MSGEN
PORT
ADR
SIG
M
S
NUM44957
COM_MSG parameter explanation
Input Return Data Type Description Parameter Value
EN — BOOL Enable or disable 0: Disable1: Enable
PORT — BYTE Select the COM port 1: COM12: COM2
ADR — BYTE Address for slave station 1…247
SIG — BYTE Modbus command 1: Read coil register2: Read state register3: Read hold register4: Read input register5: Write 1Coil Register6: Write 1Hold Register15: Write multi-coil register16: Write multi-hold register
M — UINT Address for master —
S — UINT Address for slave —
NUM — UINT Total numbers for exchange 1…120
Publication 1758-RM001C-EN-P - October 2010
72 Customized Function Blocks for 1758-FLO Controllers
COM_MSG_STATUS Function
Get status of the COM0 or COM1 message block.
Statement Instance
Parameter Explanation
If you encounter a communication error, check the connection between the COM port and the DataSite controller or an equivalent device, and the settings for the COM_MSG function block.
COM_MSG_STATUS parameter explanation
Input Return Data Type Description Parameter Value
TYPE — BYTE COM port number 1: COM12: COM2
— STAT BYTE Status of the COM_MSG function block return value
0: COM_MSG configuration OK1: COM_MSG trigger on (in progress)2: COM_MSG trigger OK (completed)3: COM_MSG configuration error255: COM_MSG trigger error
COM_MSG_STATUS
TYPE STAT
44958
Publication 1758-RM001C-EN-P - October 2010
Customized Function Blocks for 1758-FLO Controllers 73
COM_US_CFG Function
Configure the serial port (COM1 and COM2) parameter.
Statement Instance
Parameter Explanation
USART_CFG Data typeSTRUCT
STATION UINT 1…247, Slave device Module AddressPROTOCOL UINT 1: MODBUS RTU protocol,
2: MODBUS ASCII protocolSTATE UINT 0: Slave,
1: MasterDUPLEX UINT 0: Full-duplex,
1: Half-duplexBAUD UDINT 2400,4800,9600,14400,19200,38400,
56000,57600,115200, Baud RatePARITY UINT 0: EVEN,
1: ODD,4: NONE
DATA_BITS UINT 2: 7 data bits,3: 8 data bits
STOP_BITS UINT 0: 1 stop bit2: 2 stop bits
PORT_TYPE UINT 0: RS2321: RS485
TIMEOUT UINT 1…1000, in 10ms unitsTIMEDELAY UINT 1…300, in 10ms units
END_STRUCT
COM_US_CFG parameter explanation
Input Return Data Type Description Parameter Value
ID — BYTE Input value 1: COM12: COM2
SET — USART_CFG Serial port parameter
COM_US_CFG
ID
SET45586
Publication 1758-RM001C-EN-P - October 2010
74 Customized Function Blocks for 1758-FLO Controllers
COM_US_SET Function
Activate the parameter for serial port (COM1 and COM2).
Statement Instance
Parameter Explanation
COM_US_CFG parameter explanation
Input Return Data Type Description Parameter Value
ID — BYTE The serial port to be activated
1: COM12: COM2
COM_US_SET
ID45587
Publication 1758-RM001C-EN-P - October 2010
Customized Function Blocks for 1758-FLO Controllers 75
CAL_LINE_N Function
Perform a linear calculation to transform the engineering value X to the standard value N.
Engineering algorithm N=(X-X0)*(N1-N0)/(X1-X0)+N0
where
N1: maximum standard valueN0: minimum standard valueX1: maximum engineering valueX0: minimum engineering value
Statement Instance
Parameter Explanation
CAL_LINE_N parameter explanation
Input Return Data Type Description
X — REAL Engineering value
X1 — REAL Maximum engineering value
X0 — REAL Minimum engineering value
N1 — UINT Maximum standard value
N0 — UINT Minimum standard value
— N UINT Standard value
CAL_LINE_NX
X1
X0
N1
N0
N
44641
Publication 1758-RM001C-EN-P - October 2010
76 Customized Function Blocks for 1758-FLO Controllers
CAL_LINE_X Function
Perform a linear calculation to transform the standard value N to the engineering value X.
Engineering Algorithm: X=(X1-X0)*(N-N0)/(N1-N0)+X0
where
N1: the maximum standard valueN0: the minimum standard valueX1: the maximum engineering valueX0: the minimum engineering value
Statement Instance
Parameter Explanation
CAL_LINE_X parameter explanation
Input Return Data Type Description
N — UINT Standard value
N1 — UINT Maximum standard value
N0 — UINT Minimum standard value
X1 — REAL Maximum engineering value
X0 — REAL Minimum engineering value
— X REAL Engineering value
CAL_LINE_XN
N1
N0
X1
X0
X
44640
Publication 1758-RM001C-EN-P - October 2010
Customized Function Blocks for 1758-FLO Controllers 77
CLOCK_GET Function
Get the controller time.
Statement Instance
Parameter Explanation
CLOCK_GET parameter explanation
Input Return Data Type Description Parameter Value
— HOUR UINT Hour 00…23
— MINU UINT Minute 00…59
— SEC UINT Second 00…59
— YEAR UINT Year 00…99
— MON UINT Month 01…12
— DAY UINT Day 01…31
— WEEK UINT Week 01…07
CLOCK_GETHOUR
MINU
SEC
YEAR
MON
DAY
WEEK
44647
Publication 1758-RM001C-EN-P - October 2010
78 Customized Function Blocks for 1758-FLO Controllers
CLOCK_SET Function
Set the controller clock.
Statement Instance
Parameter Explanation
CLOCK_SET parameter explanation
Input Return Data Type Description Parameter Value
SET — UINT Enable setting, 1 1: Enable0: Disable
HOUR — UINT Hour 00…23
MINU — UINT Minute 00…59
SEC — UINT Second 00…59
YEAR — UINT Year 00…99
MON — UINT Month 01…12
DAY — UINT Day 01…31
WEEK — UINT Week 01…07
CLOCK_SET
HOUR
SET
MINU
SEC
YEAR
MON
DAY
WEEK
44648
Publication 1758-RM001C-EN-P - October 2010
Customized Function Blocks for 1758-FLO Controllers 79
EN_LED Function
Enable the LED power supply.
Statement Instance
Parameter Explanation
EN_LED parameter explanation
Input Return Data Type Description Description
EN None BOOL LED power supply enable indication
0: Disable LED power supply1: Enable LED power supply
TIP This function is similar to the Power Enable settings in the Controller Communication Settings dialog box of the DS Settings tool. For more information, refer to the DataSite Software User Manual, publication 1758-UM002.
EN_LED
EN
44638
Publication 1758-RM001C-EN-P - October 2010
80 Customized Function Blocks for 1758-FLO Controllers
EN_NET Function
Enable the Ethernet power supply.
Statement Instance
Parameter Explanation
EN_NET parameter explanation
Input Return Data Type Description Parameter Value
EN None BOOL Ethernet power supply enable indication
0: Disable Ethernet power supply1: Enable Ethernet power supply
TIP This function is similar to the Power Enable settings in the Controller Communication Settings dialog box of the DS Settings tool. For more information, refer to the DataSite Software User Manual, publication 1758-UM002.
EN_NET
EN
44637
Publication 1758-RM001C-EN-P - October 2010
Customized Function Blocks for 1758-FLO Controllers 81
EN_RS485 Function
Enable the RS485 power supply.
Statement Instance
Parameter Explanation
EN_RS485 parameter explanation
Input Return Data Type Description Parameter Value
EN None BOOL RS485 power supply enable indication
0: Disable RS485 power supply1: Enable RS485 power supply
TIP This function is similar to the Power Enable settings in the Controller Communication Settings dialog box in the DS Settings tool. For more information, refer to the DataSite Software User Manual, publication 1758-UM002.
EN_RS485
EN
44636
Publication 1758-RM001C-EN-P - October 2010
82 Customized Function Blocks for 1758-FLO Controllers
ENRON_CFG Function
Configure Enron Modbus communication on serial port.
Statement Instance
Parameter Explanation
EN_RS485 parameter explanation
Input Return Data Type Description Parameter Value
ID None UINT Serial port number 1: COM12: COM2
EN None BOOL Enable or Disable Enron Modbus communication
0: Disable Enron Modbus communication1: Enable Enron Modbus communication
STAT None UINT Enron Modbus station address
1…247
45572
ENRON_CFGID
EN
STAT
Publication 1758-RM001C-EN-P - October 2010
Customized Function Blocks for 1758-FLO Controllers 83
GET_3_PARA Function
Get the process input parameters of the orifice plate (AGA3).
Statement Instance
Parameter Explanation
The structure of the process input parameters of the orifice plate (AGA3) is as follows:
AGA3_PARASTRUCT fAGA_Pb : REAL; contract base pressure fAGA_Tb : REAL; contract base temperature fDp_Cutoff : REAL; low flow cut-off differential pressure usPressType : UINT; pressure sensor type, 0-Gauge, 1-Absolute fBarometric : REAL; barometric Pressure usTapLocation : UINT; tap location, 0-upstream, 1-downstream usOrifice_Type : UINT; orifice plate material, 0-Stainless Steel, 1-Carbon Steel, 2-Monel fdr_Orifice : REAL; orifice diameter in reference temperature fTr_Dr_Orifice : REAL; reference temperature of orifice plate diameter usPipe_type : UINT; pipe tube material, 0-Stainless Steel, 1-Carbon Steel, 2-Monel fDr_Pipe : REAL; pipe Tube diameter in reference temperature fTr_Dr_Pipe : REAL; reference temperature of pipe tube diameter usRD_type : UINT; relative density condition type fRD : REAL; relative density fRD_Ref_P : REAL; reference pressure for relative density fRD_Ref_T : REAL; reference temperature for relative density usUnit : UINT; unit usZ_Mode : UINT; AGA8 methodEND_STRUCT
GET_3_PARA parameter explanation
Input Return Data Type Description Parameter Value
N — UINT Meter number 0…7
— AGA3 AGA3_PARA Structure of process parameter
—
AGA3
GET_3_PARA
N
44669
Publication 1758-RM001C-EN-P - October 2010
84 Customized Function Blocks for 1758-FLO Controllers
This data structure is formed automatically after this function block in the WorkBench data dictionary is selected.
Publication 1758-RM001C-EN-P - October 2010
Customized Function Blocks for 1758-FLO Controllers 85
GET_7_PARA Function
Get the process input parameters of the turbine (AGA7).
Statement Instance
Parameter Explanation
The structure of the process input parameters of the turbine (AGA7) is as follows:
AGA7_PARASTRUCT fAGA_Pb : REAL; contract base pressure fAGA_Tb : REAL; contract base temperature usPressType : UINT; pressure sensor type, 0-Gauge, 1-Absolute fBarometric : REAL; barometric pressure usRD_type : UINT; relative density condition type fRD : REAL; relative density fRD_Ref_P : REAL; reference pressure for relative density fRD_Ref_T : REAL; reference temperature for relative density usUnit: UINT; unit usZ_mode : UINT; AGA8 methodEND_STRUCT
This data structure is formed automatically after this function block in the WorkBench data dictionary is selected.
GET_7_PARA parameter explanation
Input Return Data Type Description Parameter Value
N — UINT Meter number 0…7
— AGA7 AGA7_PARA Structure of process parameter
—
AGA7
GET_7_PARA
N
44670
Publication 1758-RM001C-EN-P - October 2010
86 Customized Function Blocks for 1758-FLO Controllers
GET_C_ALL Function
Get the total accumulated quantity.
Statement Instance
Parameter Explanation
The structure of total accumulated quantity is as follows:
CUMU_ALLSTRUCT QM_ALL : UDINT; total mass flow QNV_ALL : UDINT; total volume flow in base conditions QNF_ALL : UDINT; total volume flow in flowing conditionsEND_STRUCT
This data structure is formed automatically after this function block in the WorkBench data dictionary is selected.
GET_C_ALL parameter explanation
Input Return Data Type Description Parameter Value
N — UINT Meter number 0…7
— ALL CUMU_ALL Structure of accumulated variables
—
ALL
GET_C_ALL
N
44671
Publication 1758-RM001C-EN-P - October 2010
Customized Function Blocks for 1758-FLO Controllers 87
GET_C_TIME Function
Get the accumulated flow time.
Statement Instance
Parameter Explanation
The structure of the accumulated flow time is as follows:
CUMU_TIMESTRUCT CNT_HOUR : UDINT; flow time of this hour CNT_LHOUR : UDINT; flow time of last hour CNT_DAY : UDINT; flow time of current day CNT_YDAY : UDINT; flow time of previous dayEND_STRUCT
This data structure is formed automatically after this function block in the WorkBench data dictionary is selected.
GET_C_TIME parameter explanation
Input Return Data Type Description Parameter Value
N — UINT Meter number 0…7
— TIME CUMU_TIME Structure of accumulated flow time
—
TIME
GET_C_TIME
N
44672
Publication 1758-RM001C-EN-P - October 2010
88 Customized Function Blocks for 1758-FLO Controllers
GET_C_TODAY Function
Get the accumulated quantity for the current day.
Statement Instance
Parameter Explanation
The structure of the current day’s accumulated quantity is as follows:
CUMU_TODAYSTRUCT QM_TODAY : REAL; mass flow accumulated quantity of today QVN_TODAY : REAL; volume flow accumulated quantity of today in base conditions QVF_TODAY : REAL; volume flow accumulated quantity of today in flowing conditionsEND_STRUCT
This data structure is formed automatically after this function block in the WorkBench data dictionary is selected.
GET_C_TODAY parameter explanation
Input Return Data Type Description Parameter Value
N — UINT Meter number 0…7
— Qtd CUMU_TODAY Structure of today’s accumulated quantity
—
Qtd
GET_C_TODAY
N
44673
Publication 1758-RM001C-EN-P - October 2010
Customized Function Blocks for 1758-FLO Controllers 89
GET_C_YESTERDAY Function
Get the accumulated quantity for the previous day.
Statement Instance
Parameter Explanation
The structure of the previous day’s accumulated quantity is as follows:
CUMU_YESTERDAYSTRUCT QM_YESTERDAY : REAL; mass flow accumulated quantity of yesterday QVN_YESTERDAY : REAL; volume flow accumulated quantity of yesterday in base conditions QVF_YESTERDAY : REAL; volume flow accumulated quantity of yesterday in flowing conditionsEND_STRUCT
This data structure is formed automatically after this function block in the WorkBench data dictionary is selected.
GET_C_YESTERDAY parameter explanation
Input Return Data Type Description Parameter Value
N — UINT Meter number 0…7
— Qyt CUMU_YESTERDAY
Structure of yesterday’s accumulated quantity
—
Qtd
GET_C_YESTERDAY
N
44674
Publication 1758-RM001C-EN-P - October 2010
90 Customized Function Blocks for 1758-FLO Controllers
GET_ENG_VAL Function
Get the engineering value of differential pressure(AGA3)/pulse count per second(AGA7), pressure and temperature.
Statement Instance
Parameter Explanation
The structure of the engineering value of field signals is as follows:
ENG_VALSTRUCT DP_IN : REAL; engineering value of differential pressure(AGA3)/ pulse count per second(AGA7) P_IN : REAL; pressure T_IN : REAL; temperatureEND_STRUCT
This data structure is formed automatically after this function block in the WorkBench data dictionary is selected.
GET_ENG_VAL parameter explanation
Input Return Data Type Description Parameter Value
N — UINT Meter number 0…7
— ENG ENG_VAL Engineering value of field signals
—
ENG
GET_ENG_VAL
N
44675
Publication 1758-RM001C-EN-P - October 2010
Customized Function Blocks for 1758-FLO Controllers 91
GET_FLOW Function
Get the flow rates.
Statement Instance
Parameter Explanation
The structure of flow rates is as follows:
FLOW_INSTANSTRUCT QMH : REAL; mass flow rate per hour QVNH : REAL; volume flow rate per hour in base condition QVFH : REAL; volume flow rate per hour in flowing conditionEND_STRUCT
This data structure is formed automatically after this function block in the WorkBench data dictionary is selected.
GET_FLOW parameter explanation
Input Return Data Type Description Parameter Value
N — UINT Meter number 0…7
— RATE FLOW_INSTAN Structure of flow rates —
RATE
GET_FLOW
N
44676
Publication 1758-RM001C-EN-P - October 2010
92 Customized Function Blocks for 1758-FLO Controllers
GET_GX Function
Get the gas composition in decimal fractions.
Statement Instance
Parameter Explanation
The structure of natural gas composition in decimal fraction is as follows:
GAS_COMPSTRUCT X_CH4 : REAL; Methane X_N2 : REAL; Nitrogen X_CO2 : REAL; Carbon Dioxide X_C2H6 : REAL; Ethane X_C3H8 : REAL; Propane X_H2O : REAL; Water X_H2S : REAL; Hydrogen Sulfide X_H2 : REAL; Hydrogen X_CO : REAL; Carbon Monoxide X_O2 : REAL; Oxygen X_IC4H10 : REAL; i-Butane X_NC4H10 : REAL; n-Butane X_IC5H12 : REAL; i-Pentane X_NC5H12 : REAL; i-Pentane X_NC6H14 : REAL; n-Hexane X_NC7H16 : REAL; n-Heptane X_NC8H18 : REAL; n-Octane X_NC9H20 : REAL; n-Nonane X_NC10H22 : REAL; n-Decane X_HE : REAL; Helium X_AR : REAL; ArgonEND_STRUCT
GET_GX parameter explanation
Input Return Data Type Description Parameter Value
N — UINT Meter number 0…7
— COMP GAS_COMP Structure of natural gas composition
—
COMP
GET_GX
N
44677
Publication 1758-RM001C-EN-P - October 2010
Customized Function Blocks for 1758-FLO Controllers 93
This data structure is formed automatically after this function block in the WorkBench data dictionary is selected.
Publication 1758-RM001C-EN-P - October 2010
94 Customized Function Blocks for 1758-FLO Controllers
GET_MR Function
Get the sensor range.
Statement Instance
Parameter Explanation
The structure of sensor range parameters is as follows:
Get the engineering values of differential pressure (AGA3)/pulse count per second (AGA7), pressure and temperature.
MEASURE_RANGESTRUCT DP_BASE : REAL; the b value of differential pressure(AGA3), for turbine (AGA7), b=0 DP_K : REAL; the k value of differential pressure (AGA3), for turbine (AGA7), k is the k factor of turbine P_BASE : REAL; the b value of pressure P_K : REAL; the k value of pressure T_BASE : REAL; the b value of temperature T_K : REAL; the k value of temperatureEND_STRUCT
This data structure is formed automatically after this function block in the WorkBench data dictionary is selected.
GET_MR parameter explanation
Input Return Data Type Description Parameter Value
N — UINT Meter number 0…7
— MR MEASURE_RANGE
Structure of sensor range parameters
—
MR
GET_MR
N
44678
Publication 1758-RM001C-EN-P - October 2010
Customized Function Blocks for 1758-FLO Controllers 95
HARTB_ADD Function
Add HART scan data blocks.
Statement Instance
Parameter Explanation
HARTB_ADD parameter explanation
Input Return Data Type Description
ID — UINT Channel number0…2
ADR — UINT HART address:0…15
CMD — UINT Command number: 0, 1, 2, 3, 15, 33, 48, 54
44632
HARTB_ADD
ID
ADR
CMD
TIME
CD
DD
UT
ST
NO
Publication 1758-RM001C-EN-P - October 2010
96 Customized Function Blocks for 1758-FLO Controllers
TIME — UINT Bits 7 through 0
Bits 7 through 5 indicate the time unit as follows:
Bit 7 Bit 6 Bit 5 Time units0 0 0 50 ms0 0 1 500 ms0 1 0 5 s0 1 1 50 s1 0 0 5 min1 0 1 50 min1 1 0 5 h1 1 1 50 h
Bits 4 through 0 indicate the time value. Range is 1…9.
CD — UINT Send register
DD — UINT Return register
UT — UINT Unit register
ST — UINT State register
— NO UINT Data block NUM
TIP Function blocks HARTB_CLR, HARTB_ADD, HARTB_AEC, HARTB_EC, and HARTB_EG are used in HART data timing scan. This function is similar to HART Settings in DS Settings. For more information, refer to the DataSite Software User Manual, publication 1758-UM002.
HARTB_ADD parameter explanation (Continued)
Input Return Data Type Description
Publication 1758-RM001C-EN-P - October 2010
Customized Function Blocks for 1758-FLO Controllers 97
HARTB_AEC Function
Clear all the errors of HART scan data blocks.
Statement Instance
TIP Function blocks HARTB_CLR, HARTB_ADD, HARTB_AEC, HARTB_EC, and HARTB_EG are used in HART data timing scan. This function is similar to HART Settings in DS Settings. For more information, refer to the DataSite Software User Manual, publication 1758-UM002.
44633
HARTB_AEC
Publication 1758-RM001C-EN-P - October 2010
98 Customized Function Blocks for 1758-FLO Controllers
HARTB_CLR Function
Clear all the HART scan data blocks.
Statement Instance
TIP Function blocks HARTB_CLR, HARTB_ADD, HARTB_AEC, HARTB_EC, and HARTB_EG are used in HART data timing scan. This function is similar to HART Settings in the DS Settings tool. For more information, refer to the DataSite Software User Manual, 1758-UM002.
44631
HARTB_CLR
Publication 1758-RM001C-EN-P - October 2010
Customized Function Blocks for 1758-FLO Controllers 99
HARTB_EC Function
Clear errors of the HART scan data block corresponding to the NUM.
Statement Instance
Parameter Explanation
HARTB_EC parameter explanation
Input Data Type Description
NUM UINT Scan data block NUM
TIP Function blocks HARTB_CLR, HARTB_ADD, HARTB_AEC, HARTB_EC, and HARTB_EG are used in HART data timing scan. This function is similar to HART Settings in DS Settings. For more information, refer to the DataSite Software User Manual, publication 1758-UM002.
44634
HARTB_EC
NUM
Publication 1758-RM001C-EN-P - October 2010
100 Customized Function Blocks for 1758-FLO Controllers
HARTB_EG Function
Get the error state of certain HART scan data block.
Statement Instance
Parameter Explanation
If you encounter the communication error, check the connection between the HART port and the HART instrument, and the settings for the HART scan block.
HARTB_EG parameter explanation
Input Return Data Type Description
NUM — UINT Scan data block NUM
— ERR UINT 0: Normal1: Communication error
— CON UINT Count of scan block communication errors.
TIP Function blocks HARTB_CLR, HARTB_ADD, HARTB_AEC, HARTB_EC, and HARTB_EG are used in HART data timing scan. This function is similar to HART Settings in DS Settings. For more information, refer to the DataSite Software User Manual, publication 1758-UM002.
44635
HARTB_EG
NUM
ERR
CON
Publication 1758-RM001C-EN-P - October 2010
Customized Function Blocks for 1758-FLO Controllers 101
HARTT_CFG Function
Configure the triggering of the HART Scan function via the HART channel.
Statement Instance
Parameter Explanation
HARTB_ADD parameter explanation
Input Return Data Type Description Parameter Value
EN — BOOL Enable or disable 0: Disable1: Enable
ID — BYTE HART channel number 0…2
ADR — BYTE HART instrument address 1…247
CMD — BYTE Command numbers 0, 1, 2, 3, 15, 33, 35, 38, 40, 44, 48, 54, 59
CD — UINT Send register —
DD — UINT Return register —
UT — UINT Unit register —
ST — UINT State register —
45588
HARTT_CFG
ID
ADR
CMD
CD
DD
UT
ST
EN
Publication 1758-RM001C-EN-P - October 2010
102 Customized Function Blocks for 1758-FLO Controllers
HARTT_ST Function
Get the status of the HART trigger block.
Statement Instance
Parameter Explanation
HARTT_ST parameter explanation
Input Return Data Type
Description Parameter Value
ID — BYTE HART channel number 0…2
— STAT BYTE status of the HARTT_CFG function block return value
0: HARTT_CFG configuration ok1: HARTT_CFG trigger on(in progress)2: HARTT_CFG trigger OK (completed)3: HARTT_CFG configuration error255: HARTT_CFG trigger error
45589
HARTT_ST
ID STAT
Publication 1758-RM001C-EN-P - October 2010
Customized Function Blocks for 1758-FLO Controllers 103
PW_SHDN Function
Shut down the controller, and enable or disable the RTC alarm wake-up mode.
Statement Instance
Parameter Explanation
PW_SHDN parameter explanation
Input Return Data Type Description Parameter Value
RTC — UINT RTC Alarm Wake-Up Mode Enable/Disable symbol
0: Shut down, and disable RTC alarm wake-up mode
1: Shut down, and enable RTC alarm wake-up mode
HOUR — UINT Hour 0…23
MINU — UINT Minute 0…59
SEC — UINT Second 0…59
PW_SHDN
RTC
HOUR
MINU
SEC44639
Publication 1758-RM001C-EN-P - October 2010
104 Customized Function Blocks for 1758-FLO Controllers
REG_MOVE Function
Copy the register data block.
Statement Instance
Parameter Explanation
REG_MOVE parameter explanation
Input Return Data Type Description Parameter Value
T — UINT Master register address —
R — UINT Slave register address —
NUM — UINT Register number —
SWAP — BOOL Swap sign of floating high-low bits
0: low bits in front1: high bits in front
REG_MOVE
NUM
SWAP
R
T
44665
Publication 1758-RM001C-EN-P - October 2010
Customized Function Blocks for 1758-FLO Controllers 105
REG_R_REAL Function
Read floating point numbers from the register.
Statement Instance
Parameter Explanation
REG_R_REAL parameter explanation
Input Return Data Type Description Parameter Value
ADR — UINT Register address —
SWAP — BOOL Swap sign of floating high-low bits
0: low bits in front1: high bits in front
— OUT REAL Numerical value —
REG_R_REAL
SWAPOUT
ADR
44661
Publication 1758-RM001C-EN-P - October 2010
106 Customized Function Blocks for 1758-FLO Controllers
REG_R_STR Function
Read string value from the register.
Statement Instance
Parameter Explanation
REG_R_STR parameter explanation
Input Return Data Type Description Parameter Value
ADR — UINT Register address 40003 to 49999
LEN — UINT String lenth 1…254
SWAP — BOOL Swap sign of floating high-low bits
0: low bits in front1: high bits in front
— BUF STRING String buffer address —
REG_R_STR
LEN
SWAP
BUF
ADR
45590
Publication 1758-RM001C-EN-P - October 2010
Customized Function Blocks for 1758-FLO Controllers 107
REG_R_UDINT Function
Read unsigned long integer.
Statement Instance
Parameter Explanation
REG_R_UDINT parameter explanation
Input Return Data Type Description Parameter Value
ADR — UINT Register address —
SWAP — BOOL Swap sign of floating high-low bits
0: low bits in front1: high bits in front
— OUT UDINT Numerical value —
REG_R_UDINT
SWAPOUT
ADR
44663
Publication 1758-RM001C-EN-P - October 2010
108 Customized Function Blocks for 1758-FLO Controllers
REG_R_UINT Function
Read unsigned integer from the register.
Statement Instance
Parameter Explanation
REG_R_UINT parameter explanation
Input Return Data Type Description Parameter Value
ADR — UINT Register address —
— OUT UINT Numerical value —
REG_R_UINT
ADR OUT
44659
Publication 1758-RM001C-EN-P - October 2010
Customized Function Blocks for 1758-FLO Controllers 109
REG_W_REAL Function
Write floating point numbers to the register.
Statement Instance
Parameter Explanation
REG_W_REAL parameter explanation
Input Return Data Type Description Parameter Value
ADR — UINT Register address —
SWAP — BOOL Swap sign of floating high-low bits
0: low bits in front1: high bits in front
VAL — REAL Numerical value —
REG_W_REAL
VAL
SWAP
ADR
44662
Publication 1758-RM001C-EN-P - October 2010
110 Customized Function Blocks for 1758-FLO Controllers
REG_W_STR Function
Write string value into the register.
Statement Instance
Parameter Explanation
REG_R_STR parameter explanation
Input Return Data Type Description Parameter Value
ADR — UINT Register address 40003 to 49999
BUF — STRING String buffer address —
LEN — UINT String lenth 1…254
SWAP — BOOL Swap sign of floating high-low bits
0: low bits in front1: high bits in front
REG_W_STR
LEN
SWAP
BUF
ADR
45591
Publication 1758-RM001C-EN-P - October 2010
Customized Function Blocks for 1758-FLO Controllers 111
REG_W_UDINT Function
Write unsigned long integer to the register.
Statement Instance
Parameter Explanation
REG_W_UDINT parameter explanation
Input Return Data Type Description Parameter Value
ADR — UINT Register address —
SWAP — BOOL Swap sign of floating high-low bits
0: low bits in front1: high bits in front
VAL — UDINT Numerical value —
REG_W_UDINT
VAL
SWAP
ADR
44664
Publication 1758-RM001C-EN-P - October 2010
112 Customized Function Blocks for 1758-FLO Controllers
REG_W_UINT Function
Write unsigned integer to the register.
Statement Instance
Parameter Explanation
REG_W_UINT parameter explanation
Input Return Data Type Description Parameter Value
ADR — UINT Register address —
VAL — UINT Numerical value —
REG_W_UINT
VAL
ADR
44660
Publication 1758-RM001C-EN-P - October 2010
Customized Function Blocks for 1758-FLO Controllers 113
SWAP_DWORD Function
Byte manipulation operations. High byte and low byte exchange positions in a word.
Statement Instance
Parameter Explanation
SWAP_DWORD parameter explanation
Input Return Data Type Description Parameter Value
IN — DWORD Previous value —
— OUT DWORD New value —
SWAP_DWORD
IN OUT
44959
Publication 1758-RM001C-EN-P - October 2010
114 Customized Function Blocks for 1758-FLO Controllers
SWAP_WORD Function
Byte manipulation operations. High byte and low byte exchange positions in a word.
Statement Instance
Parameter Explanation
SWAP_WORD parameter explanation
Input Return Data Type Description Parameter Value
IN — WORD Previous value —
— OUT WORD New value —
SWAP_WORD
IN OUT
44960
Publication 1758-RM001C-EN-P - October 2010
Customized Function Blocks for 1758-FLO Controllers 115
SYS_AD_GET Function
Read out the integer value and engineering value of the system’s analog/digital (A/D) conversion.
Statement Instance
Parameter Explanation
SYS_AD_GET parameter explanation
Input Return Data Type Description Parameter Value
CHL — UINT Channel number of system A/D
0: reserved1: reserved2: channel 2 of system A/D for controller temperature3: channel 3 of system A/D for battery voltage
— AD_N UINT Integer value of this A/D channel
0…1024
— AD_F REAL Engineering value of this A/D channel
-40…125 °C for controller temperature0…3.60 for battery voltage
TIP The function block SYS_AD_GET retrieves the same A/D data as that shown in the Debug dialog box in Controller Debug of the DS Settings tool. An example is shown here.
For more information, refer to the DataSite Software User Manual, publication 1758-UM002.
SYS_AD_GET
CHL
AD_N
AD_F
44666
Publication 1758-RM001C-EN-P - October 2010
116 Customized Function Blocks for 1758-FLO Controllers
SYS_ERR_GET Function
Get system errors.
Statement Instance
Parameter Explanation
For example, ERR=3=0x0001 + 0x0002, means the system errors are hardware registering error and FLASH error.
SYS_ERR_GET
ERR
44667
SYS_ERR_GET parameter explanation
Input Return Data Type Description Parameter Value Possible Solution
— ERR UINT The value of all errors (summed)
0x0001:/*hardware registering error*/ Contact a Rockwell technical support representative.
0x0002:/*FLASH error*/
0x0100:/*HART error*/ Check the connection between the HART port and the HART instrument. In addition, verify the settings for the HART scan block.
0x0200:/*US1error*/ Check the connection between the COM1 port and the slave device. In addition, verify the settings for the scan block.
0x0400:/*US2 error*/ Check the connection between the COM2 port and the slave device. In addition, verify the settings for the scan block.
TIP The function block SYS_ERR_GET executes the same function as the Error Record function in the Debug dialog box in Controller Debug of the DS Settings tool. The Error Record box is shown here.
For more information, refer to the DataSite Software User Manual, publication 1758-UM002.
Publication 1758-RM001C-EN-P - October 2010
Customized Function Blocks for 1758-FLO Controllers 117
SYS_ERR_RST Function
Clear all system errors.
Statement Instance
TIP The function block SYS_ERR_RST executes the same function as the Clear Error function in the Debug dialog box in Controller Debug of the DS Settings tool. For more information, refer to the DataSite Software User Manual, publication 1758-UM002.
SYS_ERR_RST
44668
Publication 1758-RM001C-EN-P - October 2010
118 Customized Function Blocks for 1758-FLO Controllers
Publication 1758-RM001C-EN-P - October 2010
Rockwell Otomasyon Ticaret A.Ş., Kar Plaza İş Merkezi E Blok Kat:6 34752 İçerenköy, İstanbul, Tel: +90 (216) 5698400
Publication 1758-RM001C-EN-P - October 2010 120Copyright © 2010 Rockwell Automation, Inc. All rights reserved. Printed in the U.S.A.
Rockwell Automation Support
Rockwell Automation provides technical information on the Web to assist you in using its products. At http://www.rockwellautomation.com/support/, you can find technical manuals, a knowledge base of FAQs, technical and application notes, sample code and links to software service packs, and a MySupport feature that you can customize to make thebest use of these tools.
For an additional level of technical phone support for installation, configuration, and troubleshooting, we offer TechConnect support programs. For more information, contact your local distributor or Rockwell Automation representative, or visit http://www.rockwellautomation.com/support/.
Installation Assistance
If you experience a problem within the first 24 hours of installation, review the information that is contained in this manual.You can contact Customer Support for initial help in getting your product up and running.
New Product Satisfaction Return
Rockwell Automation tests all of its products to ensure that they are fully operational when shipped from the manufacturing facility. However, if your product is not functioning and needs to be returned, follow these procedures.
Documentation Feedback
Your comments will help us serve your documentation needs better. If you have any suggestions on how to improve this document, complete this form, publication RA-DU002, available at http://www.rockwellautomation.com/literature/.
United States or Canada 1.440.646.3434
Outside United States or Canada
Use the Worldwide Locator at http://www.rockwellautomation.com/support/americas/phone_en.html, or contact your local Rockwell Automation representative.
United States Contact your distributor. You must provide a Customer Support case number (call the phone number above to obtain one) to your distributor to complete the return process.
Outside United States Please contact your local Rockwell Automation representative for the return procedure.