VIPA Standard Operation List
Transcription
VIPA Standard Operation List
VIPA Standard | Operation List | Manual HB00E_OPL_STD | Rev. 14/22 May 2014 Copyright © VIPA GmbH. All Rights Reserved. This document contains proprietary information of VIPA and is not to be disclosed or used except in accordance with applicable agreements. This material is protected by the copyright laws. It may not be reproduced, distributed, or altered in any fashion by any entity (either internal or external to VIPA), except in accordance with applicable agreements, contracts or licensing, without the express written consent of VIPA and the business management owner of the material. For permission to reproduce or distribute, please contact: VIPA, Gesellschaft für Visualisierung und Prozessautomatisierung mbH Ohmstraße 4, D-91074 Herzogenaurach, Germany Tel.: +49 (91 32) 744 -0 Fax.: +49 9132 744 1864 EMail: [email protected] http://www.vipa.com Note Every effort has been made to ensure that the information contained in this document was complete and accurate at the time of publishing. Nevertheless, the authors retain the right to modify the information. This customer document describes all the hardware units and functions known at the present time. Descriptions may be included for units which are not present at the customer site. The exact scope of delivery is described in the respective purchase contract. CE Conformity Declaration Hereby, VIPA GmbH declares that the products and systems are in compliance with the essential requirements and other relevant provisions. Conformity is indicated by the CE marking affixed to the product. Conformity Information For more information regarding CE marking and Declaration of Conformity (DoC), please contact your local VIPA customer service organization. Trademarks VIPA, SLIO, System 100V, System 200V, System 300V, System 300S, System 400V, System 500S and Commander Compact are registered trademarks of VIPA Gesellschaft für Visualisierung und Prozessautomatisierung mbH. SPEED7 is a registered trademark of profichip GmbH. SIMATIC, STEP, SINEC, TIA Portal, S7-300 and S7-400 are registered trademarks of Siemens AG. Microsoft und Windows are registered trademarks of Microsoft Inc., USA. Portable Document Format (PDF) and Postscript are registered trademarks of Adobe Systems, Inc. All other trademarks, logos and service or product marks specified herein are owned by their respective companies. Information product support Contact your local VIPA Customer Service Organization representative if you wish to report errors or questions regarding the contents of this document. If you are unable to locate a customer service center, contact VIPA as follows: VIPA GmbH, Ohmstraße 4, 91074 Herzogenaurach, Germany Telefax:+49 9132 744 1204 EMail: [email protected] Technical support Contact your local VIPA Customer Service Organization representative if you encounter problems with the product or have questions regarding the product. If you are unable to locate a customer service center, contact VIPA as follows: VIPA GmbH, Ohmstraße 4, 91074 Herzogenaurach, Germany Telephone: +49 9132 744 1150 (Hotline) EMail: [email protected] Manual VIPA Operation List Standard Contents Contents About this manual .................................................................................... 1 Instruction list ................................................................. 1-1 Chapter 1 Alphabetical instruction list ................................................................... 1-2 Abbreviations ....................................................................................... 1-4 Registers.............................................................................................. 1-6 Addressing examples ........................................................................... 1-7 Math instructions .................................................................................. 1-9 Block instructions ............................................................................... 1-11 Program display and null instruction instructions ................................ 1-12 Edge-triggered instructions ................................................................ 1-12 Load instructions ................................................................................ 1-13 Shift instructions................................................................................. 1-16 Setting/resetting bit addresses ........................................................... 1-17 Jump instructions ............................................................................... 1-19 Transfer instructions........................................................................... 1-20 Data type conversion instructions....................................................... 1-23 Comparison instructions..................................................................... 1-24 Combination instructions (Bit)............................................................. 1-25 Combination instructions (Word) ........................................................ 1-31 Timer instructions............................................................................... 1-31 Counter instructions ........................................................................... 1-32 Chapter 2 Organization Blocks ....................................................... 2-1 Overview .............................................................................................. 2-2 OB 1 - Main program............................................................................ 2-3 OB 10 - Time-of-day Interrupt .............................................................. 2-5 OB 20 - Time-delay Interrupt ................................................................ 2-7 OB 35 - Watchdog Interrupt ................................................................. 2-8 OB 40 - Hardware Interrupt .................................................................. 2-9 OB 80 - Time Error............................................................................. 2-11 OB 81 - Power supply Error................................................................ 2-14 OB 82 - Diagnostic Interrupt............................................................... 2-15 OB 85 - Program execution Error ....................................................... 2-17 OB 86 - Slave Failure / Restart........................................................... 2-21 OB 100 - Reboot ................................................................................ 2-23 OB 121 - Programming Error (Synchronous error) ............................. 2-25 OB 122 - Periphery access Error........................................................ 2-28 Chapter 3 Integrated SFBs .............................................................. 3-1 Overview .............................................................................................. 3-2 SFB 0 - CTU - Up-counter.................................................................... 3-3 SFB 1 - CTD - Down-counter ............................................................... 3-4 SFB 2 - CTUD - Up-Down counter ....................................................... 3-5 SFB 3 - TP - Create pulse .................................................................... 3-7 SFB 4 - TON - Create turn-on delay..................................................... 3-9 SFB 5 - TOF - Create turn-off delay ................................................... 3-11 SFB 32 - DRUM - Realize a step-by-step switch ................................ 3-13 HB00E - OPL_STD - Rev. 14/22 i Contents Manual VIPA Operation List Standard SFB 52 - RDREC - Reading a Data Record from a DP-V1 slave ....... 3-18 SFB 53 - WRREC - Writing a Data Record in a DP-V1 slave ............. 3-20 SFB 54 - RALRM - Receiving an interrupt from a DP-V1 slave .......... 3-22 Chapter 4 Integrated Standard SFCs .............................................. 4-1 Overview Integrated standard SFCs..................................................... 4-3 General and Specific Error Information RET_VAL................................ 4-5 SFC 0 - SET_CLK - Set system clock .................................................. 4-8 SFC 1 - READ_CLK - Read system clock ............................................ 4-9 SFC 2 ... 4 - Run-time meter .............................................................. 4-10 SFC 2 - SET_RTM - Set run-time meter............................................. 4-11 SFC 3 - CTRL_RTM - Control run-time meter .................................... 4-12 SFC 4 - READ_RTM - Read run-time meter....................................... 4-13 SFC 5 - GADR_LGC - Logical address of a channel .......................... 4-14 SFC 6 - RD_SINFO - Read start information...................................... 4-16 SFC 12 - D_ACT_DP - Activating and Deactivating of DP slaves....... 4-18 SFC 13 - DPNRM_DG - Read diagnostic data of a DP slave ............. 4-23 SFC 14 - DPRD_DAT - Read consistent data .................................... 4-26 SFC 15 - DPWR_DAT - Write consistent data ................................... 4-28 SFC 17 - ALARM_SQ and SFC 18 - ALARM_S ................................. 4-30 SFC 19 - ALARM_SC - Acknowledgement state last Alarm ............... 4-33 SFC 20 - BLKMOV - Block move........................................................ 4-34 SFC 21 - FILL - Fill a field .................................................................. 4-36 SFC 22 - CREAT_DB - Create a data block ....................................... 4-38 SFC 23 - DEL_DB - Deleting a data block.......................................... 4-40 SFC 24 - TEST_DB - Test data block ................................................ 4-41 SFC 28 ... 31 - Time-of-day interrupt.................................................. 4-42 SFC 32 - SRT_DINT - Start time-delay interrupt ................................ 4-46 SFC 33 - CAN_DINT - Cancel time-delay interrupt............................. 4-47 SFC 34 - QRY_DINT - Query time-delay interrupt.............................. 4-48 SFC 36 - MSK_FLT - Mask synchronous errors ................................. 4-49 SFC 37 - DMSK_FLT - Unmask synchronous errors.......................... 4-50 SFC 38 - READ_ERR - Read error register........................................ 4-51 SFC 39 - DIS_IRT - Disabling interrupts............................................. 4-52 SFC 40 - EN_IRT - Enabling interrupts .............................................. 4-54 SFC 41 - DIS_AIRT - Delaying interrupts ........................................... 4-55 SFC 42 - EN_AIRT - Enabling delayed interrupts............................... 4-56 SFC 43 - RE_TRIGR - Retrigger the watchdog .................................. 4-56 SFC 44 - REPL_VAL - Replace value to AKKU1................................ 4-57 SFC 46 - STP - STOP the CPU.......................................................... 4-57 SFC 47 - WAIT - Delay the application program ................................ 4-58 SFC 49 - LGC_GADR - Read the slot address................................... 4-59 SFC 50 - RD_LGADR - Read all logical addresses of a module ........ 4-60 SFC 51 - RDSYSST - Read system status list SSL............................ 4-61 SFC 52 - WR_USMSG - Write user entry into diagnostic buffer......... 4-63 SFC 54 - RD_DPARM - Read predefined parameter ......................... 4-67 SFC 55 - WR_PARM - Write dynamic parameter............................... 4-69 SFC 56 - WR_DPARM - Write default parameter............................... 4-72 SFC 57 - PARM_MOD - Parameterize module................................... 4-74 ii HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Contents SFC 58 - WR_REC - Write record...................................................... 4-76 SFC 59 - RD_REC - Read record....................................................... 4-79 SFC 64 - TIME_TCK - Read system time tick .................................... 4-82 SFC 65 - X_SEND - Send data .......................................................... 4-83 SFC 66 - X_RCV - Receive data ........................................................ 4-86 SFC 67 - X_GET - Read data ............................................................ 4-91 SFC 68 - X_PUT - Write data............................................................. 4-95 SFC 69 - X_ABORT - Disconnect ...................................................... 4-98 SFC 81 - UBLKMOV - Copy data area without gaps ........................ 4-101 Chapter 5 VIPA specific blocks ....................................................... 5-1 Overview .............................................................................................. 5-2 Include VIPA library.............................................................................. 5-4 FB 55 - IP_CONFIG - Programmed Communication Connections ....... 5-5 FC 0 - SEND - Send to CP 240 .......................................................... 5-10 FC 1 - RECEIVE - Receive from CP 240............................................ 5-11 FC 5 - AG_SEND / FC 6 - AG_RECV - CP 243 communication......... 5-12 FC 8 - STEUERBIT - Modem functionality CP 240............................. 5-17 FC 9 - SYNCHRON_RESET - Synchronization CPU and CP 240...... 5-18 FC 11 - ASCII_FRAGMENT - Receive fragmented from CP 240 ....... 5-19 Serial communication - SFC 207 and SFC 216...218 ......................... 5-20 SFC 207 - SER_CTRL ...................................................................... 5-21 SFC 216 - SER_CFG ........................................................................ 5-22 SFC 217 - SER_SND ....................................................................... 5-26 SFC 218 - SER_RCV ....................................................................... 5-29 SFC 219 - CAN_TLGR - Send CAN telegram .................................... 5-30 MMC Access - SFC 220...222 ........................................................... 5-33 SFC 220 - MMC_CR_F ..................................................................... 5-34 SFC 221 - MMC_RD_F ..................................................................... 5-36 SFC 222 - MMC_WR_F .................................................................... 5-37 SFC 223 - PWM - Pulse duration modulation ..................................... 5-38 SFC 224 - HSC - High-speed counter ................................................ 5-40 SFC 225 - HF_PWM - HF pulse duration modulation ......................... 5-42 SFC 227 - TD_PRM - TD200 communication..................................... 5-44 SFC 228 - RW_KACHEL - Page frame direct access ........................ 5-46 Page frame communication - SFC 230 ... 238.................................... 5-48 Page frame communication - Parameter transfer............................... 5-51 Page frame communication - Source res. destination definition ......... 5-52 Page frame communication - Indicator word ANZW........................... 5-55 Page frame communication - Parameterization error PAFE ............... 5-62 SFC 230 - SEND ............................................................................... 5-63 SFC 231 - RECEIVE ......................................................................... 5-64 SFC 232 - FETCH ............................................................................. 5-65 SFC 233 - CONTROL ....................................................................... 5-66 SFC 234 - RESET ............................................................................. 5-67 SFC 235 - SYNCHRON ..................................................................... 5-68 SFC 236 - SEND_ALL ....................................................................... 5-69 SFC 237 - RECEIVE_ALL ................................................................. 5-70 SFC 238 - CTRL1 ............................................................................. 5-71 HB00E - OPL_STD - Rev. 14/22 iii Contents iv Manual VIPA Operation List Standard HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard About this manual About this manual This manual provides you with a comprehensive overview of the blocks integrated to the VIPA Standard CPUs System 100V, 200V, 300V and 500V. Described are command list, integrated OBs, SFBs, SFCs and the VIPA specific blocks. Outline Chapter 1: Instruction list This chapter lists the available commands of the standard CPUs from VIPA of the Systems 100V, 200V, 300V and 500V. The instruction list intends to give you an overview over the commands and their syntax. The commands are sorted by topics in alphabetical order. Chapter 2: Organization Blocks In this Chapter the description of the integrated organization blocks of the VIPA standard CPUs of Systems 100V, 200V, 300V and 500V may be found. Chapter 3: Integrated SFBs The description of the integrated function blocks of the VIPA standard CPUs of the systems 100V, 200V, 300V and 500V may be found here. Chapter 4: Integrated Standard SFCs The integrated standard SFCs of the VIPA standard CPUs of the systems 100V, 200V, 300V and 500V are described in this chapter. Chapter 5: VIPA specific blocks Here the VIPA specific blocks are described that are exclusively may be used with the standard CPUs from VIPA of the Systems 100V, 200V, 300V and 500V. Please note that not every block listed here is integrated in every system CPU. The assignment to the according system may be in the table of the "Overview". HB00E - OPL_STD - Rev. 14/22 1 Manual VIPA Operation List Standard About this manual Objective and contents This manual provides you with the instruction list and the description of the integrated blocks that are exclusively may be used with the VIPA Standard CPUs System 100V, 200V, 300V and 500V. Target audience The manual is targeted at users who have a background in automation technology. Structure of the manual The manual consists of chapters. Every chapter provides a self-contained description of a specific topic. Guide to the document The following guides are available in the manual: • an overall table of contents at the beginning of the manual • an overview of the topics for every chapter • an index at the end of the manual. Availability The manual is available in: • printed form, on paper • in electronic form as PDF-file (Adobe Acrobat Reader) Icons Headings Important passages in the text are highlighted by following icons and headings: Danger! Immediate or likely danger. Personal injury is possible. Attention! Damages to property is likely if these warnings are not heeded. Note! Supplementary information and useful tips. 2 HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Chapter 1 Instruction list Chapter 1 Instruction list Overview The following chapter lists the available commands of the standard CPUs from VIPA of the Systems 100V, 200V, 300V and 500V. The instruction list intends to give you an overview over the commands and their syntax. The commands are sorted by topics in alphabetical order. Via the content the different topics are available. The alphabetical instruction list gives you direct access to the instructions. For the parameters are integrated in the instruction list, there is no extra parameter list. Content Topic Page Instruction list ................................................................. 1-1 Chapter 1 Alphabetical instruction list ................................................................... 1-2 Abbreviations ....................................................................................... 1-4 Registers.............................................................................................. 1-6 Addressing examples ........................................................................... 1-7 Math instructions .................................................................................. 1-9 Block instructions ............................................................................... 1-11 Program display and null instruction instructions ................................ 1-12 Edge-triggered instructions ................................................................ 1-12 Load instructions ................................................................................ 1-13 Shift instructions................................................................................. 1-16 Setting/resetting bit addresses ........................................................... 1-17 Jump instructions ............................................................................... 1-19 Transfer instructions........................................................................... 1-20 Data type conversion instructions....................................................... 1-23 Comparison instructions..................................................................... 1-24 Combination instructions (Bit)............................................................. 1-25 Combination instructions (Word) ........................................................ 1-31 Timer instructions............................................................................... 1-31 Counter instructions ........................................................................... 1-32 HB00E - OPL_STD - Rev. 14/22 1-1 Manual VIPA Operation List Standard Chapter 1 Instruction list Alphabetical instruction list Instruction ) + +AR1 +AR2 +D +I +R -D -I -R *D *I *R /D /I /R = ==D ==I ==R <=D <=I <=R <D <I <R <>D <>I <>R >=D >=I >=R >I >D >R A A( ABS ACOS AD 1-2 Page 1-27 1-10 1-10 1-10 1-9 1-9 1-9 1-9 1-9 1-9 1-9 1-9 1-9 1-9 1-9 1-9 1-17 1-24 1-24 1-24 1-24 1-24 1-24 1-24 1-24 1-24 1-24 1-24 1-24 1-24 1-24 1-24 1-24 1-24 1-24 1-25, 1-28, 1-29 1-27 1-9 1-10 1-31 Instruction AN AN( ASIN ATAN AW BTD BTI BE BEC BEU BLD CAD CALL CAW CC CD CDB CLR COS CU DEC DTB DTR EXP FP FR FN INC INVD INVI ITB ITD JBI JC JCB JCN JL JM JMZ JN Page 1-25, 1-28, 1-29 1-27 1-10 1-10 1-31 1-23 1-23 1-11 1-11 1-11 1-12 1-22 1-11 1-22 1-11 1-32 1-11 1-18 1-10 1-32 1-22 1-23 1-23 1-10 1-12 1-31, 1-32 1-12 1-22 1-23 1-23 1-23 1-23 1-19 1-19 1-19 1-19 1-19 1-19 1-19 1-19 HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard JNB JNBI JO JOS JP JPZ JU JUO JZ L LAR1 LAR2 LD LN LOOP MOD NEGD NEGI NEGR NOP NOT O O( OD ON ON( OPN OW OW POP PUSH R RLD RLDA RND RND+ RNDRRD RRDA S SA SAVE SD HB00E - OPL_STD - Rev. 14/22 1-18 1-18 1-18 1-18 1-19 1-19 1-18 1-19 1-19 1-13, 1-14, 1-15, 1-22 1-21 1-21 1-15 1-10 1-19 1-9 1-23 1-23 1-9 1-12 1-18 1-25, 1-27, 1-28, 1-29 1-27 1-31 1-26, 1-28, 1-30 1-27 1-11 1-31 1-31 1-22 1-22 1-17, 1-31, 1-32 1-16 1-16 1-23 1-23 1-23 1-16 1-16 1-17, 1-32 1-31 1-18 1-31 Chapter 1 Instruction list SE SET SIN SLD SLW SP SQR SQRT SRD SRW SS SSD SSI T TAK TAN TAR TAR1 TAR2 TRUNC UC X X( XN XN( XOD XOW 1-31 1-18 1-10 1-16 1-16 1-31 1-10 1-10 1-16 1-16 1-31 1-16 1-16 1-20, 1-21, 1-22 1-22 1-10 1-22 1-21 1-22 1-23 1-11 1-26, 1-28, 1-30 1-27 1-26, 1-28, 1-30 1-27 1-31 1-31 1-3 Chapter 1 Instruction list Manual VIPA Operation List Standard Abbreviations Abbreviation /FC 2# a ACCU AR Description First check bit Binary constant Byte address Register for processing bytes, words and double words Address registers, contain the area-internal or areacrossing addresses for the instructions addressed register-indirect b Bit address B area-crossing, register-indirect addressed byte B (b1,b2) Constant, 2byte B (b1,b2,b3,b4) Constant, 4byte Byte hexadecimal B#16# BR Binary result c Operand range C Counter Counter constant (BCD-coded) C# CC0 Condition code CC1 Condition code D area-crossing, register-indirect addressed double word IEC date constant D# DB Data block DBB Data byte in the data block DBD Data double word in the data block DBW Data word in the data block DBX Data bit in the data block DI Instance data block DIB Data byte in the instance DB DID Data double word in the instance DB DIW Data word in the instance DB DIX Data bit in the instance DB Double word hexadecimal DW#16# f Timer/Counter No. FB Function block FC Functions g Operand range h Operand range I Input (in the PII) i Operand range i8 Integer (8bit) i16 Integer (16bit) i32 Integer (32bit) IB Input byte (in the PII) ID Input double word (in the PII) IW Input word (in the PII) k8 Constant (8bit) k16 Constant (16bit) k32 Constant (32bit) continued ... 1-4 HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard ... continue Abbreviation L L# LABEL LB LD LW m M MB MD MW n OB OR OS OV p P# PIQ PII PIB PID PIW PQB PQD PQW Q q QB QD QW r RLO S5T# SFB SFC STA T T# TOD# W W#16# HB00E - OPL_STD - Rev. 14/22 Chapter 1 Instruction list Description Local data Integer constant (32bit) Symbolic jump address (max. 4 characters) Local data byte Local data double word Local data word Pointer constant P#x.y (pointer) Bit memory bit Bit memory byte Bit memory double word Bit memory word Binary constant Organization block Or Stored overflow Overflow Hexadecimal constant Pointer constant Process image of the outputs Process image of the inputs Periphery input byte (direct periphery access) Periphery input double word (direct periphery access) Periphery input word (direct periphery access) Periphery output byte (direct periphery access) Periphery output double word (direct periphery access) Periphery output word (direct periphery access) Output (in the PIQ) Real number (32bit floating-point number) Output byte (in the PIQ) Output double word (in the PIQ) Output word (in the PIQ) Block no. Result of (previous) logic instruction S5 time constant (16bit), loads the S5-Timer System function block System function Status Timer (times) Time constant (16/32bit) IEC time constant area-crossing, register-indirect addressed word Word hexadecimal 1-5 Manual VIPA Operation List Standard Chapter 1 Instruction list Registers ACCU1 and ACCU2 (32bit) The ACCUs are registers for the processing of byte, words or double words. Therefore the operands are loaded in the ACCUs and combined. The result of the instruction is always in ACCU1. ACCU Bit ACCUx (x=1 to 2) Bit 0 ... bit 31 ACCUx-L Bit 0 ... bit 15 ACCUx-H Bit 16 ... bit 31 ACCUx-LL Bit 0 ... bit 7 ACCUx-LH Bit 8 ... bit 15 ACCUx-HL Bit 16 ... bit 23 ACCUx-HH Bit 24 ... bit 31 Address register AR1 and AR2 (32bit) The address registers contain the area-internal or area-crossing addresses for the register-indirect addressed instructions. The address registers are 32bit wide. The area-internal or area-crossing addresses have the following structure: area-internal address: 00000000 00000bbb bbbbbbbb bbbbbxxx area-crossing address: 10000yyy 00000bbb bbbbbbbb bbbbbxxx Legend: Status word (16bit) b x Y Byte address Bit number Range ID (see chapter "Addressing examples") The values are analyzed or set by the instructions. The status word is 16bit wide. Bit Assignment Description 0 /FC First check bit* 1 RLO Result of (previous) logic instruction 2 STA Status* 3 OR Or* 4 OS Stored overflow 5 OV Overflow 6 CC0 Condition code 7 CC1 Condition code 8 BR Binary result not used 9 ... 15 * Bit may not be analyzed with the instruction L STW in the user application, for the bit isn't updated during application run-time. 1-6 HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Chapter 1 Instruction list Addressing examples Addressing example Description Immediate addressing L +27 Load 16bit integer constant "27" in ACCU1 Load 32bit integer constant "-1" in ACCU1 L L#-1 L 2#1010101010101010 Load binary constant in ACCU1 Load hexadecimal constant in ACCU1 L DW#16#A0F0_BCFD L 'End' Load ASCII code in ACCU1 Load time value in ACCU1 L T#500ms Load counter value in ACCU1 L C#100 Load constant as 2byte L B#(100,12) Load constant as 4byte L B#(100,12,50,8) Load area-internal pointer in ACCU1 L P#10.0 Load area-crossing pointer in ACCU1 L P#E20.6 L -2.5 Load real number in ACCU1 Load date L D#1995-01-20 Load time-of-day L TOD#13:20:33.125 Direct addressing A I 0.0 AND operation of input bit 0.0 L IB 1 Load input byte 1 in ACCU1 L IW 0 Load input word 0 in ACCU1 L ID 0 Load input double word 0 in ACCU1 Indirect addressing timer/counter SP T [LW 8] Start timer; timer no. is in local data word 8 CU C [LW 10] Start counter; counter no. is in local data word 10 Memory-indirect, area-internal addressing AND instruction; input address is in local data A I [LD 12] double word 12 as pointer e.g.: LP#22.2 T LD 12 A I [LD 12] A I [DBD 1] AND instruction; input address is in data double word 1 of the DB as pointer A Q [DID 12] AND instruction; output address is in data double word 12 of the instance DB as pointer A Q [MD 12] AND instruction; output address is in bit memory double word 12 as pointer Register-indirect, area-internal addressing AND instruction; input address is calculated A I [AR1,P#12.2] "pointer value in address register 1 + pointer P#12.2" continued ... HB00E - OPL_STD - Rev. 14/22 1-7 Manual VIPA Operation List Standard Chapter 1 Instruction list ... continue Register-indirect, area-crossing addressing For the area-crossing, register indirect addressing the address needs an additional range-ID in the bits 24-26. The address is in the address register. Range-ID Binary code hex. Area P 80 Periphery area 1000 0000 I 81 Input area 1000 0001 Q 82 Output area 1000 0010 M 83 Bit memory area 1000 0011 DB 84 Data area 1000 0100 DI 85 Instance data area 1000 0101 L 86 Local data area 1000 0110 VL 87 Preceding local data area 1000 0111 (access to the local data of the calling block) Load byte in ACCU1; the address is calculated L B [AR1,P#8.0] "pointer value in address register 1 + pointer P#8.0" AND instruction; operand address is calculated A [AR1,P#32.3] "pointer value in address register 1 + pointer P#32.3" Addressing via parameters A parameter The operand is addressed via the parameter Example for pointer calculation Example when sum of bit addresses ≤ 7: LAR1 P#8.2 A I [AR1,P#10.2] Result: The input 18.4 is addressed (by adding the byte and bit addresses) Example when sum of bit addresses > 7: L MD 0 at will calculated pointer, e.g. P#10.5 LAR1 A I [AR1,P#10.7] Result: 1-8 Addressed is input 21.4 (by adding the byte and bit addresses with carry). HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Operand Command Parameter Chapter 1 Instruction list Status word Function BR CC1 CC0 OV OS OR STA RLO /FC Length in words : Instruction depends on : Instruction influences Math instructions +I - BR CC1 CC0 OV OS OR STA RLO /FC -I - Math instructions of two 16bit numbers. The result is in ACCU1 res. ACCU1-L. Status word Fixed-point arithmetic (16bit) - - - - Add up two integers (16bit) - - - - (ACCU1-L)=(ACCU1-L)+(ACCU2-L) - Y Y Y Y - - - - Subtract two integers (16bit) 1 1 (ACCU1-L)=(ACCU2-L)-(ACCU1-L) *I - Multiply two integers (16bit) 1 (ACCU1-L)=(ACCU2-L)*(ACCU1-L) /I - Divide two integers (16bit) 1 (ACCU1-L)=(ACCU2-L):(ACCU1-L) The remainder is in ACCU1-H +D - BR CC1 CC0 OV OS OR STA RLO /FC -D - Math instructions of two 32bit numbers. The result is in ACCU1. Status word Fixed-point arithmetic (32bit) - - - - Add up two integers (32bit) - - - - (ACCU1)=(ACCU2)+(ACCU1) - Y Y Y Y - - - - Subtract two integers (32bit) 1 1 (ACCU1)=(ACCU2)-(ACCU1) *D - Multiply two integers (32bit) 1 (ACCU1)=(ACCU2)*(ACCU1) /D - Divide two integers (32bit) 1 (ACCU1)=(ACCU2):(ACCU1) MOD - Divide two integers (32bit) and load the rest of the 1 division in ACCU1 (ACCU1)=remainder of [(ACCU2):(ACCU1)] +R - BR CC1 CC0 OV OS OR STA RLO /FC -R - *R - The result of the math instructions is in ACCU1. The execution time of the instruction depends on the value to calculate. Status word Floating-point arithmetic (32bit) - - - - Add up two real numbers (32bit) - - - - (ACCU1)=(ACCU2)+(ACCU1) - Y Y Y Y - - - - Subtract two real numbers (32bit) 1 1 (ACCU1)=(ACCU2)-(ACCU1) Multiply two real numbers (32bit) 1 (ACCU1)=(ACCU2)*(ACCU1) /R - Divide two real numbers (32bit) 1 (ACCU1)=(ACCU2):(ACCU1) NEGR ABS - - BR CC1 CC0 OV OS OR STA RLO /FC Negate the real number in ACCU1 - - - - - - - - - - - - - - - - - - Form the absolute value of the real number in ACCU1 HB00E - OPL_STD - Rev. 14/22 1 1 1-9 Manual VIPA Operation List Standard Chapter 1 Instruction list Operand Command Parameter Status word Function BR CC1 CC0 OV OS OR STA RLO /FC Length in words : Instruction depends on : Instruction influences SQRT - BR CC1 CC0 OV OS OR STA RLO /FC SQR - - - - - - - Y Y Y Y - - - - Form the square of a real number in ACCU1 - - - BR CC1 CC0 OV OS OR STA RLO /FC - - - - 1 1 The result of the logarithm function is in ACCU1. The instructions may be interrupted by alarms. Status word EXP - Calculate the Square root of a real number in ACCU1 - Logarithmic function (32bit) LN The result of the instructions is in ACCU1. The instructions may be interrupted by alarms. Status word Square root an square instructions (32bit) Calculate the natural logarithm of a real number in - - - - ACCU1 - Y Y Y Y - - - - Calculate the exponential value of a real number in ACCU1 1 1 on basis e (=2.71828) SIN1 - BR CC1 CC0 OV OS OR STA RLO /FC 2 ASIN - COS1 - The result of the trigonometrical function is in ACCU1. The instructions may be interrupted by alarms. Status word Trigonometrical functions (32bit) - - - - Calculate the sine of the real number 1 1 - - - - - Y Y Y Y - - - - Calculate the arcsine of the real number Calculate the cosine of the real number 1 Calculate the arccosine of the real number 1 Calculate the tangent of the real number 1 ATAN2 - Calculate the arctangent of the real number 1 Addition of constants Addition of integer constants to ACCU1. The condition code bits are not affected. ACOS2 TAN1 - + i8 Add an 8bit integer constant 1 + i16 Add a 16bit integer constant 2 + i32 Add a 32bit integer constant 3 Addition via address register +AR1 Adding a 16bit integer to contents of address register. The value is in the instruction or in ACCU1-L. Condition code bits are not affected - Add the contents of ACCU1-L to AR1 1 +AR1 m Add a pointer constant to the contents of AR1 2 +AR2 - Add the contents of ACCU1-L to those of AR2 1 +AR2 m Add pointer constant to the contents of AR2 2 1 Specify the angle in radians; the angle must be given as a floating point value in ACCU 1. 2 The result is an angle in radians. 1-10 HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Command Operand Parameter Chapter 1 Instruction list Status word Function BR CC1 CC0 OV OS OR STA RLO /FC Length in words : Instruction depends on : Instruction influences Block instructions Status word Block call instructions CALL FB r, DB r BR CC1 CC0 OV OS OR STA RLO /FC - - - - Unconditional call of a FB, with parameter transfer - - - - - - - - 0 0 1 - 0 Unconditional call of a SFB, with parameter transfer 1 - CALL SFB r, DB r CALL FC r Unconditional call of a function, with parameter transfer 1 CALL SFC r Unconditional call of a SFC, with parameter transfer 2 FB r Unconditional call of blocks, without parameter transfer 1 UC 2 FC r Parameter CC FB r FB/FC call via parameters BR CC1 CC0 OV OS OR STA RLO /FC FC r - - - - Parameter - - - - 0 0 1 - 0 FB/FC call via parameters OPN - - Conditional call of blocks, without parameter transfer 1 - Y - BR CC1 CC0 OV OS OR STA RLO /FC DB r - - - - - - - - - Open a data block DI r - - - - - - - - - Open a instance data block Parameter BEU BEC 2 Open a data block via parameter 2 End block 1 Status word Block end instructions BE 1/2 BR CC1 CC0 OV OS OR STA RLO /FC - - - - - - - - - - - - - 0 0 1 - 0 End block unconditionally BR CC1 CC0 OV OS OR STA RLO /FC - - - - - - - - Y 0 1 1 0 Exchanging shared data block an instance data block CDB HB00E - OPL_STD - Rev. 14/22 - - 1 End block if RLO="1" - Y - Exchanging the two current data blocks. The current shared data block becomes the current instance data block and vice versa. The condition code bits are not affected. Exchange shared data block and instant data block 1 1-11 Manual VIPA Operation List Standard Chapter 1 Instruction list Operand Command Parameter Status word Function BR CC1 CC0 OV OS OR STA RLO /FC Length in words : Instruction depends on : Instruction influences Program display and null instruction instructions The status word is not affected. Program display and null operation instructions BLD 0 ... 255 Program display instruction: 1 is treated by the CPU like a null operation instruction NOP 0 Null operation instruction 1 1 Edge-triggered instructions Status word Edge-triggered instructions Detection of an edge change. The current signal state of the RLO is compared with the signal state of the instruction or edge bit memory. FP detects a change in the RLO from "0" to "1". FN detects a change in the RLO from "1" to "0". FP I/Q a.b 0.0 ... 127.7 M a.b 0.0 ...1023.7 - - - - - a.b 0.0 ...1043.7 - - - - - 0 Y Y 1 DBX a.b 0.0 ...8191.7 DIX a.b 0.0 ...8191.7 L BR CC1 CC0 OV OS OR STA RLO /FC - Detecting the positive edge in the RLO. The bit addressed - Y - in the instruction is the auxiliary edge bit memory 2 2 c [AR1,m] 2 c [AR2,m] 2 [AR1,m] 2 [AR2,m] 2 2 I/Q a.b 0.0 ...127.7 M a.b 0.0 ...1023.7 - - - - - a.b 0.0 ...1043.7 - - - - - 0 Y Y 1 DBX a.b 0.0 ...8191.7 2 DIX a.b 0.0 ...8191.7 2 L 1-12 2 2 Parameter FN 2 BR CC1 CC0 OV OS OR STA RLO /FC - Detecting the negative edge in the RLO. The bit addressed - Y - in the instruction is the auxiliary edge bit memory 2 2 2 c [AR1,m] 2 c [AR2,m] 2 [AR1,m] 2 [AR2,m] 2 Parameter 2 HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Command Operand Parameter Chapter 1 Instruction list Status word Function BR CC1 CC0 OV OS OR STA RLO /FC Length in words : Instruction depends on : Instruction influences Load instructions Loading address identifiers into ACCU1. The contents of ACCU1 and ACCU2 are saved first. Load instructions The status word is not affected. L Load ... 0 ... 127 input byte 1/2 a 0 ... 127 output byte 1/2 a 0 ... 1023 periphery input byte MB a 0 ... 1023 bit memory byte LB a 0 ... 1043 local data byte 2 DBB a 0 ... 8191 data byte 2 DIB a 0 ... 8191 instance data byte 2 ... in ACCU1 2 g [AR1,m] register-indirect, area-internal (AR1) 2 g [AR2,m] register-indirect, area-internal (AR2) 2 B [AR1,m] area-crossing (AR1) 2 B [AR2,m] area-crossing (AR2) 2 Parameter via parameters 2 IB a QB PIB L 2 1/2 Load ... IW a 0 ... 126 input word 1/2 QW a 0 ... 126 output word 1/2 PIW a 0 ... 1022 periphery input word MW a 0 ... 1022 bit memory word a 0 ... 1042 local data word DBW a 0 ... 8190 data word 1/2 DIW 0 ... 8190 instance data word 1/2 LW a 1/2 2 ... in ACCU1-L h [AR1,m] register-indirect, area-internal (AR1) 2 h [AR2,m] register-indirect, area-internal (AR2) 2 W [AR1,m] area-crossing (AR1) 2 W [AR2,m] area-crossing (AR2) 2 Parameter via parameters 2 HB00E - OPL_STD - Rev. 14/22 1-13 Manual VIPA Operation List Standard Chapter 1 Instruction list Operand Command Parameter Status word Function BR CC1 CC0 OV OS OR STA RLO /FC Length in words : Instruction depends on : Instruction influences L Load ... ID a 0 ... 124 input double word 1/2 QD a 0 ... 124 output double word 1/2 PID a 0 ... 1020 periphery input double word MD a 0 ... 1020 bit memory double word LD a 0 ... 1040 local data double word 2 DBD a 0 ... 8188 data double word 2 DID a 0 ... 8188 instance data double word 2 2 1/2 ... in ACCU1-L i [AR1,m] register-indirect, area-internal (AR1) 2 i [AR2,m] register-indirect, area-internal (AR2) 2 D [AR1,m] area-crossing (AR1) 2 D [AR2,m] area-crossing (AR2) 2 Parameter via parameters 2 L Load ... k8 8bit constant in ACCU1-LL 1 k16 16bit constant in ACCU1-L 2 k32 32bit constant in ACCU1 3 Parameter Load constant in ACCU1 (addressed via parameters) 2 2#n Load 16bit binary constant in ACCU1-L 2 Load 32bit binary constant in ACCU1 3 B#8#p Load 8bit hexadecimal constant in ACCU1-LL 1 W#16#p Load 16bit hexadecimal constant in ACCU1-L 2 DW#16#p Load 32bit hexadecimal constant in ACCU1 3 L x Load one character L xx Load two characters L xxx Load three characters L L L 2 xxxx Load four characters 3 L D# Date Load IEC-date (BCD-coded) 3 L S5T# time value Load time constant (16bit) 2 L TOD# time value Load 32bit time constant 3 T# time Load 16bit time constant L (IEC-time-of-day) 2 value Load 32bit time constant 3 L C# counter value Load 16bit counter constant 2 L P# bit pointer Load bit pointer 3 L L# Integer Load 32bit integer constant 3 L Real Load real number 3 1-14 HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Command Operand Parameter Chapter 1 Instruction list Status word Function BR CC1 CC0 OV OS OR STA RLO /FC Length in words : Instruction depends on : Instruction influences Load instructions for timer and counter L Tf 0 ... 255 Timer para. L Cf Tf LD Cf Load time value Load time value (addressed via parameters) 0 ... 255 Counter para. LD Load a time or counter value in ACCU1, before the recent content of ACCU1 is saved in ACCU2. The status word is not affected. Load counter value Load counter value (addressed via parameters) 0 ... 255 Timer para. Load time value BCD-coded Load time value BCD-coded (addressed via parameters) 0 ... 255 Counter para. HB00E - OPL_STD - Rev. 14/22 Load counter value BCD-coded Load counter value BCD-coded (addressed via parameters) 1/2 2 1/2 2 1/2 2 1/2 2 1-15 Manual VIPA Operation List Standard Chapter 1 Instruction list Operand Command Parameter Status word Function BR CC1 CC0 OV OS OR STA RLO /FC Length in words : Instruction depends on : Instruction influences Shift instructions Shifting the contents of ACCU1 and ACCU1-L to the left or right by the specified number of places. If no address identifier is specified, shift the number of places into ACCU2-LL. Any positions that become free are padded with zeros or the sign. The last shifted bit is in condition code bit CC1. Status word Shift instructions SLW - SLW 0 ... 15 - - - - - - Positions that become free are provided with zeros SLD - - Y Y Y - - - - - Shift the contents of ACCU1 to the left SLD 0 ... 32 Positions that become free are provided with zeros SRW - Shift the contents of ACCU1-L to the right BR CC1 CC0 OV OS OR STA RLO /FC - - - Shift the contents of ACCU1-L to the left SRW 0 ... 15 Positions that become free are provided with zeros SRD - Shift the contents of ACCU1 to the right SRD 0 ... 32 Positions that become free are provided with zeros SSI - Shift the contents of ACCU1-L to the right with sign SSI 0 ... 15 Positions that become free are provided with the sign 1 1 1 1 1 (bit 15) SSD - SSD 0 ... 32 Shift the contents of ACCU1 to the right with sign Rotate the contents of ACCU1 to the left or right by the specified number of places. If no address identifier is specified, rotate the number of places into ACCU2-LL. Status word Rotation instructions RLD - RLD 0 ... 32 - - - - - - RRD - - Y Y Y - - - - - Rotate the contents of ACCU1 to the right RRD 0 ... 32 RLDA - BR CC1 CC0 OV OS OR STA RLO /FC - - - BR CC1 CC0 OV OS OR STA RLO /FC RRDA - - - - 1 Rotate the contents of ACCU1 to the left 1 1 Rotate the contents of ACCU1 one bit position to the left, - - - - - via CC1 bit - Y 0 0 - - - - - Rotate the contents of ACCU1 one bit position to the right, via CC1 bit 1-16 HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Operand Command Parameter Chapter 1 Instruction list Status word Function BR CC1 CC0 OV OS OR STA RLO /FC Length in words : Instruction depends on : Instruction influences Setting/resetting bit addresses Status word Set/Reset bit addresses S BR CC1 CC0 OV OS OR STA RLO /FC Assign the value "1" or "0" or the RLO to the addressed instructions. Set ... I/Q a.b 0.0 ... 127.7 - - - - - M a.b 0.0 ... 1023.7 - - - - - 0 Y - 0 set bit memory to "1" L a.b 0.0 ... 1043.7 local data bit to "1" 2 DBX a.b 0.0 ... 8191.7 data bit to "1" 2 DIX a.b 0.0 ... 8191.7 instance data bit to "1" 2 c [AR1,m] register-indirect, area-internal (AR1) 2 c [AR2,m] register-indirect, area-internal (AR2) 2 [AR1,m] area-crossing (AR1) 2 [AR2,m] area-crossing (AR2) 2 Parameter via parameters 2 R - - Y - input/output to "1" BR CC1 CC0 OV OS OR STA RLO /FC 1/2 1/2 Reset ... I/Q a.b 0.0 ... 127.7 - - - - - M a.b 0.0 ... 1023.7 - - - - - 0 Y - 0 set bit memory to "0" L a.b 0.0 ... 1043.7 local data bit to "0" 2 DBX a.b 0.0 ... 8191.7 data bit to "0" 2 DIX a.b 0.0 ... 8191.7 instance data bit to "0" 2 c [AR1,m] register-indirect, area-internal (AR1) 2 c [AR2,m] register-indirect, area-internal (AR2) 2 W [AR1,m] area-crossing (AR1) 2 W [AR2,m] area-crossing (AR2) 2 Parameter via parameters 2 = - - Y - input/output to "0" BR CC1 CC0 OV OS OR STA RLO /FC 1/2 1/2 Assign ... I/Q a.b 0.0 ... 127.7 - - - - - - Y - RLO to input/output 1/2 M a.b 0.0 ... 1023.7 - - - - - 0 Y - 0 RLO to bit memory 1/2 L a.b 0.0 ... 1043.7 RLO to local data bit 2 DBX a.b 0.0 ... 8191.7 RLO to data bit 2 DIX a.b 0.0 ... 8191.7 RLO to instance data bit 2 c [AR1,m] register-indirect, area-internal (AR1) 2 c [AR2,m] register-indirect, area-internal (AR2) 2 [AR1,m] area-crossing (AR1) 2 [AR2,m] area-crossing (AR2) 2 Parameter via parameters 2 HB00E - OPL_STD - Rev. 14/22 - 1-17 Manual VIPA Operation List Standard Chapter 1 Instruction list Command Operand Parameter Status word Function BR CC1 CC0 OV OS OR STA RLO /FC Length in words : Instruction depends on : Instruction influences CLR SET NOT SAVE BR CC1 CC0 OV OS OR STA RLO /FC - - - - - - - - - - 0 0 0 0 - - - - - - Set RLO to "0" 1 Set RLO to "1" 1 Negate RLO 1 Save RLO into BR-Bit 1 - BR CC1 CC0 OV OS OR STA RLO /FC - - - - - - - - - - 0 1 1 0 - BR CC1 CC0 OV OS OR STA RLO /FC - - - - - Y - Y - - - - - - - 1 Y - BR CC1 CC0 OV OS OR STA RLO /FC - 1-18 The following instructions have a directly effect on the RLO. Status word Instructions directly affecting the RLO - - - - - - Y - Y - - - - - - - - HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Command Operand Parameter Chapter 1 Instruction list Status word Function BR CC1 CC0 OV OS OR STA RLO /FC Length in words : Instruction depends on : Instruction influences Jump instructions JU LABEL JC LABEL JCN LABEL JCB LABEL BR CC1 CC0 OV OS OR STA RLO /FC - - - - - - - - - - - - - - - - - - BR CC1 CC0 OV OS OR STA RLO /FC - - - - - - - - - - 0 1 1 0 LABEL - - Jump unconditionally 1/2 Jump if RLO="1" 1/2 - Y - Jump if RLO="0" BR CC1 CC0 OV OS OR STA RLO /FC JNB Jump, depending on conditions. 8-bit operands have a jump width of (-128...+127), 16-bit operands of (-32768...-129) or (+128...+32767) Status word Jump instructions Jump if RLO="1" - - - - Y - - - - 0 1 1 0 Jump if RLO="0" 2 2 - Y - Save the RLO in the BR-bit 2 Save the RLO in the BR-bit JBI LABEL BR CC1 CC0 OV OS OR STA RLO /FC JNBI LABEL Y - - - - - - - - 0 1 - 0 JO JOS LABEL LABEL - - - - Jump if BR="1" 2 - Jump if BR="0" 2 BR CC1 CC0 OV OS OR STA RLO /FC - - - Y - - - - - - - - - - - - - - BR CC1 CC0 OV OS OR STA RLO /FC - - - - Y - - - - - - - - 0 - - - - Jump on stored overflow (OV="1") 1/2 Jump on stored overflow (OS="1") 2 JUO LABEL JZ LABEL - Y Y - - - - - - Jump if result=0 (CC1=0 and CC0=0) 1/2 JP LABEL - - - - - - Jump if result>0 (CC1=1 and CC0=0) 1/2 BR CC1 CC0 OV OS OR STA RLO /FC - - - Jump if "unordered instruction" (CC1=1 and CC0=1) JM LABEL Jump if result<0 (CC1=0 and CC0=1) 1/2 JN LABEL Jump if result≠0 1/2 (CC1=1 and CC0=0) or (CC1=0) and (CC0=1) JMZ LABEL Jump if result≤0 2 (CC1=0 and CC0=1) or (CC1=0 and CC0=0) JPZ LABEL Jump if result≥0 2 (CC1=1 and CC0=0) or (CC1=0 and CC0=0) JL LABEL BR CC1 CC0 OV OS OR STA RLO /FC Jump distributor - - - - - - - - - This instruction is followed by a list of jump instructions - - - - - - - - - The operand is a jump label to subsequent instructions in 2 this list. ACCU1-L contains the number of the jump instruction to be executed LOOP LABEL Decrement ACCU1-L and jump if ACCU1-L _ 0 2 (loop programming) HB00E - OPL_STD - Rev. 14/22 1-19 Manual VIPA Operation List Standard Chapter 1 Instruction list Command Operand Parameter Status word Function BR CC1 CC0 OV OS OR STA RLO /FC Length in words : Instruction depends on : Instruction influences Transfer instructions Transfer instructions T Transfer the contents of ACCU1-LL to... IB a 0 ... 127 input byte 1/2 QB a 0 ... 127 output byte 1/2 PQB a 0 ... 1023 periphery output byte 1/2 MB a 0 ... 1023 bit memory byte 1/2 LB a 0 ... 1043 local data byte 2 DBB a 0 ... 8191 data byte 2 DIB a 0 ... 8191 instance data byte 2 g [AR1,m] register-indirect, area-internal (AR1) 2 g [AR2,m] register-indirect, area-internal (AR2) 2 B [AR1,m] area-crossing (AR1) 2 B [AR2,m] area-crossing (AR2) 2 Parameter via parameters 2 T 1-20 Transfer the contents of ACCU1 into the addressed operand. The status word is not affected. Transfer the contents of ACCU1-L to ... IW 0 ... 126 input word 1/2 QW 0 ... 126 output word 1/2 PQW 0 ... 1022 periphery output word 1/2 MW 0 ... 1022 bit memory word 1/2 LW 0 ... 1042 local data word 2 DBW 0 ... 8190 data word 2 DIW 0 ... 8190 instance data word 2 h [AR1,m] register-indirect, area-internal (AR1) 2 h [AR2,m] register-indirect, area-internal (AR2) 2 W [AR1,m] area-crossing (AR1) 2 W [AR2,m] area-crossing (AR2) 2 Parameter via parameters 2 HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Operand Command Parameter Chapter 1 Instruction list Status word Function BR CC1 CC0 OV OS OR STA RLO /FC Length in words : Instruction depends on : Instruction influences Transfer instructions T Transfer the contents of ACCU1 into the addressed operand. The status word is not affected. Transfer the contents of ACCU1 to... ID 0 ... 124 input double word 1/2 QD 0 ... 124 output double word 1/2 PQD 0 ... 1020 periphery output double word 1/2 MD 0 ... 1020 bit memory double word 1/2 LD 0 ... 1040 local data double word 2 DBD 0 ... 8188 data double word 2 DID 0 ... 8188 instance data double word 2 i [AR1,m] register-indirect, area-internal (AR1) 2 i [AR2,m] register-indirect, area-internal (AR2) 2 D [AR1,m] area-crossing (AR1) 2 D [AR2,m] area-crossing (AR2) 2 Parameter via parameters 2 Load a double word from a memory area or a register into AR1 or AR2. Load and transfer instructions for address register LAR1 Load the contents from... - ACCU1 1 AR2 address register 2 1 DBD a 0 ... 8188 data double word 2 DID a 0 ... 8188 instance data double word 2 32bit constant as pointer 3 LD a 0 ... 1040 local data double word 2 MD a 0 ... 1020 bit memory double word 2 m ... into AR1 LAR2 Load the contents from ... - ACCU1 1 DBD a 0 ... 8188 data double word 2 DID a 0 ... 8188 instance data double word 2 32bit constant as pointer 3 local data double word 2 bit memory double word 2 m LD MD a 0 ... 1040 a 0 ... 1020 ... into AR2 TAR1 Transfer the contents from AR1 to... AR2 ACCU1 1 address register 2 1 a 0 ... 8188 data double word 2 DID a 0 ... 8188 instance data double word 2 LD a 0 ... 1040 local data double word 2 MD a 0 ... 1020 bit memory double word 2 DBD HB00E - OPL_STD - Rev. 14/22 1-21 Manual VIPA Operation List Standard Chapter 1 Instruction list Operand Command Parameter Status word Function BR CC1 CC0 OV OS OR STA RLO /FC Length in words : Instruction depends on : Instruction influences TAR2 Transfer the contents from AR2 to... a data double word 2 DID a 0 ... 8188 instance data double word 2 LD a 0 ... 1040 local data double word 2 MD a 0 ... 1020 bit memory double word 2 Exchange the contents of AR1 and AR2 1 Status word Load and transfer instructions for the status word STW BR CC1 CC0 OV OS OR STA RLO /FC - Y Y Y Y Y 0 0 Y 0 - T 1 DBD TAR L ACCU1 0 ... 8188 STW - - - - - - - - BR CC1 CC0 OV OS OR STA RLO /FC - - - - - - Y Y Y Y Y - Load instructions for DB number and DB length - - - Load status word in ACCU1 Transfer ACCU1 (Bits 8 ... 0) into status word - - Y - Load the number/length of a data block to ACCU1. The old contents of ACCU1 are saved into ACCU2. The condition code bits are not affected L DBNO Load number of data block 1 L DINO Load number of instance data block 1 L DBLG Load length of data block into byte 1 L DILG Load length of instance data block into byte 1 ACCU transfer instructions, increment, decrement CAW - The status word is not affected. Reverse the order of the bytes in ACCU1-L 1 LL, LH becomes LH, LL CAD - Reverse the order of the bytes in ACCU1 1 TAK - Swap the contents of ACCU1 and ACCU2 1 PUSH - The contents of ACCU1 are transferred to ACCU2 1 POP - The contents of ACCU2 are transferred to ACCU1 1 INC 0 ... 255 Increment ACCU1-LL 1 DEC 0 ... 255 Decrement ACCU1-LL 1 LL, LH, HL, HH becomes HH, HL, LH, LL 1-22 HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Operand Command Parameter Chapter 1 Instruction list Status word Function BR CC1 CC0 OV OS OR STA RLO /FC Length in words : Instruction depends on : Instruction influences Data type conversion instructions BTI BTD - - The results of the conversion are in ACCU1. When converting real numbers, the execution time depends on the value. Status word Data type conversion instructions BR CC1 CC0 OV OS OR STA RLO /FC Convert contents of ACCU1 from BCD to integer (16bit) - - - - - - - - - (BCD To Int.) - - - - - - - - - Convert contents of ACCU1 from BCD to integer (32bit). 1 1 (BCD To Doubleint.) DTR - ITD - Convert cont. of ACCU1 from integer (32bit) to Real number 1 (32bit) (Doubleint. To Real) Convert contents of ACCU1 from integer (16bit) to integer 1 (32bit) (Int. To Doubleint) ITB DTB - - BR CC1 CC0 OV OS OR STA RLO /FC - - Convert contents of ACCU1 from integer (16bit) to BCD - - - - - - - 0 ... +/-999 (Int. To BCD) - - - Y Y - - - - Convert contents of ACCU1 from integer (32bit) to BCD 1 1 0 ... +/-9 999 999 (Doubleint. To BCD) RND - RND- - RND+ BR CC1 CC0 OV OS OR STA RLO /FC - - Convert a real number to 32bit integer 1 1 - - - - - - - Convert a real number to 32bit integer - - - Y Y - - - - The number is rounded next hole number - Convert real number to 32bit integer 1 It is rounded up to the next integer TRUNC - Convert real number to 32bit integer 1 The places after the decimal point are truncated Status word Complement creation INVI - INVD - NEGI - NEGD - BR CC1 CC0 OV OS OR STA RLO /FC Forms the ones complement of ACCU1-L - - - - - - - - - Forms the ones complement of ACCU1 - - - - - - - - - BR CC1 CC0 OV OS OR STA RLO /FC - - - - - - Forms the twos complement of ACCU1 (double integer) - Y Y Y Y - - - - HB00E - OPL_STD - Rev. 14/22 - - - Forms the twos complement of ACCU1-L (integer) 1 1 1 1 1-23 Manual VIPA Operation List Standard Chapter 1 Instruction list Operand Command Parameter Status word Function BR CC1 CC0 OV OS OR STA RLO /FC Length in words : Instruction depends on : Instruction influences Comparison instructions Comparing the integer (16bit) in ACCU1-L and ACCU2-L. RLO=1, if condition is satisfied. Status word Comparison instructions with integer (16bit) ==I - ACCU2-L=ACCU1-L 1 <>I - - - ACCU2-L≠ACCU1-L 1 <I - - Y Y 0 - 0 Y Y 1 ACCU2-L<ACCU1-L 1 <=I - ACCU2-L<=ACCU1-L 1 >I - ACCU2-L>ACCU1-L 1 >=I - ACCU2-L>=ACCU1-L 1 BR CC1 CC0 OV OS OR STA RLO /FC - - - - - - - Comparing the integer (32bit) in ACCU1 and ACCU2. RLO=1, if condition is satisfied. Status word Comparison instructions with integer (32bit) ==D - ACCU2=ACCU1 1 <>D - - - ACCU2≠ACCU1 1 <D - - Y Y 0 - 0 Y Y 1 ACCU2<ACCU1 1 <=D - ACCU2<=ACCU1 1 >D - ACCU2>ACCU1 1 >=D - ACCU2>=ACCU1 1 BR CC1 CC0 OV OS OR STA RLO /FC - - - - - - - Comparing the 32bit real numbers in ACCU1 and ACCU2. RLO=1, is condition is satisfied. The execution time of the instruction depends on the value to be compared. Status word Comparison instructions with 32bit real number ==R - ACCU2=ACCU1 1 <>R - - - ACCU2≠ACCU1 1 <R - - Y Y Y Y 0 Y Y 1 ACCU2<ACCU1 1 <=R - BR CC1 CC0 OV OS OR STA RLO /FC - - - - - - - ACCU2<=ACCU1 1 >R - ACCU2>ACCU1 1 >=R - ACCU2>=ACCU1 1 1-24 HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Operand Command Parameter Chapter 1 Instruction list Status word Function BR CC1 CC0 OV OS OR STA RLO /FC Length in words : Instruction depends on : Instruction influences Combination instructions (Bit) Status word Combination instructions with bit operands A BR CC1 CC0 OV OS OR STA RLO /FC Examining the signal state of the addressed instruction and gating the result with the RLO according to the appropriate logic function. AND operation at signal state "1" I/Q a.b 0.0 ... 127.7 - - - - - Y - Y Y Input/output 1/2 M a.b 0.0 ... 1023.7 - - - - - Y Y Y 1 Bit memory 1/2 L a.b 0.0 ... 1043.7 Local data bit 2 DBX a.b 0.0 ... 8191.7 Data bit 2 DIX a.b 0.0 ... 8191.7 Instance data bit 2 c [AR1,m] register-indirect, area-internal (AR1) 2 c [AR2,m] register-indirect, area-internal (AR2) 2 [AR1,m] area-crossing (AR1) 2 [AR2,m] area-crossing (AR2) 2 Parameter via parameters 2 AN BR CC1 CC0 OV OS OR STA RLO /FC AND operation of signal state "0" I/Q a.b 0.0 ... 127.7 - - - - - Y - Y Y Input/output 1/2 M a.b 0.0 ... 1023.7 - - - - - Y Y Y 1 Bit memory 1/2 L a.b 0.0 ... 1043.7 Local data bit 2 DBX a.b 0.0 ... 8191.7 Data bit 2 DIX a.b 0.0 ... 8191.7 Instance data bit 2 c [AR1,m] register-indirect, area-internal (AR1) 2 c [AR2,m] register-indirect, area-internal (AR2) 2 [AR1,m] area-crossing (AR1) 2 [AR2,m] area-crossing (AR2) 2 Parameter via parameters 2 O BR CC1 CC0 OV OS OR STA RLO /FC OR operation at signal state "1" I/Q a.b 0.0 ... 127.7 - - - - - - Y Y Input/output 1/2 M a.b 0.0 ... 1023.7 - - - - - 0 Y Y 1 Bit memory 1/2 a.b 0.0 ... 1043.7 Local data bit 2 DBX a.b 0.0 ... 8191.7 Data bit 2 DIX a.b 0.0 ... 8191.7 Instance data bit 2 c [AR1,m] register-indirect, area-internal (AR1) 2 c [AR2,m] register-indirect, area-internal (AR2) 2 [AR1,m] area-crossing (AR1) 2 [AR2,m] area-crossing (AR2) 2 Parameter via parameters 2 L HB00E - OPL_STD - Rev. 14/22 - 1-25 Manual VIPA Operation List Standard Chapter 1 Instruction list Operand Command Parameter Status word Function BR CC1 CC0 OV OS OR STA RLO /FC Length in words : Instruction depends on : Instruction influences ON BR CC1 CC0 OV OS OR STA RLO /FC I/Q a.b 0.0 ... 127.7 - - - - - - Y Y Input/output 1/2 M a.b 0.0 ... 1023.7 - - - - - 0 Y Y 1 Bit memory 1/2 L a.b 0.0 ... 1043.7 Local data bit 2 DBX a.b 0.0 ... 8191.7 Data bit 2 DIX a.b 0.0 ... 8191.7 Instance data bit 2 c [AR1,m] register-indirect, area-internal (AR1) 2 c [AR2,m] register-indirect, area-internal (AR2) 2 [AR1,m] area-crossing (AR1) 2 [AR2,m] area-crossing (AR2) 2 Parameter via parameters 2 X - BR CC1 CC0 OV OS OR STA RLO /FC EXCLUSIVE-OR operation at signal state "1" I/Q a.b 0.0 ... 127.7 - - - - - - Y Y Input/output 2 M a.b 0.0 ... 1023.7 - - - - - 0 Y Y 1 Bit memory 2 L a.b 0.0 ... 1043.7 Local data bit 2 DBX a.b 0.0 ... 8191.7 data bit 2 DIX a.b 0.0 ... 8191.7 Instance data bit 2 c [AR1,m] register-indirect, area-internal (AR1) 2 c [AR2,m] register-indirect, area-internal (AR2) 2 [AR1,m] area-crossing (AR1) 2 [AR2,m] area-crossing (AR2) 2 Parameter via parameters 2 XN 1-26 OR operation at signal state "0" - BR CC1 CC0 OV OS OR STA RLO /FC EXCLUSIVE-OR operation at signal state "0" I/Q a.b 0.0 ... 127.7 - - - - - - Y Y Input/output 2 M a.b 0.0 ... 1023.7 - - - - - 0 Y Y 1 Bit memory 2 L a.b 0.0 ... 1043.7 Local data bit 2 DBX a.b 0.0 ... 8191.7 Data bit 2 DIX a.b 0.0 ... 8191.7 - Instance data bit 2 c [AR1,m] register-indirect, area-internal (AR1) 2 c [AR2,m] register-indirect, area-internal (AR2) 2 [AR1,m] area-crossing (AR1) 2 [AR2,m] area-crossing (AR2) 2 Parameter via parameters 2 HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Command Operand Parameter Chapter 1 Instruction list Status word Function BR CC1 CC0 OV OS OR STA RLO /FC Length in words : Instruction depends on : Instruction influences Status word Combination instructions with parenthetical expressions A( AN( O( For each block 7 nesting levels are possible. BR CC1 CC0 OV OS OR STA RLO /FC 1 - - - Y - Y Y AND-NOT left parenthesis 1 - - - - 0 1 - 0 OR left parenthesis 1 - OR-NOT left parenthesis X( XN( BR CC1 CC0 OV OS OR STA RLO /FC - - - - - Y - - - - Y 1 Y 1 - BR CC1 CC0 OV OS OR STA RLO /FC EXCLUSIVE-OR left parenthesis 1 EXCLUSIVE-OR-NOT left parenthesis 1 Right parenthesis, popping an entry off the nesting stack, 1 The ORing of AND operations is implemented according the rule: AND before OR. OR operations of AND functions according the rule: - - - - - Y - Y Y AND before OR - - - - - Y 1 - Y HB00E - OPL_STD - Rev. 14/22 1 - Y - gating RLO with the current RLO in the processor. Status word ORing of AND operations O AND left parenthesis Y - ON( ) Saving the bits BR, RLO, OR and a function ID (A, AN, ...) at the nesting stack. 1 1-27 Manual VIPA Operation List Standard Chapter 1 Instruction list Command Operand Parameter Status word Function BR CC1 CC0 OV OS OR STA RLO /FC Length in words : Instruction depends on : Instruction influences Status word Combinations instructions with timer and counters A BR CC1 CC0 OV OS OR STA RLO /FC AND operation at signal state Tf 0 to 255 - - - - - Y - Y Y Timer 1/2 Cf 0 to 255 - - - - - Y Y Y 1 Counter 1/2 Timer para. Timer addressed via parameters Counter para. Counter addressed via parameters AN BR CC1 CC0 OV OS OR STA RLO /FC 2 AND operation at signal state Tf 0 to 255 - - - - - Y - Y Y Timer 1/2 Cf 0 to 255 - - - - - Y Y Y 1 Counter 1/2 Timer para. Timer addressed via parameters Counter para. Counter addressed via parameters O BR CC1 CC0 OV OS OR STA RLO /FC 0 to 255 - - - - - Cf 0 to 255 - - - - - 0 Y Y 1 Counter - - Y Y Timer 1/2 1/2 Timer para. Timer addressed via parameters Counter para. Counter addressed via parameters BR CC1 CC0 OV OS OR STA RLO /FC 0 to 255 - - - - - Cf 0 to 255 - - - - - 0 Y Y 1 Counter - Y Y Timer 1/2 1/2 Timer para. Timer addressed via parameters Counter para. Counter addressed via parameters X BR CC1 CC0 OV OS OR STA RLO /FC 0 to 255 - - - - - Cf 0 to 255 - - - - - 0 Y Y 1 Counter - Y Y Timer 2 2 Timer para. Timer addressed via parameters Counter para. Counter addressed via parameters XN BR CC1 CC0 OV OS OR STA RLO /FC 2 EXCLUSIVE-OR operation at signal state Tf 0 to 255 - - - - - Cf 0 to 255 - - - - - 0 Y Y 1 Counter - 2 EXCLUSIVE-OR operation at signal state Tf - 2 OR operation at signal state Tf - 2 OR operation at signal state Tf ON 1-28 Examining the signal state of the addressed timer/counter an gating the result with the RLO according to the appropriate logic function. - Y Y Timer 2 2 Timer para. Timer addressed via parameters Counter para. Counter addressed via parameters 2 HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Command Operand Parameter Chapter 1 Instruction list Status word Function BR CC1 CC0 OV OS OR STA RLO /FC Length in words : Instruction depends on : Instruction influences Status word Combination instructions using AND, OR and EXCLUSIVE OR A BR CC1 CC0 OV OS OR STA RLO /FC Examining the specified conditions for their signal status, and gating the result with the RLO according to the appropriate function. AND operation at signal state "1" ==0 Y Y Y Y Y Y - Y Y Result=0 (CC1=0) and (CC0=0) 1 >0 - - Y Y Y 1 Result>0 (CC1=1) and (CC0=0) 1 <0 Result<0 (CC1=0) and (CC0=1) 1 <>0 Result≠0 ((CC1=0) and (CC0=1)) or ((CC1=1) and (CC0=0)) 1 <=0 Result<=0 ((CC1=0) and (CC0=1)) or ((CC1=0) and (CC0=0)) 1 >=0 Result>=0 ((CC1=1) and (CC0=0)) or ((CC1=1) and (CC0=0)) 1 UO unordered (CC1=1) and (CC0=1) 1 OS OS=1 1 BR BR=1 1 OV OV=1 1 AN - - - BR CC1 CC0 OV OS OR STA RLO /FC AND operation at signal state "0" ==0 Y Y Y Y Y Y - Y Y Result=0 (CC1=0) and (CC0=0) 1 >0 - (CC1=1) and (CC0=0) 1 (CC1=0) and (CC0=1) 1 - - - - Y Y Y 1 Result>0 <0 Result<0 <>0 Result≠0 ((CC1=0) and (CC0=1)) or ((CC1=1) and (CC0=0)) 1 <=0 Result<=0 ((CC1=0) and (CC0=1)) or ((CC1=0) and (CC0=0)) 1 >=0 Result>=0 ((CC1=1) and (CC0=0)) or ((CC1=1) and (CC0=0)) 1 UO unordered (CC1=1) and (CC0=1) 1 OS OS=0 1 BR BR=0 1 OV OV=0 1 O BR CC1 CC0 OV OS OR STA RLO /FC ==0 Y Y Y Y Y - >0 - - - - Y Y Result=0 (CC1=0) and (CC0=0) 1 - 0 Y Y 1 Result>0 (CC1=1) and (CC0=0) 1 <0 Result<0 (CC1=0) and (CC0=1) 1 <>0 Result≠0 ((CC1=0) and (CC0=1)) or ((CC1=1) and (CC0=0)) 1 <=0 Result<=0 ((CC1=0) and (CC0=1)) or ((CC1=0) and (CC0=0)) 1 >=0 Result>=0 ((CC1=1) and (CC0=0)) or ((CC1=1) and (CC0=0)) 1 UO unordered (CC1=1) and (CC0=1) 1 OS OS=1 1 BR BR=1 1 OV OV=1 1 HB00E - OPL_STD - Rev. 14/22 - OR operation at signal state "1" 1-29 Manual VIPA Operation List Standard Chapter 1 Instruction list Command Operand Parameter Status word Function BR CC1 CC0 OV OS OR STA RLO /FC Length in words : Instruction depends on : Instruction influences ON BR CC1 CC0 OV OS OR STA RLO /FC ==0 Y Y Y Y Y - >0 - - Y Y Result=0 (CC1=0) and (CC0=0) 1 - 0 Y Y 1 Result>0 (CC1=1) and (CC0=0) 1 <0 Result<0 (CC1=0) and (CC0=1) 1 <>0 Result≠0 ((CC1=0) and (CC0=1)) or ((CC1=1) and (CC0=0)) 1 <=0 Result<=0 ((CC1=0) and (CC0=1)) or ((CC1=0) and (CC0=0)) 1 >=0 Result>=0 ((CC1=1) and (CC0=0)) or ((CC1=1) and (CC0=0)) 1 UO unordered (CC1=1) and (CC0=1) 1 OS OS=0 1 BR BR=0 1 OV OV=0 1 X - - - BR CC1 CC0 OV OS OR STA RLO /FC ==0 Y Y Y Y Y - >0 - EXCLUSIVE-OR operation at signal state "1" - Y Y Result=0 (CC1=0) and (CC0=0) 1 - 0 Y Y 1 Result>0 (CC1=1) and (CC0=0) 1 <0 Result<0 (CC1=0) and (CC0=1) 1 <>0 Result≠0 ((CC1=0) and (CC0=1)) or ((CC1=1) and (CC0=0)) 1 <=0 Result<=0 ((CC1=0) and (CC0=1)) or ((CC1=0) and (CC0=0)) 1 >=0 Result>=0 ((CC1=1) and (CC0=0)) or ((CC1=1) and (CC0=0)) 1 UO unordered (CC1=1) and (CC0=1) 1 OS OS=1 1 BR BR=1 1 OV OV=1 1 XN 1-30 OR operation at signal state "0" - - - BR CC1 CC0 OV OS OR STA RLO /FC ==0 Y Y Y Y Y - >0 - EXCLUSIVE-OR operation at signal state "0" - Y Y Result=0 (CC1=0) and (CC0=0) 1 - 0 Y Y 1 Result>0 (CC1=1) and (CC0=0) 1 <0 Result<0 (CC1=0) and (CC0=1) 1 <>0 Result≠0 ((CC1=0) and (CC0=1)) or ((CC1=1) and (CC0=0)) 1 <=0 Result<=0 ((CC1=0) and (CC0=1)) or ((CC1=0) and (CC0=0)) 1 >=0 Result>=0 ((CC1=1) and (CC0=0)) or ((CC1=1) and (CC0=0)) 1 UO unordered (CC1=1) and (CC0=1) 1 OS OS=0 1 BR BR=0 1 OV OV=0 1 - - - HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Command Operand Parameter Chapter 1 Instruction list Status word Function BR CC1 CC0 OV OS OR STA RLO /FC Length in words : Instruction depends on : Instruction influences Combination instructions (Word) AW AW BR CC1 CC0 OV OS OR STA RLO /FC k16 - OW OW Gating the contents of ACCU1 and/or ACCU1-L with a word or double word according to the appropriate function. The word or double word is either a constant in the instruction or in ACCU2. The result is in ACCU1 and/or ACCU1-L. Status word Combination instructions with the contents of ACCU1 - - - - - - - AND 16bit constant 2 - Y 0 0 - - - - - OR ACCU2-L 1 k16 k16 AD AD k32 OD OD k32 XOD XOD 1 - XOW XOW AND ACCU2-L k32 OR 16bit constant 2 EXCLUSIVE OR ACCU2-L 1 EXCLUSIVE OR 16bit constant 2 AND ACCU2 1 AND 32bit constant 3 OR ACCU2 1 OR 32bit constant 3 EXCLUSIVE OR ACCU2 1 EXCLUSIVE OR 32bit constant 3 Timer instructions Starting or resetting a timer (addressed directly or via parameters). Status word Time instructions The time value must be in ACCU1-L. SP Tf 0 ... 255 Timer para. SE Tf 0 ... 255 BR CC1 CC0 OV OS OR STA RLO /FC - - - - - - - - - - 0 - Timer para. SD Tf - Start time as pulse on edge change from "0" to "1" - Y - 2 - 0 Start timer as extended pulse on edge change from "0" to "1" 0 ... 255 Start timer as ON delay on edge change from "0" to "1" Timer para. SS Tf Tf 0 ... 255 Start timer as saving start delay on edge change from "0" to "1" Tf Tf 1/2 1/2 2 Start timer as OFF delay on edge change from "1" to "0" 1/2 0 ... 255 Enable timer for restarting on edge change from "0" to "1" 1/2 2 Timer para. R 2 0 ... 255 Timer para. FR 1/2 2 Timer para. SA 1/2 (reset edge bit memory for starting timer) 0 ... 255 Timer para. HB00E - OPL_STD - Rev. 14/22 Reset timer 2 1/2 2 1-31 Manual VIPA Operation List Standard Chapter 1 Instruction list Command Operand Parameter Status word Function BR CC1 CC0 OV OS OR STA RLO /FC Length in words : Instruction depends on : Instruction influences Counter instructions S Cf 0 ... 255 Counter para. R Cf 0 ... 255 The counter value is in ACCU1-L res. in the address transferred as parameter. Status word Counter instructions BR CC1 CC0 OV OS OR STA RLO /FC - - - - - - - - - - - 0 - Presetting of counter on edge change from "0" to "1" - Y - 2 - 0 Reset counter to "0" 1/2 Counter para. CU Cf CD Cf 2 0 ... 255 Increment counter by 1 on edge change from "0" to "1" 1/2 0 ... 255 Decrement counter by 1 on edge change from "0" to "1" 1/2 Counter para. 2 Counter para. FR Cf Counter para. 1-32 1/2 2 0 ... 255 Enable counter on edge change from "0" to "1" (reset the edge bit memory for up and down counting) 1/2 2 HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Chapter 2 Organization Blocks Chapter 2 Organization Blocks Overview Here the description of the integrated organization blocks of the VIPA standard CPUs of Systems 100V, 200V, 300V and 500V may be found. Content Topic Page Organization Blocks ....................................................... 2-1 Chapter 2 Overview .............................................................................................. 2-2 OB 1 - Main program............................................................................ 2-3 OB 10 - Time-of-day Interrupt .............................................................. 2-5 OB 20 - Time-delay Interrupt ................................................................ 2-7 OB 35 - Watchdog Interrupt ................................................................. 2-8 OB 40 - Hardware Interrupt .................................................................. 2-9 OB 80 - Time Error............................................................................. 2-11 OB 81 - Power supply Error................................................................ 2-14 OB 82 - Diagnostic Interrupt............................................................... 2-15 OB 85 - Program execution Error ....................................................... 2-17 OB 86 - Slave Failure / Restart........................................................... 2-21 OB 100 - Reboot ................................................................................ 2-23 OB 121 - Programming Error (Synchronous error) ............................. 2-25 OB 122 - Periphery access Error........................................................ 2-28 HB00E - OPL_STD - Rev. 14/22 2-1 Chapter 2 Organization Blocks Manual VIPA Operation List Standard Overview General OBs (Organization blocks) are the interface between the operating system of the CPU and the user program. For the main program OB 1 is used. There are reserved numbers corresponding to the call event of the other OBs. Organization blocks are executed corresponding to their priority. OBs are used to execute specific program sections: • at the startup of the CPU • in a cyclic or clocked execution • whenever errors occur • whenever hardware interrupts occur Integrated OBs The following organization blocks (OBs) are available: OB OB 1 OB 10 OB 20 OB 35 OB 40 OB 80 OB 81 OB 82 OB 85 OB 86 OB 100 OB 121 OB 122 2-2 Description Free cycle Time-of-day interrupt Time-delay interrupt Watchdog interrupt Hardware interrupt Time error (cycle time exceeded or clock alarm run out) Power supply fault Diagnostics interrupt Program execution error (OB not available or Periphery error at update process image) Slave failure / restart Restart Programming error (synchronous error) Periphery access error HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Chapter 2 Organization Blocks OB 1 - Main program Description The operating system of the CPU executes OB 1 cyclically. After STARTUP to RUN the cyclical processing of the OB 1 is started. OB 1 has the lowest priority (priority 1) of each cycle time monitored OB. Within the OB 1 functions and function blocks can be called. Function When OB 1 has been executed, the operating system sends global data. Before restarting OB 1, the operating system writes the process-image output table to the output modules, updates the process-image input table and receives any global data for the CPU. Cycle time Cycle time is the time required for processing the OB 1. It also includes the scan time for higher priority classes which interrupt the main program respectively communication processes of the operating system. This comprises system control of the cyclic program scanning, process image update and refresh of the time functions. By means of the Siemens SIMATIC manager the recent cycle time of an online connected CPU may be shown. With PLC > Module Information > Scan cycle time the min., max. and recent cycle time can be displayed. Scan cycle monitoring time The CPU offers a scan cycle watchdog for the max. cycle time. The default value for the max. cycle time is 150ms as scan cycle monitoring time. This value can be reconfigured or restarted by means of the SFC 43 (RE_TRIGR) at every position of your program. If the main program takes longer to scan than the specified scan cycle monitoring time, the OB 80 (Timeout) is called by the CPU. If OB 80 has not been programmed, the CPU goes to STOP. Besides the monitoring of the max. cycle time the observance of the min cycle time can be guaranteed. Here the restart of a new cycle (writing of process image of the outputs) is delayed by the CPU as long as the min. cycle time is reached. Access to local data The CPU's operating system forwards start information to OB 1, as it does to every OB, in the first 20 bytes of temporary local data. The start information can be accessed by means of the system function SFC 6 RD_SINFO. Note that direct reading of the start information for an OB is possible only in that OB because that information consists of temporary local data. More information can be found at chapter "Integrated standard SFCs". HB00E - OPL_STD - Rev. 14/22 2-3 Chapter 2 Organization Blocks Manual VIPA Operation List Standard Local data The following table describes the start information of the OB 1 with default names of the variables and its data types: Variable OB1_EV_CLASS Type BYTE OB1_SCAN_1 OB1_PRIORITY OB1_OB_NUMBR OB1_RESERVED_1 OB1_RESERVED_2 OB1_PREV_CYCLE OB1_MIN_CYCLE OB1_MAX_CYCLE OB1_DATE_TIME 2-4 Description Event class and identifiers: 11h: OB 1 active BYTE 01h: completion of a restart 03h: completion of the main cycle BYTE Priority class: 1 BYTE OB number (01) BYTE reserved BYTE reserved INT Run time of previous cycle (ms) INT Minimum cycle time (ms) since the last startup INT Maximum cycle time (ms) since the last startup DATE_AND_TIME Date and time of day when the OB was called HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Chapter 2 Organization Blocks OB 10 - Time-of-day Interrupt Description The time-of-day interrupt is used when you want to run a program at a particular time, either once only or periodically. The time-of-day interrupt can be configured within the hardware configuration or controlled by means of system functions in your main program at run time. The prerequisite for proper handling of the time-of-day interrupt is a correctly set real-time clock on the CPU. For execution there are the following intervals: • once • every minute • hourly • daily • weekly • monthly • once at year • at the end of each month Note! For monthly execution of the time-of-day interrupt OB, only the day 1, 2, ...28 can be used as a starting date. Function To start the time-of-day interrupt, you must first set and than activate the interrupt. The three following start possibilities exist: • The time-of-day interrupt is configured via the hardware configuration. Open the selected CPU with Edit > Object properties > Time-of-Day interrupts. Here the time-of-day interrupt may be adjusted and activated. After transmission to CPU and startup the monitoring of timeof-day interrupt is automatically started. • Set the time-of-day interrupt within the hardware configuration as shown above and then activate it by calling SFC 30 ACT_TINT in your program. • You set the time-of-day interrupt by calling SFC 28 SET_TINT and then activate it by calling SFC 30 ACT_TINT. The time-of-day interrupt can be delayed and enabled with the system functions SFC 41 DIS_AIRT and SFC 42 EN_AIRT. Behavior on error If the time-of-day interrupt OB is called but was not programmed, the operating system calls OB 85. If OB 85 was not programmed, the CPU goes to STOP. Is there an error at time-of-day interrupt processing e.g. start time has already passed, the time error OB 80 is called. The time-ofday interrupt OB is then executed precisely once. HB00E - OPL_STD - Rev. 14/22 2-5 Chapter 2 Organization Blocks Possibilities of activation The possibilities of activation of the time-of-day interrupt is shown at the following table: Interval Not activated Activated once only Activated periodically Local data for time-of-day interrupt OB Variable OB10_EV_CLASS OB10_STRT_INFO OB10_PRIORITY OB10_OB_NUMBR OB10_RESERVED_1 OB10_RESERVED_2 OB10_PERIOD_EXE OB10_RESERVED_3 OB10_RESERVED_4 OB10_DATE_TIME Manual VIPA Operation List Standard Description The time-of-day interrupt is not executed, even when loaded in the CPU. It may be activated by calling SFC 30. The time-of-day OB is cancelled automatically after it runs the one time specified. Your program can use SFC 28 and SFC 30 to reset and reactivate the OB. When the time-of-day interrupt occurs, the CPU calculates the next start time for the time-of-day interrupt based on the current time of day and the period. The following table describes the start information of the OB 10 with default names of the variables and its data types: Type BYTE Description Event class and identifiers: 11h: interrupt is active BYTE 11h: Start request for OB 10 BYTE Assigned priority class: default 2 BYTE OB number (10) BYTE reserved BYTE reserved WORD The OB is executed at the specified intervals: 0000h: once 0201h: once every minute 0401h: once hourly 1001h: once daily 1201h: once weekly 1401h: once monthly 1801h: once yearly 2001h: end of month INT reserved INT reserved DATE_AND_TIME Date and time of day when the OB was called Information to access the local data can be found at the description of the OB 1. 2-6 HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Chapter 2 Organization Blocks OB 20 - Time-delay Interrupt Description The time-delay interrupt allows you to implement a delay timer independently of the standard timers. The time-delay interrupts can be configured within the hardware configuration respectively controlled by means of system functions in your main program at run time. Activation For the activation no hardware configuration is necessary. The time-delay interrupt is started by calling SFC 32 SRT_DINT and by transferring the corresponding OB to the CPU. Here the function needs OB no., delay time and a sign. When the delay interval has expired, the respective OB is called by the operating system. The time-delay interrupt that is just not activated can be cancelled with SFC 33 CAN_DINT respectively by means of the SFC 34 QRY_DINT the status can be queried. More information for using the SFCs can be found at chapter "Integrated standard SFCs". The priority of the corresponding OBs are changed via the hardware configuration. For this open the selected CPU with Edit > Object properties > Interrupts. Here the corresponding priority can be adjusted. Behavior on error If the time-delay interrupt OB is called but was not programmed, the operating system calls OB 85. If OB 85 was not programmed, the CPU goes to STOP. Is there an error at time-delay interrupt processing e.g. delay interval has expired and the associated OB is still executing, the time error OB 80 is called. The time-of-day interrupt OB is then executed. If there is no OB 80 in the user program the CPU goes to STOP Local data The following table describes the start information of the OB 20 and 21 with default names of the variables and its data types: Variable OB20_EV_CLASS Type BYTE Description Event class and identifiers: 11h: interrupt is active OB20_STRT_INF BYTE 21h: start request for OB 20 OB20_PRIORITY BYTE assigned priority class: Default 3 (OB 20) OB20_OB_NUMBR BYTE OB number (20) OB20_RESERVED_1 BYTE reserved OB20_RESERVED_2 BYTE reserved OB20_SIGN WORD User ID: input parameter SIGN from the call for SFC 32 (SRT_DINT) OB20_DTIME TIME Configured delay time in ms OB20_DATE_TIME DATE_AND_TIME Date and time of day when the OB was called Information to access the local data can be found at the description of the OB 1. HB00E - OPL_STD - Rev. 14/22 2-7 Chapter 2 Organization Blocks Manual VIPA Operation List Standard OB 35 - Watchdog Interrupt Description By means of the watchdog interrupt the cyclical processing can be interrupted in equidistant time intervals. The start time of the time interval and the phase offset is the instant of transition from STARTUP to RUN after execution of OB 100. Watchdog interrupt OB OB 35 Default time interval 100ms Default priority class 12 Activation The watchdog interrupt is activated by programming the OB 35 within the CPU. The watchdog interrupt can be delayed and enabled with the system functions SFC 41 DIS_AIRT and SFC 42 EN_AIRT. Function After STARTUP to RUN the activated watchdog OB is called in the configured equidistant intervals. So a sub program can be called time controlled by programming the OB 35. Local data The following table describes the start information of the OB 35 with default names of the variables and its data types: Variable OB35_EV_CLASS Type BYTE OB35_STRT_INF OB35_PRIORITY OB35_OB_NUMBR OB35_RESERVED_1 OB35_RESERVED_2 OB35_PHASE_OFFSET OB35_RESERVED_3 OB35_EXT_FREQ OB35_DATE_TIME Description Event class and identifiers: 11h: Cyclic interrupt is active BYTE 36h: Start request for OB 35 BYTE Assigned priority class; Defaults: 12 (OB 35) BYTE OB number (35) BYTE reserved BYTE reserved WORD Phase offset in ms INT reserved INT Interval in ms DATE_AND_TIME Date and time of day when the OB was called Information to access the local data can be found at the description of the OB 1. 2-8 HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Chapter 2 Organization Blocks OB 40 - Hardware Interrupt Description Within the configuration you specify for each module, which channels release a hardware interrupt during which conditions. With the system functions SFC 55 WR_PARM, SFC 56 WR_DPARM and SFC 57 PARM_MOD you can (re)parameterize the modules with hardware interrupt capability even in RUN. Activation The hardware interrupt processing of the CPU is always active. So that a module can release a hardware interrupt, you have to activate the hardware interrupt on the appropriate module by a hardware configuration. Here you can specify whether the hardware interrupt should be generated for a coming event, a leaving event or both. Function After a hardware interrupt has been triggered by the module, the operating system identifies the slot and the corresponding hardware interrupt OB. If this OB has a higher priority than the currently active priority class, it will be started. The channel-specific acknowledgement is sent after this hardware interrupt OB has been executed. If another event that triggers a hardware interrupt occurs on the same module during the time between identification and acknowledgement of a hardware interrupt, the following applies: • If the event occurs on the channel that previously triggered the hardware interrupt, then the new interrupt is lost. • If the event occurs on another channel of the same module, then no hardware interrupt can currently be triggered. This interrupt, however, is not lost, but is triggered if just active after the acknowledgement of the currently active hardware interrupt. Else it is lost. • If a hardware interrupt is triggered and its OB is currently active due to a hardware interrupt from another module, the new request can be processed only if it is still active after acknowledgement. During STARTUP there is no hardware interrupt produced. The treatment of interrupts starts with the transition to operating mode RUN. Hardware interrupts during transition to RUN are lost. Behavior on error If a hardware interrupt is generated for which there is no hardware interrupt OB in the user program, OB 85 is called by the operating system. The hardware interrupt is acknowledged. If OB 85 has not been programmed, the CPU goes to STOP. HB00E - OPL_STD - Rev. 14/22 2-9 Chapter 2 Organization Blocks Manual VIPA Operation List Standard Diagnostic interrupt While the treatment of a hardware interrupt a diagnostic interrupt can be released. Is there, during the time of releasing the hardware interrupt up to its acknowledgement, on the same channel a further hardware interrupt, the loss of the hardware interrupt is announced by means of a diagnostic interrupt for system diagnostics. Local data The following table describes the start information of the OB 40 with default names of the variables and its data types: Variable OB40_EV_CLASS Type BYTE OB40_STRT_INF BYTE OB40_PRIORITY BYTE OB40_OB_NUMBR BYTE OB40_RESERVED_1 BYTE OB40_IO_FLAG BYTE OB40_MDL_ADDR WORD OB40_POINT_ADDR DWORD OB40_DATE_TIME DATE_AND_TI ME Description Event class and identifiers: 11h: Interrupt is active At CPU 112: The OB start information depends on the line, which the interrupt has triggered. 41h: E0.0 42h: E0.1 43h: E0.2 44h: E0.3 Other CPUs 11x and CC03: 40h: Interrupt inputs E0.0 ... E0.3 41h: Interrupt sources at V-bus (ext. plugged modules) At System 200V and 300V: 41h: Interrupt via interrupt line 1 Assigned priority class: Default: 16 (OB 40) OB number (40) reserved 54h: Input module 55h: Output module Logical base address of the module that triggers the interrupt For digital modules: bit field with the statuses of the inputs on the module (Bit 0 corresponds to the first input). For analog modules: bit field, informing which channel has exceeded which limit. For CPs or IMs: Module interrupt status (not user relevant). Date and time of day when the OB was called. Information to access the local data can be found at the description of the OB 1. 2-10 HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Chapter 2 Organization Blocks OB 80 - Time Error Description The operating system of the CPU calls OB 80 whenever an error occurs like: • Cycle monitoring time exceeded • OB request error i.e. the requested OB is still executed or an OB was requested too frequently within a given priority class. • Time-of-day interrupt error i.e. interrupt time past because clock was set forward or after transition to RUN. The time error OB can be delayed by SFC 41 and released by SFC 42. Note! If OB 80 has not been programmed, the CPU changes to the STOP mode. If OB 80 is called twice during the same scan cycle due to the scan time being exceeded, the CPU changes to the STOP mode. You can prevent this by calling SFC 43 RE_TRIGR at a suitable point in the program. Local data Variable OB80_EV_CLASS OB80_FLT_ID The following table describes the start information of the OB 80 with default names of the variables and its data types: Type BYTE BYTE Description Event class and identifiers: 35h Error code (possible values: 01h, 02h, 05h, 06h, 07h, 08h, 09h, 0Ah) OB80_PRIORITY BYTE Priority class: 26 (RUN mode) 28 (Overflow of the OB request buffer) OB80_OB_NUMBR BYTE OB number (80) OB80_RESERVED_1 BYTE reserved OB80_RESERVED_2 BYTE reserved OB80_ERROR_INFO WORD Error information: depending on error code OB80_ERR_EV_CLASS BYTE Event class for the start event that caused the error OB80_ERR_EV_NUM BYTE Event number for the start event that caused the error OB80_OB_PRIORITY BYTE Error information: depending on error code OB80_OB_NUM BYTE Error information: depending on error code OB80_DATE_TIME DATE_AND_TIME Date and time of day when the OB was called Information to access the local data can be found at the description of the OB 1. HB00E - OPL_STD - Rev. 14/22 2-11 Manual VIPA Operation List Standard Chapter 2 Organization Blocks Variables depending on error code Error code 01h The variables dependent on the error code have the following allocation: Variable Bit OB80_ERROR_INFO OB80_ERR_EV_CLASS OB80_ERR_EV_NUM OB80_OB_PRIORITY OB80_OB_NUM 02h OB80_ERROR_INFO OB80_ERR_EV_CLASS OB80_ERR_EV_NUM OB80_OB_PRIORITY OB80_OB_NUM 05h and 06h OB80_ERROR_INFO Bit 0 = "1" ... Bit 7 = "1" Bit 15 ... 8 OB80_ERR_EV_CLASS OB80_ERR_EV_NUM OB80_OB_PRIORITY OB80_OB_NUM 2-12 Description Cycle time exceeded Run time of last scan cycle (ms) Class of the event that triggered the interrupt Number of the event that triggered the interrupt Priority class of the OB which was being executed when the error occurred Number of the OB which was being executed when the error occurred The called OB is still being executed The respective temporary variable of the called block which is determined by OB80_ERR_EV_CLASS and OB80_ERR_EV_NUM Class of the event that triggered the interrupt Number of the event that triggered the interrupt Priority class of the OB causing the error Number of the OB causing the error Elapsed time-of-day interrupt due to moving the clock forward Elapsed time-of-day interrupt on return to RUN after HOLD The start time for time-of-day interrupt 0 is in the past ... The start time for time-of-day interrupt 7 is in the past Not used Not used Not used Not used Not used continued ... HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard ... continue error code Error code Variable 07h meaning of the parameters see error code 02h 08h 09h 0Ah OB80_ERROR_INFO HB00E - OPL_STD - Rev. 14/22 Chapter 2 Organization Blocks Bit Description Overflow of OB request buffer for the current priority class (Each OB start request for a priority class will be entered in the corresponding OB request buffer; after completion of the OB the entry will be deleted. If there are more OB start requests for a priority class than the maximum permitted number of entries in the corresponding Ob request buffer OB 80 will be called with error code 07h) Synchronous-cycle interrupt time error Interrupt loss due to high interrupt load Resume RUN after CiR (Configuration in RUN) CiR synchronizations time in ms 2-13 Chapter 2 Organization Blocks Manual VIPA Operation List Standard OB 81 - Power supply Error Description The operating system of the CPU calls OB 81 whenever an event occurs that is triggered by an error or fault related to the power supply (when entering and when outgoing event). The CPU does not change to the STOP mode if OB 81 is not programmed. You can disable or delay and re-enable the power supply error OB using SFCs 39 ... 42. Local Data The following table describes the start information of the OB 81 with default names of the variables and its data types: Variable OB81_EV_CLASS OB81_FLT_ID OB81_PRIORITY OB81_OB_NUMBR OB81_RESERVED_1 OB81_RESERVED_2 OB81_RACK_CPU OB81_RESERVED_3 OB81_RESERVED_4 OB81_RESERVED_5 OB81_RESERVED_6 OB80_DATE_TIME Data type BYTE Description Event class and identifiers: 39h: incoming event BYTE Error code: 22h: Back-up voltage missing BYTE Priority class: 28 (mode STARTUP) BYTE OB-NR. (81) BYTE reserved BYTE reserved WORD Bit 2 ... 0: 000 (Rack number) Bit 3: 1 (master CPU) Bit 7 ... 4: 1111 (fix) BYTE reserved BYTE reserved BYTE reserved BYTE reserved DATE_AND_TIME Date and time of day when the OB was called Information to access the local data can be found at the description of the OB 1. 2-14 HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Chapter 2 Organization Blocks OB 82 - Diagnostic Interrupt Description The system diagnostic is the detection, evaluation and reporting of messages which occur within a PLC system. Examples of errors for these messages could be errors in the user program, module failures or wire breaks on signaling modules. If a module with diagnostic capability for which you have enabled the diagnostic interrupt detects an error, it outputs a request for a diagnostic interrupt to the CPU (when entering and outgoing event). The operating system then calls OB82. The local variables of OB82 contain the logical base address as well as four bytes of diagnostic data of the defective module. If OB82 has not been programmed, the CPU changes to the STOP mode. You can delay and re-enable the diagnostic interrupt OB using SFC 41 DIS_AIRT and SFC 42 EN_AIRT. Diagnostic in ring buffer All diagnostic events reported to the CPU operating system are entered in the diagnostic buffer in the order in which they occurred, and with date and time stamp. This is a buffered memory area on the CPU that retains its contents even in the event of a memory reset. The diagnostic buffer is a ring buffer with. VIPA CPUs offer space for 100 entries. When the diagnostic buffer is full, the oldest entry is overwritten by the newest. By use of the PLC functions of the Siemens SIMATIC manager the diagnostic buffer can be queried. Besides of the standard entries in the diagnostic buffer, the VIPA CPUs support some additional specific entries in form of event-IDs. More information may be found at the manual of the CPU at the chapter "Deployment of the CPU ..." at "VIPA specific diagnostic entries". Configurable Diagnostics Programmable diagnostic events are reported only when you have set the parameters necessary to enable diagnostics. Non-programmable diagnostics events are always reported, regardless of whether or not diagnostics have been enabled. Write diagnostics user entry with SFC A diagnostic entry can be written to the diagnostic buffer by means of the system function SFC 52 WR_USMSG. More information can be found at chapter "Integrated standard SFCs". Read diagnostic data with SFC 59 You can use system function SFC 59 RD_REC (read record set) in OB 82 to obtain detailed error information. The diagnostic information are consistent until OB 82 is exited, that is, they remain "frozen". Exiting of OB 82 acknowledges the diagnostic interrupt on the module. The module's diagnostic data is in record sets DS 0 and DS 1. The record set DS 0 contains 4 byte of diagnostic data describing the current status of the module. The contents of these 4 byte are identical to the contents of byte 8 ... 11 of the OB 82 start information Record set DS 1 contains the 4 byte from record set DS 0 and, in addition, the module specific diagnostic data. More information about module specific diagnostic data can be found at the description of the appropriate module. HB00E - OPL_STD - Rev. 14/22 2-15 Chapter 2 Organization Blocks Local data Variable OB82_EV_CLASS Manual VIPA Operation List Standard The following table describes the start information of the OB 82 with default names of the variables and its data types: Data type BYTE Description Event class and identifiers: 38h: outgoing event 39h: incoming event OB82_FLT_ID BYTE Error code (42h) OB82_PRIORITY BYTE Priority class: can be assigned via hardware configuration OB82_OB_NUMBR BYTE OB number (82) OB82_RESERVED_1 BYTE reserved OB82_IO_FLAG BYTE Input Module 54h Output Module 55h OB82_MDL_ADDR INT Logical base address of the module where the fault occurred OB82_MDL_DEFECT BOOL Module is defective OB82_INT_FAULT BOOL Internal fault OB82_EXT_FAULT BOOL External fault OB82_PNT_INFO BOOL Channel fault OB82_EXT_VOLTAGE BOOL External voltage failed OB82_FLD_CONNCTR BOOL Front panel connector not plugged in OB82_NO_CONFIG BOOL Module is not configured OB82_CONFIG_ERR BOOL Incorrect parameters on module OB82_MDL_TYPE BYTE Bit 3 ... 0: Module class Bit 4: Channel information exists Bit 5: User information exists Bit 6: Diagnostic interrupt from substitute Bit 7: Reserved OB82_SUB_MDL_ERR BOOL Submodule is missing or has an error OB82_COMM_FAULT BOOL Communication failure OB82_MDL_STOP BOOL Operating mode (0: RUN, 1:STOP) OB82_WTCH_DOG_FLT BOOL Watchdog timer responded OB82_INT_PS_FLT BOOL Internal power supply failed OB82_PRIM_BATT_FLT BOOL Battery exhausted OB82_BCKUP_BATT_FLT BOOL Entire backup failed OB82_RESERVED_2 BOOL Reserved OB82_RACK_FLT BOOL Expansion rack failure OB82_PROC_FLT BOOL Processor failure OB82_EPROM_FLT BOOL EPROM fault OB82_RAM_FLT BOOL RAM fault OB82_ADU_FLT BOOL ADC/DAC error OB82_FUSE_FLT BOOL Fuse tripped OB82_HW_INTR_FLT BOOL Hardware interrupt lost OB82_RESERVED_3 BOOL Reserved OB82_DATE_TIME DATE_AND_TIME Date and time of day when the OB was called Information to access the local data can be found at the description of the OB 1. 2-16 HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Chapter 2 Organization Blocks OB 85 - Program execution Error Description The operating system of the CPU calls OB 85 whenever one of the following events occurs: • Start event for an OB that has not been loaded • Error when the operating system accesses a block • I/O access error during update of the process image by the system (if the OB 85 call was not suppressed due to the configuration) The OB 85 may be delayed by means of the SFC 41 and re-enabled by the SFC 42. Note! If OB 85 has not been programmed, the CPU changes to STOP mode when one of these events is detected. Local data Variable OB85_EV_CLASS The following table describes the start information of the OB 85 with default names of the variables and its data types: Type BYTE Description Event class and identifiers: 35h 38h (only with error code B3h, B4h) 39h (only with error code B1h, B2h, B3h, B4h) OB85_FLT_ID BYTE Error code (possible values: A1h, A2h, A3h, A4h, B1h, B2h, B3h, B4h) OB85_PRIORITY BYTE Priority class: 26 (Default value mode RUN) 28 (mode ANLAUF) OB85_OB_NUMBR BYTE OB number (85) OB85_RESERVED_1 BYTE reserved OB85_RESERVED_2 BYTE reserved OB85_RESERVED_3 INT reserved OB85_ERR_EV_CLASS BYTE Class of the event that caused the error OB85_ERR_EV_NUM BYTE Number of the event that caused the error OB85_OB_PRIOR BYTE Priority class of the OB that was active when the error occurred OB85_OB_NUM BYTE Number of the OB that was active when the error occurred OB85_DATE_TIME DATE_AND_TIME Date and time of day when the OB was called Information to access the local data can be found at the description of the OB 1. HB00E - OPL_STD - Rev. 14/22 2-17 Manual VIPA Operation List Standard Chapter 2 Organization Blocks OB 85 dependent on error codes If you want to program OB 85 dependent on the possible error codes, we recommend that you organize the local variables as follows: Variable OB85_EV_CLASS OB85_FLT_ID OB85_PRIORITY OB85_OB_NUMBR OB85_DKZ23 OB85_RESERVED_2 OB85_Z1 OB85_Z23 OB85_DATE_TIME Type BYTE BYTE BYTE BYTE BYTE BYTE WORD DWORD DATE_AND_TIME The following table shows the event that started OB 85: OB85_EV_CLASS OB85_FLT_ID 35h A1h, A2h 35h Variable A1h, A2h OB85_Z1 A1h, A2h OB85_Z23 A3h OB85_Z1 2-18 Description As a result of your configuration your program or the operating system creates a start event for an OB that is not loaded on the CPU. The respective local variable of the called OB that is determined by OB85_Z23. high word: Class and number of the event causing the OB call low word, high byte: Program level and OB active at the time of error low word, low byte: Active OB Error when the operating system accesses a module Error ID of the operating system high byte: 1: Integrated function 2: IEC-Timer low byte: 0: no error resolution 1: block not loaded 2: area length error 3: write-protect error continued ... HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard ... continue OB85_EV_CLASS OB85_FLT_ID 35h 34h 39h A4h A4h B1h Chapter 2 Organization Blocks Variable OB85_Z23 Description high word: block number low word: Relative address of the MC7 command causing the error. The block type must be taken from OB85_DKZ23. (88h: OB, 8Ch: FC, 8Eh: FB, 8Ah: DB) PROFINET DB cannot be addressed PROFINET DB can be addressed again I/O access error when updating the process image of the inputs B2h I/O access error when transferring the output process image to the output modules B1h, B2h OB85_DKZ23 ID of the type of process image transfer where the I/O access error happened. 10: Byte access 20: Word access 30: DWord access 57h: Transmitting a configured consistency range B1h, B2h OB85_Z1 Reserved for internal use by the CPU: logical base address of the module If OB85_RESERVED_2 has the value 76h OB85_Z1 receives the return value of the affected SFC B1h, B2h OB85_Z23 Byte 0: Part process image number Byte 1: Irrelevant, if OB85_DKZ23=10, 20 or 30 OB85_DKZ23=57: Length of the consistency range in bytes Byte 2, 3 The I/O address causing the PII, if OB85_DKZ23=10, 20 or 30 OB85_DKZ23=57: Logical start address of the consistency range You obtain the error codes B1h and B2h if you have configured the repeated OB 85 call of I/O access errors for the system process image table update. continued ... HB00E - OPL_STD - Rev. 14/22 2-19 Manual VIPA Operation List Standard Chapter 2 Organization Blocks ... continue OB85_EV_CLASS OB85_FLT_ID 38h, 39h B3h Description I/O access error when updating the process image of the inputs, incoming/outgoing event 38h, 39h B4h I/O access error when updating the process image of the outputs, incoming/outgoing event B3h, B4h OB85_DKZ23 ID of the type of process image transfer during which the I/O access error has occurred 10: Byte access 20: Word access 30: DWord access 57h: Transmitting a configured consistency range B3h, B4h OB85_Z1 Reserved for internal use by the CPU: logical base address of the module If OB85_RESERVED_2 has the value 76h OB85_Z1 receives the return value of the affected SFC B3h, B4h OB85_Z23 Byte 0: Part process image number Byte 1: Irrelevant, if OB85_DKZ23=10, 20 or 30 OB85_DKZ23=57: Length of the consistency range in bytes Byte 2, 3 The I/O address causing the PII, if OB85_DKZ23=10, 20 or 30 OB85_DKZ23=57: Logical start address of the consistency range You obtain the error codes B3h or B4h, if you configured the OB 85 call of I/O access errors entering and outgoing event for process image table updating by the system. After a restart, all access to non-existing inputs and outputs will be reported as I/O access errors during the next process table updating. 2-20 Variable HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Chapter 2 Organization Blocks OB 86 - Slave Failure / Restart Description The operating system of the CPU calls OB 86 whenever the failure of a slave is detected (both when entering and outgoing event). Note! If OB 86 has not been programmed, the CPU changes to the STOP mode when this type of error is detected. The OB 86 may be delayed by means of the SFC 41 and re-enabled by the SFC 42. Local data The following table describes the start information of the OB 86 with default names of the variables and its data types: Variable OB86_EV_CLASS Type BYTE OB86_FLT_ID BYTE OB86_PRIORITY BYTE OB86_OB_NUMBR OB86_RESERVED_1 OB86_RESERVED_2 OB86_MDL_ADDR OB86_RACKS_FLTD BYTE BYTE BYTE WORD ARRAY (0 ... 31) OF BOOL DATE_AND_TIME Date and time of day when the OB was called OB86_DATE_TIME Description Event class and identifiers: 38h: outgoing event 39h: incoming event Error code: (possible values: C4h, C5h, C7h, C8h) Priority class: may be assigned via hardware configuration OB number (86) reserved reserved Depends on the error code Depends on the error code Information to access the local data can be found at the description of the OB 1. HB00E - OPL_STD - Rev. 14/22 2-21 Manual VIPA Operation List Standard Chapter 2 Organization Blocks OB 86 depending on error codes If you want to program OB 86 dependent on the possible error codes, we recommend that you organize the local variables as follows: Variable OB86_EV_CLASS OB86_FLT_ID OB86_PRIORITY OB86_OB_NUMBR OB86_RESERVED_1 OB86_RESERVED_2 OB86_MDL_ADDR OB86_Z23 OB86_DATE_TIME Type BYTE BYTE BYTE BYTE BYTE BYTE WORD DWORD DATE_AND_TIME The following table shows the event started OB 86: EV_CLASS FLT_ID 39h, 38h C4h C5h Variable Bit ... OB86_MDL_ADDR OB86_Z23 Bit 7 ... 0 Bit 15 ... 8 Bit 30 ... 16 Bit 31 38h C7h OB86_MDL_ADDR OB86_Z23 Bit 7 ... 0 Bit 15 ... 8 Bit 30 ... 16 Bit 31 C8h OB86_MDL_ADDR OB86_Z23 Bit 7 ... 0 Bit 15 ... 8 Bit 30 ... 16 Bit 31 2-22 Description Failure of a DP station Fault in a DP station Logical base address of the DP master Address of the affected DP slave: Number of the DP station DP master system ID Logical base address of the DP slave I/O identifier Return of a DP station, but error in module parameter assignment Logical base address of the DP master Address of the DP slaves affected: Number of the DP station DP master system ID Logical base address of the DP slave I/O identifier Return of a DP station, however discrepancy in configured and actual configuration Logical base address of the DP master Address of the DP slaves affected: Number of the DP station DP master system ID Logical base address of the DP slave I/O identifier HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Chapter 2 Organization Blocks OB 100 - Reboot Description On a restart, the CPU sets both itself and the modules to the programmed initial state, deletes all not-latching data in the system memory, calls OB 100 and then executes the main program in OB 1. Here the current program and the current data blocks generated by SFC remain in memory. The VIPA CPU executes a startup with OB 100 as follows: • after POWER ON and operating switch in RUN • whenever you switch the mode selector from STOP to RUN • after a request using a communication function (menu command from the programming device) Even if no OB 100 is loaded into the CPU, the CPU goes to RUN without an error message. Local data The following table describes the start information of the OB 100 with default names of the variables and its data types: Variable OB100_EV_CLASS OB100_STRTUP Type BYTE BYTE OB100_PRIORITY OB100_OB_NUMBR OB100_RESERVED_1 OB100_RESERVED_2 OB100_STOP OB100_STRT_INFO BYTE BYTE BYTE BYTE WORD DWORD OB100_DATE_TIME DATE_AND_TIME Description Event class and identifiers: 13h: active Startup request 81h: Manual restart request Priority class: 27 OB number (100) reserved reserved Number of the event that caused the CPU to STOP Supplementary information about the current startup (see next page) Date and time of day when the OB was called Information to access the local data can be found at the description of the OB 1. HB00E - OPL_STD - Rev. 14/22 2-23 Chapter 2 Organization Blocks Allocation OB100_STR_INFO Bit-No. 31 - 24 23 - 16 15 - 12 11 - 8 7-0 2-24 Manual VIPA Operation List Standard The following table shows the allocation of OB100_STR_INFO variables: Explanation Possible Description values (binary) xxxx xxx0 No difference between expected and actual configuration Startup information xxxx xxx1 Difference between expected and actual configuration xxxx 0xxx Clock for time stamp not battery-backed at last POWER ON xxxx 1xxx Clock for time stamp battery-backed at last POWER ON Startup just 0000 0011 Restart triggered with mode selector completed 0000 0100 Restart triggered by command via MPI 0001 0000 Automatic restart after battery-backed POWER ON 0001 0011 Restart triggered with mode selector; last POWER ON battery-backed 0001 0100 Restart triggered by command via MPI; last POWER ON battery-backed 0010 0000 Automatic restart battery-backed POWER ON (with memory reset by system) 0010 0011 Restart triggered with mode selector last POWER ON not battery-backed 0010 0100 Restart triggered by command via MPI last POWER ON not battery-backed Permissibility 0000 Automatic startup illegal, of automatic memory request requested startup 0001 Automatic startup illegal, parameter modifications, etc. necessary 0111 Automatic startup permitted Permissibility 0000 Manual startup illegal, of manual memory request requested startup 0001 Manual startup illegal, parameter modifications, etc. necessary 0111 Manual startup permitted Last valid 0000 0000 No startup intervention or 0000 0011 Restart triggered with mode selector setting of the 0000 0100 Restart triggered by command via MPI automatic 0001 0000 Automatic restart after battery-backed POWER ON startup at POWER ON 0001 0011 Restart triggered with mode selector; last POWER ON battery-backed 0001 0100 Restart triggered by command via MPI; last POWER ON battery-backed 0010 0000 Automatic restart after battery-backed POWER ON (with memory reset by system) 0010 0011 Restart triggered with mode selector last POWER ON not battery-backed 1010 0000 Restart triggered by command via MPI last POWER ON not battery-backed HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Chapter 2 Organization Blocks OB 121 - Programming Error (Synchronous error) Description The operating system of the CPU calls OB 121 whenever an event occurs that is caused by an error related to the processing of the program. If OB 121 is not programmed, the CPU changes to STOP. For example, if your program calls a block that has not been loaded on the CPU, OB 121 is called. OB 121 is executed in the same priority class as the interrupted block. So you have read/write access to the registers of the interrupted block. Masking of start events The CPU provides the following SFCs for masking and unmasking start events for OB 121 during the execution of your program: • SFC 36 MSK_FLT masks specific error codes. • SFC 37 DMSK_FLT unmasks the error codes that were masked by SFC 36. • SFC 38 READ_ERR reads the error register. Local data The following table describes the start information of the OB 121 with default names of the variables and its data types: Variable OB121_EV_CLASS OB121_SW_FLT OB121_PRIORITY OB121_OB_NUMBR OB121_BLK_TYPE OB121_RESEVED_1 OB121_FLT_REG OB121_BLK_NUM OB121_PRG_ADDR OB121_DATE_TIME Data type BYTE BYTE BYTE Description Event class and identifiers: 25h Error code (see next page) Priority class: priority class of the OB in which the error occurred. BYTE OB number (121) BYTE Type of block where the error occurred 88h: OB, 8Ah: DB, 8Ch: FC, 8Eh: FB BYTE reserved (Data area and access type) WORD Source of the error (depends on error code). For example: • Register where the conversation error occurred • Incorrect address (read/write error) • Incorrect timer/counter/block number • Incorrect memory area WORD Number of the block with command that caused the error. WORD Relative address of the command that caused the error. DATE_AND_TIME Date and time of day when the OB was called. Information to access the local data can be found at the description of the OB 1. HB00E - OPL_STD - Rev. 14/22 2-25 Chapter 2 Organization Blocks Error codes Error code 21h The variables dependent on the error code have the following meaning: Variable OB121_FLT_REG: 22h 23h 28h 29h OB121_RESERVED_1 24h 25h OB121_FLT_REG 26h 27h OB121_FLT_REG 2-26 Manual VIPA Operation List Standard Description BCD conversion error ID for the register concerned (0000h: accumulator 1) Area length error when reading Area length error when writing Read access to a byte, word or double word with a pointer whose bit address is not 0. Write access to a byte, word or double word with a pointer whose bit address is not 0. Incorrect byte address. The data area and access type can be read from OB121_RESERVED_1. Bit 3 ... 0 memory area: 0: I/O area 1: process-image input table 2: process-image output table 3: bit memory 4: global DB 5: instance DB 6: own local data 7: local data of caller Bit 7 ... 4 access type: 0: bit access 1: byte access 2: word access 3: double word access Range error when reading Range error when writing Contains the ID of the illegal area in the low byte (86h of own local data area) Error for timer number Error for counter number Illegal number continued ... HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard ... continue Error code 30h 31h 32h 33h Variable OB121_FLT_REG 34h 35h 3Ah 3Ch 3Dh 3Eh 3Fh OB121_FLT_REG HB00E - OPL_STD - Rev. 14/22 Chapter 2 Organization Blocks Description Write access to a write-protected global DB Write access to a write-protected instance DB DB number error accessing a global DB DB number error accessing an instance DB Illegal DB number FC number error in FC call FB number error in FB call Access to a DB that has not been loaded; the DB number is in the permitted range Access to an FC that has not been loaded; the FC number is in the permitted range Access to an SFC that has not been loaded; the SFC number is in the permitted range Access to an FB that has not been loaded; the FB number is in the permitted range Access to an SFB that has not been loaded; the SFB number is in the permitted range Illegal DB number 2-27 Chapter 2 Organization Blocks Manual VIPA Operation List Standard OB 122 - Periphery access Error Description The operating system of the CPU calls OB 122 whenever an error occurs while accessing data on a module. For example, if the CPU detects a read error when accessing data on an I/O module, the operating system calls OB 122. If OB 122 is not programmed, the CPU changes from the RUN mode to the STOP mode. OB 122 is executed in the same priority class as the interrupted block. So you have read/write access to the registers of the interrupted block. Masking of start events The CPU provides the following SFCs for masking and unmasking start events for OB 122: • SFC 36 MASK_FLT masks specific error codes • SFC 37 DMASK_FLT unmasks the error codes that were masked by SFC 36 • SFC 38 READ_ERR reads the error register Local data The following table describes the start information of the OB 122 with default names of the variables and its data types: Variable OB122_EV_CLASS OB122_SW_FLT OB122_PRIORITY OB122_OB_NUMBR OB122_BLK_TYPE OB122_MEM_AREA OB122_MEM_ADDR OB122_BLK_NUM OB122_PGR_ADDR OB122_DATE_TIME Type BYTE BYTE Description Event class and identifiers: 29h Error code: 42h: I/O access error - reading 43h: I/O access error - writing BYTE Priority class: Priority class of the OB where the error occurred BYTE OB number (122) BYTE No valid number is entered here BYTE Memory area and access type: Bit 3 ... 0: memory area 0: I/O area; 1: Process image of the inputs 2: Process image of the outputs Bit 7 ... 4: access type: 0: Bit access, 1: Byte access, 2: Word access, 3: Dword access WORD Memory address where the error occurred WORD No valid number is entered here WORD No valid number is entered here DATE_AND_TIME Date and time of day when the OB was called Information to access the local data can be found at the description of the OB 1. 2-28 HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Chapter 3 Integrated SFBs Chapter 3 Integrated SFBs Overview Here the description of the integrated function blocks of the VIPA standard CPUs of the systems 100V, 200V, 300V and 500V may be found. Content Topic Page Integrated SFBs .............................................................. 3-1 Chapter 3 Overview .............................................................................................. 3-2 SFB 0 - CTU - Up-counter.................................................................... 3-3 SFB 1 - CTD - Down-counter ............................................................... 3-4 SFB 2 - CTUD - Up-Down counter ....................................................... 3-5 SFB 3 - TP - Create pulse .................................................................... 3-7 SFB 4 - TON - Create turn-on delay..................................................... 3-9 SFB 5 - TOF - Create turn-off delay ................................................... 3-11 SFB 32 - DRUM - Realize a step-by-step switch ................................ 3-13 SFB 52 - RDREC - Reading a Data Record from a DP-V1 slave ....... 3-18 SFB 53 - WRREC - Writing a Data Record in a DP-V1 slave ............. 3-20 SFB 54 - RALRM - Receiving an interrupt from a DP-V1 slave .......... 3-22 HB00E - OPL_STD - Rev. 14/22 3-1 Manual VIPA Operation List Standard Chapter 3 Integrated SFBs Overview General The system program of the CPU offers you some additional functions that you may use by calling FBs, FCs or OBs. Those additional functions are part of the system program and don't use any work memory. Although the additional functions may be requested, they cannot be read or altered. The calling of an additional function via FB, FC or OB is registered as block change and influences the nesting depth for blocks. Integrated SFBs The following system function blocks (SFBs) are available: 3-2 SFB SFB 0 SFB 1 SFB 2 SFB 3 SFB 4 SFB 5 SFB 32 Label CTU CTD CTUD TP TON TOF DRUM SFB 52 RDREC SFB 53 WRREC SFB 54 RALRM Description Count forward Count backwards Count forward and backwards Create pulse Create turn-on delay Create turn-off delay Realization of a step sequential circuit with a max. of 16 steps DP-V1-SFB Reading a Data Record from a DP slave DP-V1-SFB Writing a Data Record in a DP slave DP-V1-SFB Receiving an Interrupt from a DP slave HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Chapter 3 Integrated SFBs SFB 0 - CTU - Up-counter The SFB 0 can be used as Up-counter. Here you have the following characteristics: • If the signal at the up counter input CU changes from "0" to "1" (positive edge), the current counter value is incremented by 1 and displayed at output CV. • When called for the first time with R="0" the counter value corresponds to the preset value at input PV. • When the upper limit of 32767 is reached the counter will not be incremented any further, i.e. all rising edges at input CU are ignored. • The counter is reset to zero if reset input R has signal state "1". • Output Q has signal state "1" if CV ≥ PV. • When it is necessary that the instances of this SFB are initialized after a restart, then the respective instances must be initialized in OB 100 with R = 1. Description Parameters Parameter CU R Declaration INPUT INPUT PV INPUT Q CV OUTPUT OUTPUT Data type Memory block Description BOOL I, Q, M, D, L, constant Count input BOOL I, Q, M, D, L, constant Reset input. R takes precedence over CU. INT I, Q, M, D, L, constant Preset value. The effect of PV is described under parameter Q. BOOL I, Q, M, D, L Status of the counter INT I, Q, M, D, L Current count CU Count input: This counter is incremented by 1 when a rising edge (with respect to the most recent SFB call) is applied to input CU. R Reset input: The counter is reset to 0 when input R is set to "1", irrespective of the status of input CU. PV Preset value: This value is the comparison value for the current counter value. Output Q indicates whether the current count is greater than or equal to the preset value PV. Q Status of the counter: • Q is set to "1", if CV ≥ PV (current count ≥ preset value) • else Q = "0" CV Current count: • possible values: 0 ... 32767 HB00E - OPL_STD - Rev. 14/22 3-3 Manual VIPA Operation List Standard Chapter 3 Integrated SFBs SFB 1 - CTD - Down-counter Description The SFB 1 can be used as Down-counter. Here you have the following characteristics: • If the signal state at the down counter input CD changes from "0" to "1" (positive edge), the current counter value is decremented by 1 and displayed at output CV. • When called for the first time with LOAD = "0" the counter value corresponds to the preset value at input PV. • When the lower limit of -32767 is reached the counter will not be decremented any further, i.e. all rising edges at input CU are ignored. • When a "1" is applied to the LOAD input then the counter is set to preset value PV irrespective of the value applied to input CD. • Output Q has signal state "1" if CV ≤ 0. • When it is necessary that the instances of this SFB are initialized after a restart, then the respective instances must be initialized in OB 100 with LOAD = 1 and PV = required preset value for CV. Parameters Parameter CD LOAD Declaration INPUT INPUT Data type BOOL BOOL PV Q CV INPUT OUTPUT OUTPUT INT BOOL INT Memory block Description I, Q, M, D, L, constant Count input I, Q, M, D, L, constant Load input. LOAD takes precedence over CD. I, Q, M, D, L, constant Preset value I, Q, M, D, L Status of the counter I, Q, M, D, L Current count CD Count input: This counter is decremented by 1 when a rising edge (with respect to the most recent SFB call) is applied to input CU. LOAD Load input: When a 1 is applied to the LOAD input then the counter is set to preset value PV irrespective of the value applied to input CD. PV Preset value: The counter is set to preset value PV when the input LOAD is “1”. Q Status of the counter: Q is set to • 1, if 0 ≥ CV (Current count value smaller/even 0) • else Q = "0" CV Current count: • possible values: -32 768 ... 32 767 3-4 HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Chapter 3 Integrated SFBs SFB 2 - CTUD - Up-Down counter The SFB 2 can be used as an Up-Down counter. Here you have the following characteristics: • If the signal state at the up count input CU changes from "0" to "1" (positive edge), the counter value is incremented by 1 and displayed at output CV. • If the signal state at the down count input CD changes from "0" to "1" (positive edge), the counter value is decremented by 1 and displayed at output CV. • If both counter inputs have a positive edge, the current counter value does not change. • When the count reaches the upper limit of 32767 any further edges are ignored. • When the count reaches the lower limit of -32768 any further edges are ignored. • When a "1" is applied to the LOAD input then the counter is set to preset value PV. • The counter value is reset to zero if reset input R has signal state "1". Positive signal edges at the counter inputs and signal state "1" at the load input remain without effect while input R has signal state "1". • Output QU has signal state "1", if CV ≥ PV. • Output QD has signal state "1", if CV ≤ 0. • When it is necessary that the instances of this SFB are initialized after a restart, then the respective instances must be initialized in OB 100 with: - when the counter is used as up-counter with R = "1" - when the counter is used as down-counter with R = 0 and LOAD = 1 and PV = preset value. Description Parameters Parameter CU CD R Declaration INPUT INPUT INPUT Data type BOOL BOOL BOOL LOAD INPUT BOOL PV QU QD CV INPUT OUTPUT OUTPUT OUTPUT INT BOOL BOOL INT HB00E - OPL_STD - Rev. 14/22 Memory block I, Q, M, D, L, constant I, Q, M, D, L, constant I, Q, M, D, L, constant Description Count up input Count down input Reset input, R takes precedence over LOAD. I, Q, M, D, L, constant Load input, LOAD takes precedence over CU and CD. I, Q, M, D, L, constant Preset value I, Q, M, D, L Status of the up counter I, Q, M, D, L Status of the down counter I, Q, M, D, L Current count 3-5 Chapter 3 Integrated SFBs Manual VIPA Operation List Standard CU Count up input: A rising edge (with respect to the most recent SFB-call) at input CU increments the counter. CD Count down input: A rising edge (with respect to the most recent SFB-call) at input CD decrements the counter. R Reset input: When input R is set to "1" the counter is reset to 0, irrespective of the status of inputs CU, CD and LOAD. LOAD Load input: When the LOAD input is set to "1" the counter is preset to the value applied to PV, irrespective of the values of inputs CU and CD. PV Preset value: The counter is preset to the value applied to PV, when the LOAD input is set to 1. QU Status of the down counter: • QU is set to "1", if CV ≥ PV (Current count ≥ Preset value) • else QU is 0. QD Status of the down counter: • QD is set to 1", if 0 ≥ CV (Current count smaller/= 0) • else QD is 0. CV Current count • possible values: -32 768 ... 32 767 3-6 HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Chapter 3 Integrated SFBs SFB 3 - TP - Create pulse The SFB 3 can be used to generate a pulse with a pulse duration equal to PT. Here you have the following characteristics: Description • • • • The pulse duration is only available in the STARTUP and RUN modes. The pulse is started with a rising edge at input IN. During PT time the output Q is set regardless of the input signal. The ET output provides the time for which output Q has already been set. The maximum value of the ET output is the value of the PT input. Output ET is reset when input IN changes to "0", however, not before the time PT has expired. • When it is necessary that the instances of this SFB 3 are initialized after a restart, then the respective instances must be initialized in OB 100 with PT = 0 ms. Time diagram IN Q PT PT PT ET PT Parameters Parameter IN Declaration INPUT Data type BOOL PT INPUT TIME Q ET OUTPUT OUTPUT BOOL TIME HB00E - OPL_STD - Rev. 14/22 Memory block I, Q, M, D, L, constant I, Q, M, D, L, constant I, Q, M, D, L I, Q, M, D, L Description Start input Pulse duration Status of the time Expired time 3-7 Chapter 3 Integrated SFBs Manual VIPA Operation List Standard IN Start input: The pulse is started by a rising edge at input IN. PT Pulse duration: PT must be positive. The range of these values is determined by data type TIME. Q Output Q: Output Q remains active for the pulse duration PT, irrespective of the subsequent status of the input signal ET Expired time: The duration for which output Q has already been active is available at output ET where the maximum value of this output can be equal to the value of PT. When input IN changes to 0 output ET is reset, however, this only occurs after PT has expired. 3-8 HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Chapter 3 Integrated SFBs SFB 4 - TON - Create turn-on delay SFB 4 can be used to delay a rising edge by period PT. Here you have the following characteristics: Description • The timer runs only in the STARTUP and RUN modes. • A rising edge at the IN input causes a rising edge at output Q after the time PT has expired. Q then remains set until the IN input changes to 0 again. If the IN input changes to "0" before the time PT has expired, output Q remains set to "0". • The ET output provides the time that has passed since the last rising edge at the IN input. Its maximum value is the value of the PT input. ET is reset when the IN input changes to "0". • When it is necessary that the instances of this SFB are initialized after a restart, then the respective instances must be initialized in OB 100 with PT = 0 ms. Timing diagram IN Q PT PT ET PT Parameters Parameter IN Declaration INPUT Type BOOL PT INPUT TIME Q ET OUTPUT OUTPUT BOOL TIME HB00E - OPL_STD - Rev. 14/22 Memory block I, Q, M, D, L, constant I, Q, M, D, L, constant I, Q, M, D, L I, Q, M, D, L Description Start input Time delay Status of time Expired time 3-9 Chapter 3 Integrated SFBs Manual VIPA Operation List Standard IN Start input: The time delay is started by a rising edge at input IN. Output Q also produces a rising edge when time delay PT has expired. PT Time delay: Time delay applied to the rising edge at input IN PT must be. The range of values is defined by the data type TIME. Q Output Q: The time delay is started by a rising edge at input IN. Output Q also produces a rising edge when time delay PT has expired and it remains set until the level applied to input IN changes back to 0. If input IN changes to 0 before time delay PT has expired then output Q remains at "0". ET Expired time: Output ET is set to the time duration that has expired since the most recent rising edge has been applied to input IN. The highest value that output ET can contain is the value of input PT. Output ET is reset when input IN changes to "0". 3-10 HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Chapter 3 Integrated SFBs SFB 5 - TOF - Create turn-off delay SFB 5 can be used to delay a falling edge by period PT. Here you have the following characteristics: • The timer runs only in the STARTUP and RUN modes. • A rising edge at the IN input causes a rising edge at output Q. A falling edge at the IN input causes a falling edge at output Q delayed by the time PT. If the IN input changes back to "1" before the time PT has expired, output Q remains set to "1". • The ET output provides the time that has elapsed since the last falling edge at the IN input. Its maximum value is, however the value of the PT input. ET is reset when the IN input changes to "1". • When it is necessary that the instances of this SFB are initialized after a restart, then the respective instances must be initialized in OB 100 with PT = 0 ms. Description Time diagram IN Q PT PT PT ET PT Parameters Parameter IN Declaration INPUT Data type BOOL PT INPUT TIME Q ET OUTPUT OUTPUT BOOL TIME HB00E - OPL_STD - Rev. 14/22 Memory block I, Q, M, D, L, constant I, Q, M, D, L, constant I, Q, M, D, L I, Q, M, D, L Description Start input Time delay Status of time Expired time 3-11 Chapter 3 Integrated SFBs Manual VIPA Operation List Standard IN Start input: The time delay is started by a rising edge at input IN results in a rising edge at output Q. When a falling edge is applied to input IN output Q will also produce a falling edge when delay PT has expired. If the level at input IN changes to "1" before time delay PT has expired, then the level at output Q will remain at "1". PT Time delay: Time delay applied to the falling edge at input IN PT must be. The range of values is defined by the data type TIME. Q Status of time: The time delay is started by a rising edge at input IN results in a rising edge at output Q. When a falling edge is applied to input IN output Q will also produce a falling edge when delay PT has expired. If the level at input IN changes to "1" before time delay PT has expired, then the level at output Q will remain at "1". ET Expired time: The time period that has expired since the most recent falling edge at input IN is available from output ET. The highest value that output ET can reach is the value of input PT. Output ET is reset when the level at input IN changes to "1". 3-12 HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Chapter 3 Integrated SFBs SFB 32 - DRUM - Realize a step-by-step switch Description Implementing a 16-state cycle switch using the SFB 32. Parameter DSP defines the number of the first step, parameter LST_STEP defines the number of the last step. Every step describes the 16 output bits OUT0 ... OUT15 and output parameter OUT_WORD that summarizes the output bits. The cycle switch changes to the next step when a positive edge occurs at input JOG with respect to the previous SFB-call. If the cycle switch has already reached the last step and a positive edge is applied to JOG variables Q and EOD will be set, DCC is set to 0 and SFB 32 remains at the last step until a "1" is applied to the RESET input. Time controlled switching The switch can also be controlled by a timer. For this purpose parameter DRUM_EN must be set to "1". The next step of the cycle switch is activated when: • the event bit EVENTi of the current step is set and • when the time defined for the current step has expired. The time is calculated as the product of time base DTBP and the timing factor that applies to the current step (from the S_PRESET field). Note! The remaining processing time DCC in the current step will only be decremented if the respective event bit EVENTi is set. If input RESET is set to "1" when the call is issued to SFB 32 then the cycle switch changes to the step that you have specified as a number at input DSP. HB00E - OPL_STD - Rev. 14/22 3-13 Chapter 3 Integrated SFBs Manual VIPA Operation List Standard Note! Special conditions apply if parameter DRUM_EN is set to "1": • timer-controlled cycle switching, if EVENTi = "1" with DSP = i = LST_STEP. • event-controlled cycle switching by means of event bits EVENTi, when DTBP = "0". In addition it is possible to advance the cycle switch at any time (even if DRUM_EN = "1") by means of the JOG input. When this module is called for the first time the RESET input must be set to "1". If the cycle switch has reached the last step and the processing time defined for this step has expired, then outputs Q and EOD will be set and SFB 32 will remain at the last step until the RESET input is set to "1". The SFB 32 is only active in operating modes STARTUP and RUN. If SFB 32 must be initialized after a restart it must be called from OB 100 with RESET = "1". 3-14 HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Parameters Parameter RESET Declaration INPUT Data type BOOL JOG INPUT BOOL DRUM_EN INPUT BOOL LST_STEP INPUT BYTE EVENTi, 1 ≤ i ≤ 16 OUTj, 0 ≤ j ≤ 15 Q OUT_WORD ERR_CODE INPUT BOOL OUTPUT Chapter 3 Integrated SFBs Description Reset BOOL Memory block I, Q, M, D, L, constant I, Q, M, D, L, constant I, Q, M, D, L, constant I, Q, M, D, L, constant I, Q, M, D, L, constant I, Q, M, D, L OUTPUT OUTPUT OUTPUT BOOL WORD WORD I, Q, M, D, L I, Q, M, D, L, P I, Q, M, D, L, P JOG_HIS VAR BOOL EOD VAR BOOL DSP VAR BYTE DSC VAR BYTE DCC VAR DWORD I, Q, M, D, L, constant I, Q, M, D, L, constant I, Q, M, D, L, P constant I, Q, M, D, L, P constant I, Q, M, D, L, P constant Status parameter Output bits ERR_CODE contains the error information if an error occurs when the SFB is being processed Not relevant to the user DTBP VAR WORD PREV_TIME VAR DWORD S_PRESET VAR ARRAY of WORD I, Q, M, D, L, P constant I, Q, M, D, L, constant I, Q, M, D, L, constant OUT_VAL VAR ARRAY of BOOL I, Q, M, D, L, constant S_MASK VAR ARRAY of BOOL I, Q, M, D, L, constant HB00E - OPL_STD - Rev. 14/22 Switch to the next stage Control parameter Number of the last step Event bit No. i (belongs to step i) Output bit No. j Identical with output parameter Q Number of the first step Number of the current step The remaining processing time for the current step in ms The time base in ms that applies to all steps Not relevant to the user One dimensional field containing the timing factors for every step Two-dimensional field containing the output values for every step Two-dimensional field containing the mask bits for every step. 3-15 Chapter 3 Integrated SFBs Manual VIPA Operation List Standard RESET Reset: The cycle switch is reset if this is set to "1". RESET must be set to "1" when the initial call is issued to the block. JOG A rising edge (with respect to the last SFB call) increments the cycle switch to the next stage if the cycle switch has not yet reached the last step. This is independent of the value of DRUM_EN. DRUM_EN Control parameter that determines whether timer-controlled cycle switching to the next step should be enabled or not ("1": enable timer-controlled increments). LST_STEP Number of the last step: • possible values: 1 ... 16 EVENTi, 1≤ ≤i≤ ≤16 Event bit No. i (belonging to step i) OUTj 0≤ ≤j≤ ≤15 Output bit No. j (identical with bit No. j of OUT_WORD) Q Status parameter specifying whether the processing time that you have defined for the last step has expired. OUT_WORD Output bits summarized in a single variable. ERR_CODE ERR_CODE contains the error information if an error occurs when the SFB is being processed. JOG_HIS Not relevant to the user: input parameter JOG of the previous SFB-call. EOD Identical with output parameter Q DSP Number of the first step: • possible values 1 ... 16 DSC Number of the current step DCC The remaining processing time for the current step in ms (only relevant if DRUM_EN = "1" and if the respective event bit = "1") DTBP The time base in ms that applies to all steps. PREV_TIME Not relevant to the user: system time of the previous SFB call. S_PRESET One-dimensional field containing the timing factors for every step. • Meaningful indices are: [1 ... 16]. In this case S_PRESET [x] contains the timing factor of step x. 3-16 HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Chapter 3 Integrated SFBs OUT_VAL Two-dimensional field containing the output values for every step if you have not masked these by means of S_MASK. • Meaningful indices are: [1 ... 16, 0 ... 15]. In this case OUT_VAL [x, y] contains the value that is assigned to output bit OUTy in step x. S_MASK Two-dimensional field containing the mask bits for every step. • Meaningful indices are: [1 ... 16, 0 ... 15]. In this case S_MASK [x, y] contains the mask bit for the value y of step x. Significance of the mask bits: • 0: the respective value of the previous step is assigned to the output bit • 1: the respective value of OUT_VAL is assigned to the output bit. Error information ERR_CODE When an error occurs the status of SFB 32 remains at the current value and output ERR_CODE contains one of the following error codes: ERR_CODE 0000h 8081h 8082h 8083h 8084h HB00E - OPL_STD - Rev. 14/22 Description No error has occurred illegal value for LST_STEP illegal value for DSC illegal value for DSP The product DCC = DTBP x S_PRESET[DSC ] exceeds 31-1 the value 2 (appr. 24.86 Days) 3-17 Chapter 3 Integrated SFBs Manual VIPA Operation List Standard SFB 52 - RDREC - Reading a Data Record from a DP-V1 slave Note! The SFB 52 RDREC interface is identical to the FB RDREC defined in the standard "PROFIBUS Guideline PROFIBUS Communication and Proxy Function Blocks according to IEC 61131-3". Description With the SFB 52 RDREC (read record) you read a record set with the number INDEX from a DP slave component (module or modules) that has been addressed via ID. Specify the maximum number of bytes you want to read in MLEN. The selected length of the target area RECORD should have at least the length of MLEN bytes. TRUE on output parameter VALID verifies that the record set has been successfully transferred into the target area RECORD. In this case, the output parameter LEN contains the length of the fetched data in bytes. The output parameter ERROR indicates whether a record set transmission error has occurred. In this case, the output parameter STATUS contains the error information. System dependent this block cannot be interrupted! Note! If a DP-V1 slave is configured using a GSD file (GSD stating with Rev. 3) and the DP interface of the DP master is set to Siemens "S7 compatible", than record sets must not be read from I/O modules in the user program with SFB 52. The reason is that in this case the DP master addresses the incorrect slot (configured slot +3). Remedy: Set the interface for DP master to "DP-V1"! Operating principle 3-18 The SFB 52 RDREC operates asynchronously, that is, processing covers multiple SFB calls. Start the job by calling SFB 52 with REQ = 1. The job status is displayed via the output parameter BUSY and bytes 2 and 3 of output parameter STATUS. Here, the STATUS bytes 2 and 3 correspond with the output parameter RET_VAL of the asynchronously operating SFCs (see also meaning of REQ, RET_VAL and BUSY with Asynchronously Operating SFCs). Record set transmission is completed when the output parameter BUSY = FALSE. HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Parameters Parameter REQ ID Chapter 3 Integrated SFBs Declaration Data type Memory block INPUT BOOL I, Q, M, D ,L, constant INPUT DWORD I, Q, M, D, L, constant INDEX INPUT INT MLEN INPUT INT VALID BUSY OUTPUT OUTPUT BOOL BOOL I, Q, M, D, L, constant I, Q, M, D, L, constant I, Q, M, D, L I, Q, M, D, L ERROR STATUS LEN OUTPUT OUTPUT OUTPUT BOOL DWORD INT I, Q, M, D, L I, Q, M, D, L I, Q, M, D, L RECORD IN_OUT ANY I, Q, M, D, L Error information Description REQ = 1: Transfer record set Logical address of the DP slave component (module) For an output module, bit 15 must be set (e.g. for address 5: ID: DW = 8005h). For a combination module, the smaller of the two addresses should be specified. Record set number Maximum length in bytes of the record set information to be fetched New record set was received and valid BUSY = 1: The read process is not yet terminated. ERROR = 1: A read error has occurred. Call ID (bytes 2 and 3) or error code. Length of the fetched record set information. Target area for the fetched record set. See Receiving an interrupt from a DP slave with SFB 54 RALRM. HB00E - OPL_STD - Rev. 14/22 3-19 Chapter 3 Integrated SFBs Manual VIPA Operation List Standard SFB 53 - WRREC - Writing a Data Record in a DP-V1 slave Note! The SFB 53 WRREC interface is identical to the FB WRREC defined in the standard "PROFIBUS Guideline PROFIBUS Communication and Proxy Function Blocks according to IEC 61131-3". Description With the SFB 53 WRREC (Write record) you transfer a record set with the number INDEX to a DP slave component (module) that has been addressed via ID. Specify the byte length of the record set to be transmitted. The selected length of the source area RECORD should, therefore, have at least the length of LEN bytes. TRUE on output parameter DONE verifies that the record set has been successfully transferred to the DP slave. The output parameter ERROR indicates whether a record set transmission error has occurred. In this case, the output parameter STATUS contains the error information. System dependent this block cannot be interrupted! Note! If a DP-V1 slave is configured using a GSD file (GSD stating with Rev. 3) and the DP interface of the DP master is set to Siemens "S7 compatible", than record sets must not be read from I/O modules in the user program with SFB 53. The reason is that in this case the DP master addresses the incorrect slot (configured slot +3). Remedy: Set the interface for DP master to "DP-V1"! Operating principle 3-20 The SFB 53 WRREC operates asynchronously, that is, processing covers multiple SFB calls. Start the job by calling SFB 52 with REQ = 1. The job status is displayed via the output parameter BUSY and bytes 2 and 3 of output parameter STATUS. Here, the STATUS bytes 2 and 3 correspond with the output parameter RET_VAL of the asynchronously operating SFCs (see also meaning of REQ, RET_VAL and BUSY with Asynchronously Operating SFCs). Please note that you must assign the same value to the actual parameter of RECORD for all SFB 53 calls that belong to one and the same job. The same applies to the LEN parameters. Record set transmission is completed when the output parameter BUSY = FALSE. HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Parameters Parameter REQ ID Chapter 3 Integrated SFBs Declaration Data type Memory block INPUT BOOL I, Q, M, D, L, constant INPUT DWORD I, Q, M, D, L, constant INDEX INPUT INT LEN INPUT INT DONE BUSY OUTPUT OUTPUT BOOL BOOL I, Q, M, D, L, constant I, Q, M, D, L, constant I, Q, M, D, L I, Q, M, D, L ERROR STATUS LEN OUTPUT OUTPUT OUTPUT BOOL DWORD INT I, Q, M, D, L I, Q, M, D, L I, Q, M, D, L RECORD IN_OUT ANY I, Q, M, D, L Error information Description REQ = 1: Transfer record set Logical address of the DP slave component (module or submodule). For an output module, bit 15 must be set (e.g. for address 5: ID: DW = 8005h). For a combination module, the smaller of the two addresses should be specified. Record set number. Maximum byte length of the record set to be transferred Record set was transferred BUSY = 1: The write process is not yet terminated. ERROR = 1: A write error has occurred Call ID (bytes 2 and 3) or error code Length of the fetched record set information Record set See Receiving an interrupt from a DP slave with SFB 54 RALRM. HB00E - OPL_STD - Rev. 14/22 3-21 Chapter 3 Integrated SFBs Manual VIPA Operation List Standard SFB 54 - RALRM - Receiving an interrupt from a DP-V1 slave Note! The SFB 54 RALRM interface is identical to the FB RALRM defined in the standard "PROFIBUS Guideline PROFIBUS Communication and Proxy Function Blocks according to IEC 61131-3". Description The SFB 54 RALRM receives an interrupt with all corresponding information from a peripheral module (centralized structure) or from a DP slave component. It supplies this information to its output parameters. The information in the output parameters contains the start information of the called OB as well as information of the interrupt source. Call the SFB 54 only within the interrupt OB started by the CPU operating system as a result of the peripheral interrupt that is to be examined. Note! If you call SFB 54 RALRM in an OB for which the start event was not triggered by peripherals, the SFB supplies correspondingly reduced information on its outputs. Make sure to use different instance DBs when you call SFB 54 in different OBs. If you want to evaluate data that are the result of an SFB 54 call outside of the associated interrupt OB you should moreover use a separate instance DP per OB start event. 3-22 HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Parameters Parameter MODE F_ID Chapter 3 Integrated SFBs Declaration Data type Memory block INPUT INT I, Q, M, D, L, constant INPUT DWORD I, Q, M, D, L, constant MLEN INPUT INT NEW STATUS ID OUTPUT OUTPUT OUTPUT BOOL DWORD DWORD I, Q, M, D, L, constant I, Q, M, D, L I, Q, M, D, L I, Q, M, D, L LEN OUTPUT INT I, Q, M, D, L TINFO IN_OUT ANY I, Q, M, D, L AINFO IN_OUT ANY I, Q, M, D, L MODE Description Operating mode Logical start address of the Component (module), from which interrupts are to be received. Maximum length in bytes of the data interrupt information to be received A new interrupt was received. Error code of the SFB or DP master Logical start address of the component (module), from which an interrupt was received. Bit 15 contains the I/O ID: 0: for an input address 1: for an output address Length of the received interrupt information (task information) Target range OB start and management information (interrupt information) Target area for header information and additional information. For AINFO you should provide a length of at least MLEN bytes. You can call the SFB 54 in three operating modes (MODE): 0: shows the component that triggered the interrupt in the output parameter ID and sets the output parameter NEW to TRUE. 1: describes all output parameters, independent on the interrupt-triggering component. 2: checks whether the component specified in input parameter F_ID has triggered the interrupt. - if not, NEW = FALSE - if yes, NEW = TRUE, and all other outputs parameters are described. Note! If you select a target area TINFO or AINFO that is too short the SFC 54 cannot enter the full information. HB00E - OPL_STD - Rev. 14/22 3-23 Manual VIPA Operation List Standard Chapter 3 Integrated SFBs TINFO Data structure of the target area (task information): Byte 0 ... 19 Data type Description Start information of the OB in which SFC 54 was currently called: Byte 0 ... 11: structured like the parameter TOP_SI in SFC 6 RD_SINFO Byte 12 ... 19: date and time the OB was requested 20 ... 27 Management information: 20 Byte centralized: 0 decentralized: DP master system ID (possible values: 1 ... 255) 21 Byte central: Module rack number (possible values: 0 ... 31) distributed: Number of DP station (possible values: 0 ... 127) 22 Byte centralized: 0 slave type 0000: DP decentralized: Bit 3 ... 0 0001: DPS7 0010: DPS7 V1 0011: DP-V1 as of 0100: reserved 0000: DP Bit 7 ... 4 Profile type as of 0001: reserved 23 Byte centralized: 0 decentralized: Bit 3 ... 0 Interrupt info 0000: type 0001: 0010: Bit 7 ... 4 3-24 Structure version as of 0011: 0000: as of 0001: Transparent (Interrupt originates from a configured decentralized module) Representative (Interrupt originating from a non-DP-V1 slave or a slot that is not configured) Generated interrupt (generated in the CPU) reserved Initial reserved continued ... HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard ... continue TINFO Byte Data type Description 24 Byte centralized: decentralized: Bit 0 = 0: Bit 0 = 1: 25 26, 27 Byte WORD Bit 7 ... 1: centralized: decentralized: Bit 0: Bit 7 ... 1: centralized: decentralized: HB00E - OPL_STD - Rev. 14/22 Chapter 3 Integrated SFBs 0 Flags of the DP master interface Interrupt originating from an integrated DP interface Interrupt originating from an external DP interface reserved 0 Flags of the DP slave interface EXT_DIAG_Bit of the diagnostic message frame, or 0 if this bit does not exist in the interrupt reserved 0 PROFIBUS ID number 3-25 Manual VIPA Operation List Standard Chapter 3 Integrated SFBs Data structure of the target area (interrupt information): AINFO Byte 0 ... 3 0 1 Data type Description Header information Byte Length of the received interrupt information in bytes centralized: 4 ... 224 Byte decentralized: centralized: 4 ... 63 reserved decentralized: 2 3 Byte Byte ID for the interrupt type 1: Diagnostic interrupt 2: Hardware interrupt 3: Removal interrupt 4: Insertion interrupt 5: Status interrupt 6: Update interrupt 31: Failure of an expansion device, DP master system or DP station 32 ... 126 manufacturer specific interrupt Slot number of the interrupt triggering component centralized: reserved decentralized: Identifier Bit 1, 0: 00 01 10 11 4 ... 223 Bit 2: Bit 7 ... 3 Additional interrupt information: module specific data for the respective interrupt: centralized: ARRAY[0] ... ARRAY[220] decentralized: 3-26 no further information incoming event, disrupted slot going event, slot not disrupted anymore going event, slot still disrupted Add_Ack Sequence number ARRAY[0] ... ARRAY[59] HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Chapter 3 Integrated SFBs Target Area: Depending on the respective OB in which SFB 54 is called, the target areas TINFO and AINFO are only partially written. Refer to the table below for information on which info is entered respectively. TINFO and AINFO Interrupt type OB Hardware interrupt 4x TINFO OB status information Yes TINFO management information Yes AINFO header information Yes Status interrupt Update interrupt Manufacturer specific interrupt Peripheral redundancy error Diagnostic interrupt 55 Yes Yes Yes AINFO additional interrupt information centralized: No decentralized: as delivered by the DP slave Yes 56 Yes Yes Yes Yes 57 Yes Yes Yes Yes 70 Yes Yes No No 82 Yes Yes Yes Removal/ Insertion interrupt 83 Yes Yes Yes Module rack/ Station failure ... 86 Yes Yes No centralized: Record set 1 decentralized: as delivered by the DP slave centralized: no decentralized: as delivered by the DP slave No No No No all Yes other OBs HB00E - OPL_STD - Rev. 14/22 3-27 Manual VIPA Operation List Standard Chapter 3 Integrated SFBs STATUS[2] The output parameter STATUS contains information. It is interpreted as ARRAY[1...4] OF BYTE the error information has the following structure: Name Description Function_Num 00h: if no error Function ID from DP-V1-PDU: in error case 80h is OR linked. If no DP-V1 protocol element is used: C0h Error_Decode Location of the error ID STATUS[3] Error_1 Error ID STATUS[4] Error_2 Manufacturer specific error ID expansion: With DP-V1 errors, the DP master passes on STATUS[4] to the CPU and to the SFB. Without DP-V1 error, this value is set to 0, with the following exceptions for the SFB 52: • STATUS[4] contains the target area length from RECORD, if MLEN > the target area length from RECORD • STATUS[4]=MLEN, if the actual record set length < MLEN < the target area length from RECORD Error_Decode 00 ... 7Fh 80h 81h ... 8Fh FEh, FFh STATUS[2] (Location of the error ID) can have the following values: Source Description CPU No error no warning DP-V1 Error according to IEC 61158-6 CPU 8xh shows an error in the nth call parameter of the SFB. DP Profile Profile-specific error Error information Field element STATUS[1] 3-28 HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Error_Decode 00h 70h 80h Chapter 3 Integrated SFBs STATUS[3] (Error ID) can have the following values: Error_Code_1 Explanation Description according to DP-V1 00h no error, no warning 00h reserved, reject Initial call; no active record set transfer 01h reserved, reject Initial call; record set transfer has started 02h reserved, reject Intermediate call; record set transfer already active 90h reserved, pass Invalid logical start address 92h reserved, pass Illegal Type for ANY Pointer 93h reserved, pass The DP component addressed via ID or F_ID is not configured. A0h read error Negative acknowledgement while reading the module. A1h write error Negative acknowledgement while writing the module. A2h module failure at layer 2 A3h reserved, pass DP protocol error with Direct-Data-Link-Mapper or User-Interface/User A4h reserved, pass Bus communication disrupted A5h reserved, pass A7h reserved, pass DP slave or module is occupied (temporary error) A8h version conflict DP slave or module reports noncompatible versions A9h feature not supported Feature not supported by DP slave or module AA ... AFh user specific DP slave or module reports a manufacturer specific error in its application. Please check the documentation from the manufacturer of the DP slave or module. B0h invalid index Record set not known in module illegal record set number ≥256. B1h write length error Wrong length specified in parameter RECORD; with SFB 54: length error in AINFO. B2h invalid slot Configured slot not occupied. B3h type conflict Actual module type not equal to specified module type B4h invalid area DP slave or module reports access to an invalid area B5h state conflict DP slave or module not ready B6h access denied DP slave or module denies access continued ... HB00E - OPL_STD - Rev. 14/22 3-29 Manual VIPA Operation List Standard Chapter 3 Integrated SFBs ... continue STATUS[3] Error_Decode Error_Code_1 80h B7h Explanation according to DP-V1 invalid range B8h invalid parameter B9h invalid type BAh ... BFh user specific C0h read constrain conflict C1h write constrain conflict C2h resource busy C3h resource unavailable C4h C5h C6h C7h C8h ... CFh Dxh 81h 00h ... FFh 00h 3-30 user specific Description DP slave or module reports an invalid range for a parameter or value DP slave or module reports an invalid parameter DP slave or module reports an invalid type DP slave or module reports a manufacturer specific error when accessing. Please check the documentation from the manufacturer of the DP slave or module. The module has the record set, however, there are no read data yet. The data of the previous write request to the module for the same record set have not yet been processed by the module. The module currently processes the maximum possible jobs for a CPU. The required operating resources are currently occupied. Internal temporary error. Job could not be carried out. Repeat the job. If this error occurs often, check your plant for sources of electrical interference. DP slave or module not available Record set transfer was canceled due to priority class cancellation Job canceled due to restart of DP masters DP slave or module reports a manufacturer specific resource error. Please check the documentation from the manufacturer of the DP slave or module. DP slave specific, Refer to the description of the DP slaves. Error in the initial call parameter (with SFB 54: MODE) Illegal operating mode continued ... HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard ... continue STATUS[3] Error_Decode Error_Code_1 82h ... 88h 00h ... FFh ... 00h ... FFh 01h 23h 24h 32h 3Ah 89h 00h ... FFh 01h 23h 24h 32h 3Ah 8Ah ... 8Fh FEh, FFh 00h ... FFh ... 00h ... FFh HB00E - OPL_STD - Rev. 14/22 Explanation according to DP-V1 Chapter 3 Integrated SFBs Description Error in the 2. call parameter. ... Error in the 8. call parameter (with SFB 54: TINFO) Wrong syntax ID Quantity frame exceeded or target area too small Wrong range ID DB/DI no. out of user range DB/DI no. is NULL for area ID DB/DI or specified DB/DI does not exist. Error in the 9. call parameter (with SFB 54: AINFO) Wrong syntax ID Quantity frame exceeded or target area too small Wrong range ID DB/DI no. out of user range DB/DI no. is NULL for area ID DB/DI or specified DB/DI does not exist Error in the 10. call parameter ... Error in the 15. call parameter Profile-specific error 3-31 Chapter 3 Integrated SFBs 3-32 Manual VIPA Operation List Standard HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Chapter 4 Integrated Standard SFCs Chapter 4 Integrated Standard SFCs Overview Here the description of the integrated standard SFCs of the VIPA standard CPUs of the systems 100V, 200V, 300V and 500V may be found. The description of the SFCs of the VIPA library may be found at the chapter "VIPA specific blocks". Content Topic Page Integrated Standard SFCs .............................................. 4-1 Chapter 4 Overview Integrated standard SFCs..................................................... 4-3 General and Specific Error Information RET_VAL................................ 4-5 SFC 0 - SET_CLK - Set system clock .................................................. 4-8 SFC 1 - READ_CLK - Read system clock ............................................ 4-9 SFC 2 ... 4 - Run-time meter .............................................................. 4-10 SFC 2 - SET_RTM - Set run-time meter............................................. 4-11 SFC 3 - CTRL_RTM - Control run-time meter .................................... 4-12 SFC 4 - READ_RTM - Read run-time meter....................................... 4-13 SFC 5 - GADR_LGC - Logical address of a channel .......................... 4-14 SFC 6 - RD_SINFO - Read start information...................................... 4-16 SFC 12 - D_ACT_DP - Activating and Deactivating of DP slaves....... 4-18 SFC 13 - DPNRM_DG - Read diagnostic data of a DP slave ............. 4-23 SFC 14 - DPRD_DAT - Read consistent data .................................... 4-26 SFC 15 - DPWR_DAT - Write consistent data ................................... 4-28 SFC 17 - ALARM_SQ and SFC 18 - ALARM_S ................................. 4-30 SFC 19 - ALARM_SC - Acknowledgement state last Alarm ............... 4-33 SFC 20 - BLKMOV - Block move........................................................ 4-34 SFC 21 - FILL - Fill a field .................................................................. 4-36 SFC 22 - CREAT_DB - Create a data block ....................................... 4-38 SFC 23 - DEL_DB - Deleting a data block.......................................... 4-40 SFC 24 - TEST_DB - Test data block ................................................ 4-41 SFC 28 ... 31 - Time-of-day interrupt.................................................. 4-42 SFC 32 - SRT_DINT - Start time-delay interrupt ................................ 4-46 SFC 33 - CAN_DINT - Cancel time-delay interrupt............................. 4-47 SFC 34 - QRY_DINT - Query time-delay interrupt.............................. 4-48 SFC 36 - MSK_FLT - Mask synchronous errors ................................. 4-49 SFC 37 - DMSK_FLT - Unmask synchronous errors.......................... 4-50 SFC 38 - READ_ERR - Read error register........................................ 4-51 SFC 39 - DIS_IRT - Disabling interrupts............................................. 4-52 SFC 40 - EN_IRT - Enabling interrupts .............................................. 4-54 SFC 41 - DIS_AIRT - Delaying interrupts ........................................... 4-55 SFC 42 - EN_AIRT - Enabling delayed interrupts............................... 4-56 HB00E - OPL_STD - Rev. 14/22 4-1 Chapter 4 Integrated Standard SFCs Manual VIPA Operation List Standard SFC 43 - RE_TRIGR - Retrigger the watchdog .................................. 4-56 SFC 44 - REPL_VAL - Replace value to AKKU1................................ 4-57 SFC 46 - STP - STOP the CPU.......................................................... 4-57 SFC 47 - WAIT - Delay the application program ................................ 4-58 SFC 49 - LGC_GADR - Read the slot address................................... 4-59 SFC 50 - RD_LGADR - Read all logical addresses of a module ........ 4-60 SFC 51 - RDSYSST - Read system status list SSL............................ 4-61 SFC 52 - WR_USMSG - Write user entry into diagnostic buffer......... 4-63 SFC 54 - RD_DPARM - Read predefined parameter ......................... 4-67 SFC 55 - WR_PARM - Write dynamic parameter............................... 4-69 SFC 56 - WR_DPARM - Write default parameter............................... 4-72 SFC 57 - PARM_MOD - Parameterize module................................... 4-74 SFC 58 - WR_REC - Write record...................................................... 4-76 SFC 59 - RD_REC - Read record....................................................... 4-79 SFC 64 - TIME_TCK - Read system time tick .................................... 4-82 SFC 65 - X_SEND - Send data .......................................................... 4-83 SFC 66 - X_RCV - Receive data ........................................................ 4-86 SFC 67 - X_GET - Read data ............................................................ 4-91 SFC 68 - X_PUT - Write data............................................................. 4-95 SFC 69 - X_ABORT - Disconnect ...................................................... 4-98 SFC 81 - UBLKMOV - Copy data area without gaps ........................ 4-101 4-2 HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Chapter 4 Integrated Standard SFCs Overview Integrated standard SFCs Standard SFCs The following standard system functions (SFCs) are available: SFC SFC 0 SFC 1 SFC 2 SFC 3 SFC 4 SFC 5 SFC 6 SFC 12 SFC 13 SFC 14 Label SET_CLK READ_CLK SET_RTM CTRL_RTM READ_RTM GADR_LGC RD_SINFO D_ACT_DP DPNRM_DG DPRD_DAT SFC 15 DPWR_DAT SCF 17 SFC 18 SFC 19 SFC 20 1) 1) SFC 21 SFC 22 SFC 23 SFC 24 SFC 28 SFC 29 SFC 30 SFC 31 SFC 32 SFC 33 SFC 34 SFC 36 SFC 37 SFC 38 SFC 39 SFC 40 SFC 41 SFC 42 SFC 43 SFC 44 SFC 46 SFC 47 1) SFC 49 SFC 50 ALARM_SQ ALARM_S ALARM_SC BLKMOV FILL CREAT_DB DEL_DB TEST_DB SET_TINT CAN_TINT ACT_TINT QRY_TINT SRT_DINT CAN_DINT QRY_DINT MSK_FLT DMSK_FLT READ_ERR DIS_IRT EN_IRT DIS_AIRT EN_AIRT RE_TRIGR REPL_VAL STP WAIT LGC_GADR RD_LGADR Description Set time Read time Set operating hour counter Start/stop operating hour counter Read operating hour counter Search logical address of a channel (only modules in rack 0) Read start information of the current OB Activate or deactivate DP slaves Read slave diagnostic data Read consistent user data (also from DP slaves → DP master FW ≥ V3.00) Write consistent user data (also to DP slaves → DP master FW ≥ V3.00) Create acknowledgeable block related messages Create not acknowledgeable block related messages Acknowledgement state of the last Alarm SQ-arrived-message Copy variable within work memory Preset field within work memory Create data block Delete data block Test data block Set time interrupt Cancel time interrupt Activate time interrupt Request time interrupt Start delay interrupt Cancel delay interrupt Request delay interrupt Mask synchronal error event De-mask synchronal error event Read event status register Disabling interrupts Enabling interrupts Delay of interrupt events Abrogate delay of interrupt events Re-trigger cycle time control Transfer replacement value to AKKU1 Switch CPU in STOP Delay program execution additionally to wait time Search plug-in location of a logical address Search all logical addresses of a module continued ... HB00E - OPL_STD - Rev. 14/22 4-3 Chapter 4 Integrated Standard SFCs Manual VIPA Operation List Standard ... continue Standard SFCs SFC Label Description SFC 51 RDSYSST Read information from the system state list SFC 52 WR_USMSG Write user entry in diagnostic buffer (send via MPI in preparation) SFC 54 RD_DPARM Read predefined parameters SFC 55 WR_PARM Write dynamic parameters (only for analog-, digital modules, FMs, CPs and via PROFIBUS DP-V1 possible) SFC 56 WR_DPARM Write predefined parameters (only for analog-, digital modules, FMs, CPs and via PROFIBUS DP-V1 possible) SFC 57 PARM_MOD Parameterize module (only for analog-, digital modules, FMs, CPs and via PROFIBUS DP-V1 possible) SFC 58 WR_REC Write record set (only for analog-, digital modules, FMs, CPs and via PROFIBUS DP-V1 possible) SFC 59 RD_REC Read record set (only for analog-, digital modules, FMs, CPs and via PROFIBUS DP-V1 possible) 1) SFC 64 TIME_TCK Read millisecond timer SFC 65 X_SEND Send data to external partner SFC 66 X_RCV Receive data from external partner SFC 67 X_GET Read data from external partner SFC 68 X_PUT Write data to external partner SFC 69 X_ABORT Interrupt connection to external partner SFC 81 UBLKMOV Copy variable non-interruptible 1) This function block is interruptable and does not affect the interrupt reaction time. 4-4 HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Chapter 4 Integrated Standard SFCs General and Specific Error Information RET_VAL Overview The return value RET_VAL of a system function provides one of the following types of error codes: • A general error code, that relates to errors that can occur in anyone SFC. • A specific error code, that relates only to the particular SFC. Although the data type of the output parameter RET_VAL is integer (INT), the error codes for system functions are grouped according to hexadecimal values. If you want to examine a return value and compare the value with the error codes, then display the error code in hexadecimal format. RET_VAL (Return value) The table below shows the structure of a system function error code: Bit 7 ... 0 14 ... 8 15 Specific error code Description Event number or error class and single error Bit 14 ... 8 = "0": Specific error code The specific error codes are listed in the descriptions of the individual SFCs. Bit 14 ... 8 > "0": General error code The possible general error codes are shown Bit 15 = "1": indicates that an error has occurred. This error code indicates that an error pertaining to a particular system function occurred during execution of the function. A specific error code consists of the following two numbers: • Error class between 0 and 7 • Error number between 0 and 15 Bit 3 ... 0 6 ... 4 7 14 ... 8 15 HB00E - OPL_STD - Rev. 14/22 Description Error number Error class Bit 7 = "1" Bit 14 ... 8 = "0" Bit 15 = "1": indicates that an error has occurred. 4-5 Chapter 4 Integrated Standard SFCs General error codes RET_VAL Manual VIPA Operation List Standard The parameter RET_VAL of some SFCs only returns general error information. No specific error information is available. The general error code contains error information that can result from any system function. The general error code consists of the following two numbers: • A parameter number between 1 and 111, where 1 indicates the first parameter of the SFC that was called, 2 the second etc. • An event number between 0 and 127. The event number indicates that a synchronous fault has occurred. Bit 7 ... 0 14 ... 8 15 Description Event number Parameter number Bit 15 = "1": indicates that an error has occurred. The following table explains the general error codes associated with a return value. Error codes are shown as hexadecimal numbers. The x in the code number is only used as a placeholder. The number represents the parameter of the system function that has caused the error. General error codes Error code Description 8x7Fh Internal Error. This error code indicates an internal error at parameter x. This error did not result from the actions if the user and he/she can therefore not resolve the error. 8x22h Area size error when a parameter is being read. 8x23h Area size error when a parameter is being written. This error code indicates that parameter x is located either partially or fully outside of the operand area or that the length of the bit-field for an ANY-parameter is not divisible by 8. 8x24h Area size error when a parameter is being read. 8x25h Area size error when a parameter is being written. This error code indicates that parameter x is located in an area that is illegal for the system function. The description of the respective function specifies the areas that are not permitted for the function. 8x26h The parameter contains a number that is too high for a time cell. This error code indicates that the time cell specified in parameter x does not exist. 8x27h The parameter contains a number that is too high for a counter cell (numeric fields of the counter). This error code indicates that the counter cell specified in parameter x does not exist. continued ... 4-6 HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard ... continue Error code 8x28h 8x29h 8x30h 8x31h 8x32h 8x34h 8x35h 8x3Ah 8x3Ch 8x3Eh 8x42h 8x43h 8x44h 8x45h Chapter 4 Integrated Standard SFCs Description Orientation error when reading a parameter. Orientation error when writing a parameter. This error code indicates that the reference to parameter x consists of an operand with a bit address that is not equal to 0. The parameter is located in the write-protected global-DB. The parameter is located in the write-protected instance-DB. This error code indicates that parameter x is located in a write-protected data block. If the data block was opened by the system function itself, then the system function will always return a value 8x30h. The parameter contains a DB-number that is too high (number error of the DB). The parameter contains a FC-number that is too high (number error of the FC). The parameter contains a FB-number that is too high (number error of the FB). This error code indicates that parameter x contains a block number that exceeds the maximum number permitted for block numbers. The parameter contains the number of a DB that was not loaded. The parameter contains the number of a FC that was not loaded. The parameter contains the number of a FB that was not loaded. An access error occurred while the system was busy reading a parameter from the peripheral area of the inputs. An access error occurred while the system was busy writing a parameter into den peripheral area of the outputs. Error during the n-th (n > 1) read access after an error has occurred. Error during the n-th (n > 1) write access after an error has occurred. This error code indicates that access was denied to the requested parameter. HB00E - OPL_STD - Rev. 14/22 4-7 Chapter 4 Integrated Standard SFCs Manual VIPA Operation List Standard SFC 0 - SET_CLK - Set system clock Description The SFC 0 SET_CLK (set system clock) sets the time of day and the date of the clock in the CPU. The clock continues running from the new time and date. If the clock is a master clock then the call to SFC 0 will start a clock synchronization cycle as well. The clock synchronization intervals are defined by hardware settings. Parameters Parameter Declaration Data type PDT INPUT DT RET_VAL OUTPUT INT Memory block D, L I, Q, M, D, L Description Enter the new date and time at PDT. When an error occurs while the function is being processed then the returned value contains the respective error code. Date and time are entered as data type DT. PDT Example: date: 04.27.2006, time: 14:15:55 → DT#2006-04-27-14:15:55. The time can only be entered with one-second accuracy. The day of the week is calculated automatically by SFC 0. Remember that you must first create the data type DT by means of FC 3 D_TOD_DT before you can supply it to the input parameter (see time functions; FC 3, FC 6, FC 7, FC 8, FC 33, FC 40, FC 1, FC 35, FC 34). RET_VAL (Return value) Value 0000h 8080h 8081h 4-8 Description no error error in the date error in the time HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Chapter 4 Integrated Standard SFCs SFC 1 - READ_CLK - Read system clock The SFC 1 READ_CLK (read system clock) reads the contents of the CPU clock. This returns the current time and date. Description Parameters Parameter Declaration RET_VAL OUTPUT Data type Memory block INT I, Q, M, D, L CDT DT OUTPUT D, L Description If an error occurs when this function is being processed the return value contains the error code. The current date and time are available at output CDT. RET_VAL (Return value) SFC 1 does not return any specific error information. CDT The current date and time are available at output CDT. HB00E - OPL_STD - Rev. 14/22 4-9 Chapter 4 Integrated Standard SFCs Manual VIPA Operation List Standard SFC 2 ... 4 - Run-time meter Description VIPA CPUs have 8 run-time meters. You can use: SFC 2 SET_RTM set run-time meter SFC 3 CTRL_RTM run-time meter starting / stopping SFC 4 READ_RTM read run-time meter You can use a runtime meter for a variety of applications: • for measuring the runtime of a CPU • for measuring the runtime of controlled equipment or connected devices. Characteristics When it is started, the runtime meter begins to count starting at the last recorded value. If you want it to start at a different initial value, you must explicitly specify this value with the SFC 2. If the CPU changes to the STOP mode, or you stop the runtime meter, the CPU records the current value of the runtime meter. When a restart of the CPU is executed, the runtime meter must be restarted with the SFC 3. Range of values The runtime meter has a range of value from 0 ... 32767 hours. 4-10 HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Chapter 4 Integrated Standard SFCs SFC 2 - SET_RTM - Set run-time meter The SFC 2 SET_RTM (set run-time meter) sets the run-time meter of the CPU to the specified value. VIPA CPUs contain 8 run-time meters. Description Parameters Parameter Declaration NR INPUT Data type BYTE Memory block I, Q, M, D, L, constant PV INPUT INT RET_VAL OUTPUT INT I, Q, M, D, L, constant I, Q, M, D, L Description Input NR contains the number of the run-time meter that you wish to set. Range: 0 ... 7 Input PV contains the setting for the run-time meter. The return value contains an error code if an error is detected when the function is being processed. RET_VAL (Return value) Value 0000h 8080h 8081h Description no error Incorrect number for the run-time meter A negative value was supplied to parameter PV. HB00E - OPL_STD - Rev. 14/22 4-11 Chapter 4 Integrated Standard SFCs Manual VIPA Operation List Standard SFC 3 - CTRL_RTM - Control run-time meter The SFC 3 CTRL_RTM (control run-time meter) starts or stops the runtime meter depending on the status of input S. Description Parameters Parameter Declaration Data type Memory block NR INPUT BYTE I, Q, M, D, L, constant S INPUT BOOL I, Q, M, D, L, constant RET_VAL OUTPUT INT I, Q, M, D, L Description Input NR contains the number of the run-time meter that you wish to set. Range: 0 ... 7 Input S starts or stops the run-time meter. Set this signal to "0" to stop the run-time meter. Set this signal to "1" to start the run-time meter. The return value contains an error code if an error is detected when the function is being processed. RET_VAL (Return value) Value 0000h 8080h 4-12 Description no error Incorrect number for the run-time meter HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Chapter 4 Integrated Standard SFCs SFC 4 - READ_RTM - Read run-time meter The SFC 4 READ_RTM (read run-time meter) reads the contents of the run-time meter. The output data indicates the current run-time and the status of the meter ("stopped" or "started"). When the run-time meter has been active for more than 32767 hours it will stop with this value and return value RET_VAL indicates the error message "8081h: overflow". Description Parameters Parameter Declaration NR INPUT Data type BYTE Memory block I, Q, M, D, L, constant RET_VAL OUTPUT INT I, Q, M, D, L CQ OUTPUT BOOL I, Q, M, D, L CV OUTPUT INT I, Q, M, D, L Description Input NR contains the number of the run-time meter that you wish to read. Range: 0 ... 7 The return value contains an error code if an error is detected when the function is being processed. Output CQ indicates whether the runtime meter is started or stopped. • "0": the status of the run-time meter is stopped. • "1": the status of the run-time meter is started. Output CV indicates the up to date value of the run-time meter. RET_VAL (Return value) Value 0000h 8080h 8081h Description no error Incorrect number for the run-time meter run-time meter overflow HB00E - OPL_STD - Rev. 14/22 4-13 Manual VIPA Operation List Standard Chapter 4 Integrated Standard SFCs SFC 5 - GADR_LGC - Logical address of a channel Description Parameters Parameter SUBNETID The SFC 5 GADR_LGC (convert geographical address to logical address) determines the logical address of the channel of a I/O module. RET_VAL Declaration Data type Memory block INPUT BYTE I, Q, M, D, L, constant INPUT WORD I, Q, M, D, L, constant INPUT WORD I, Q, M, D, L, constant INPUT BYTE I, Q, M, D, L, constant INPUT WORD I, Q, M, D, L, constant OUTPUT INT I, Q, M, D, L IOID LADDR OUTPUT OUTPUT RACK SLOT SUBSLOT SUBADDR BYTE WORD I, Q, M, D, L I, Q, M, D, L Description area identifier Rack No. Slot-No. Sub-module slot Offset in user-data address space of the module The return value contains an error code if an error is detected when the function is being processed. area identifier Logical base address for the module SUBNETID area identifier: • "0": if the module is put locally (including expansion rack). • DP-master-system-ID of the respective decentralized peripheral system when the slot is located in one of the decentralized peripheral devices. Rack Rack No., when the address space identification is 0 Station number of the decentralized Peripheral device when falls the area identification >0 SLOT Slot-Number SUBSLOT Sub-module slot (when sub-modules cannot be inserted this parameter must be 0) SUBADDR Offset in user-data address space of the module 4-14 HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard RET_VAL (Return value) Value Chapter 4 Integrated Standard SFCs The return value contains an error code if an error is detected when the function is being processed. 0000h Description no error 8094h No subnet with the specified SUBNETID configured. 8095h Illegal value for parameter RACK 8096h Illegal value for parameter SLOT 8097h Illegal value for parameter SUBSLOT 8098h Illegal value for parameter SUBADDR 8099h The slot has not been configured. 809Ah The sub address for the selected slot has not been configured. IOID Area identifier: • 54h: peripheral input (PI) • 55h: peripheral output (PQ) For hybrid modules the SFC returns the area identification of the lower address. When the addresses are equal the SFC returns identifier 54h. LADDR Logical base address for the module HB00E - OPL_STD - Rev. 14/22 4-15 Chapter 4 Integrated Standard SFCs Manual VIPA Operation List Standard SFC 6 - RD_SINFO - Read start information Description The SFC 6 RD_SINFO (read start information) retrieves the start information of the last OB accessed and that has not yet been processed completely, as well as the last startup OB. These start information items do not contain a time stamp. Two identical start information items will be returned when the call is issued from OB 100. Parameters Parameter RET_VAL Declaration Data type Memory block OUTPUT INT I, Q, M, D, L TOP_SI START_UP_SI OUTPUT OUTPUT TOP_SI and START_UP_SI STRUCT D, L STRUCT D, L Description The return value contains an error code if an error is detected when the function is being processed. Start information of the current OB Start information of the last OB that was started This refers to two identical structures as shown below. Structure element EV_CLASS Data type Description BYTE EV_NUM PRIORITY NUM BYTE BYTE BYTE TYP2_3 TYP1 ZI1 ZI2_3 BYTE BYTE WORD DWORD Bits 3 ... 0: event identifier Bits 7 ... 4: event class 1: Start events of standard-OBs 2: Start events of synchronous-error OBs 3: Start events of asynchronous-error OBs event number Number defining the priority level Structure element NUM contains the number of the current OB or of the last OB started Data identifier 2_3: identifies the information entered into ZI2_3 Data identifier 1: identifies the information entered into ZI1 Additional information 1 Additional information 2_3 4-16 HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Chapter 4 Integrated Standard SFCs Note! The content of the structure elements shown in the table above corresponds exactly with the temporary variables of an OB. It must be remembered, however, that the name and the data type of the temporary variables in the different OBs might differ. Furthermore, the call interface of the OBs also contains the date and time at which call to the OB was requested. RET_VAL (Return value) The SFC 6 only returns general error information. No specific error information is available. Example The OB that was called last and that has not yet been completely processed serves as OB 80; the restart OB that was started last serves as OB 100. The following table shows the assignment of the structure elements of parameter TOP_SI of SFC 6 and the respective local variables of OB 80. TOP_SI Structure element EV_CLASS EV_NUM PRIORITY NUM TYP2_3 TYP1 ZI1 ZI2_3 Data type Logical Variable Data type BYTE BYTE BYTE BYTE BYTE BYTE WORD DWORD OB100_EV_CLASS OB80_FLT_ID OB80_PRIORITY OB80_OB_NUMBR OB80_RESERVED_1 OB80_ RESERVED_2 OB80_ERROR_INFO OB80_ERR_EV_CLASS OB80_ERR_EV_NUM OB80_OB_PRIORITY OB80_OB_NUM BYTE BYTE BYTE BYTE BYTE BYTE WORD BYTE BYTE BYTE BYTE The following table shows the assignment of the structure elements of parameter START_UP_SI of SFC 6 and the respective local variables of OB 100. START_UP_SI Structure element EV_CLASS EV_NUM PRIORITY NUM TYP2_3 TYP1 ZI1 ZI2_3 HB00E - OPL_STD - Rev. 14/22 Data type Logical Variable Data type BYTE BYTE BYTE BYTE BYTE BYTE WORD DWORD OB100_EV_CLASS OB100_STRTUP OB100_PRIORITY OB100_OB_NUMBR OB100_RESERVED_1 OB100_ RESERVED_2 OB100_STOP OB100_STRT_INFO BYTE BYTE BYTE BYTE BYTE BYTE WORD DWORD 4-17 Chapter 4 Integrated Standard SFCs Manual VIPA Operation List Standard SFC 12 - D_ACT_DP - Activating and Deactivating of DP slaves Description With the SFC 12 D_ACT_DP, you can specifically deactivate and reactivate configured DP slaves. In addition, you can determine whether each assigned DP slave is currently activated or deactivated. The SFC 12 cannot be used on PROFIBUS PA field devices, which are connected by a DP/PA link to a DP master system. Note! As long as any SFC 12 job is busy you cannot download a modified configuration from your PG to the CPU. The CPU rejects initiation of an SFC 12 request when it receives the download of a modified configuration. Application If you configure DP slaves in a CPU, which are not actually present or not currently required, the CPU will nevertheless continue to access these DP slaves at regular intervals. After the slaves are deactivated, further CPU accessing will stop. In this way, the fastest possible DP bus cycle can be achieved and the corresponding error events no longer occur. Example Every one of the possible machine options is configured as a DP slave by the manufacturer in order to create and maintain a common user program having all possible options. With the SFC 12, you can deactivate all DP slaves, which are not present at machine startup. How the SFC operates The SFC 12 operates asynchronously, in other words, it is executed over several SFC calls. You start the request by calling the SFC 12 with REQ = 1. The status of the job is indicated by the output parameters RET_VAL and BUSY. Identifying a job If you have started a deactivation or activation job and you call the SFC 12 again before the job is completed, the way in which the SFC reacts depends largely on whether the new call involves the same job: if the parameter LADDR matches, the SFC call is interpreted as a follow-on call. 4-18 HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Deactivating DP slaves Chapter 4 Integrated Standard SFCs When you deactivate a DP slave with the SFC 12, its process outputs are set to the configured substitute values or to "0" (secure state). The assigned DP master does not continue to address this DP slave. Deactivated DP slaves are not identified as fault or missing by the error LEDs on the DP master or CPU. The process image of the inputs of deactivated DP slaves is updated with 0, that is, it is handled just as for failed DP slaves. Note! With VIPA you can not deactivate all DP slaves. At least 1 slave must remain activated at the bus. If you are using your program to directly access the user data of a previously deactivated DP slave, the I/O access error OB (OB 122) is called, and the corresponding start event is entered in the diagnostic buffer. If you attempt to access a deactivated DP slave with SFC (i.e. SFC 59 RD_REC), you receive the error information in RET_VAL as for an unavailable DP slave. Deactivating a DP slaves OB 85, even if its inputs or outputs belong to the system-side process image to be updated. No entry is made in the diagnostic buffer. Deactivating a DP slave does not start the slave failure OB 86, and the operating system also does not make an entry in the diagnostic buffer. If a DP station fails after you have deactivated it with the SFC 12, the operating system does not detect the failure. As a result, there is no subsequent start of OB 86 or diagnostic buffer entry. The station failure is detected only after the station has been reactivated and indicated in RET_VAL. If you wish to deactivate DP slaves functioning as transmitters in cross communication, we recommend that you first deactivate the receivers (listeners) that detect, which input data the transmitter is transferring to its DP master. Deactivate the transmitter only after you have performed this step. HB00E - OPL_STD - Rev. 14/22 4-19 Chapter 4 Integrated Standard SFCs Activating DP slaves Manual VIPA Operation List Standard When you reactivate a DP slave with the SFC 12 it is configured and assigned parameters by the designated DP master (as with the return of a failed station). This activation is completed when the slave is able to transfer user data. Activating a DP slaves does not start the program error OB 85, even if its inputs or outputs belong to the system-side process image to be updated. An entry in the diagnostic buffer is also not made. Activating a DP slave does not start the slave failure OB 86, and the operating system also does not make an entry in the diagnostic buffer. If you attempt to use the SFC 12 to activate a slave, who has been deactivated and is physically separated from the DP bus, a supervision time of 10sec expires. After this monitoring period has expired, the SFC returns the error message 80A2h. The slave remains deactivated. If the slave is reconnected to the DP bus at a later time, it must be reactivated with the SFC 12. Note! Activating a DP slave may be time-consuming. Therefore, if you wish to cancel a current activation job, start the SFC 12 again with the same value for LADDR and MODE = 2. Repeat the call of the SFC 12 until successful cancellation of the activation is indicated by RET_VAL = 0. If you wish to activate DP slaves which take part in the cross communication, we recommend that you first activate the transmitters and then the receivers (listeners). CPU startup At a restart the slaves are activated automatically. After the CPU start-up, the CPU cyclically attempts to contact all configured and not deactivated slaves that are either not present or not responding. Note! The startup OB 100 does not support the call of the SFC 12. 4-20 HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Parameters Parameter REQ Chapter 4 Integrated Standard SFCs Declaration Data type Memory block INPUT BOOL I, Q, M, D, L, constant MODE INPUT BYTE I, Q, M, D, L, constant LAADR INPUT WORD RET_VAL OUTPUT INT I, Q, M, D, L, constant I, Q, M, D, L BUSY OUTPUT BOOL I, Q, M, D, L Description Level-triggered control parameter REQ = 1: execute activation or deactivation Job ID Possible values: 0: request information on whether the addressed DP slave is activated or deactivated. 1: activate the DP slave 2: deactivate the DP slave Any logical address of the DP slave If an error occurs while the function is processed, the return value contains an error code. Active code: BUSY = 1: the job is still active. BUSY = 0: the job was terminated. RET_VAL (Return value) Value 0000h 0001h 0002h 7000h 7001h 7002h 8090h Description The job was completed without errors. The DP slave is active (This error code is possible only with MODE = 0.) The DP slave is deactivated (This error code is possible only with MODE = 0.) First call with REQ = 0. The job specified with LADDR is not active; BUSY has the value 0. First call with REQ = 1. The job specified with LADDR was triggered; BUSY has the value 1. Interim call (REQ irrelevant). The activated job is still active; BUSY has the value 1. You have not configured a module with the address specified in LADDR. You operate your CPU as I-Slave and you have specified in LADDR an address of this slave. continued ... HB00E - OPL_STD - Rev. 14/22 4-21 Chapter 4 Integrated Standard SFCs ... continue Value 8092h 8093h 80A1h 80A2h 80A3h 80A4h 80A6h 80C1h 80C3h F001h F002h 4-22 Manual VIPA Operation List Standard Description For the addressed DP slave no activation job is processed at the present. (This error code is possible only with MODE = 1.) No DP slave is assigned to the address stated in LADDR (no projection submitted), or the parameter MODE is not known. The addressed DP slave could not be parameterized. (This error code is possible only with MODE = 1.) Note! The SFC supplies this information only if the activated slave fails again during parameterization. If parameterization of a single module was unsuccessful the SFC returns the error information 0000h. The addressed DP slave does not return an acknowledgement. The DP master concerned does not support this function. The CPU does not support this function for external DP masters. Slot error in the DP slave; user data access not possible. (This error code is possible only with MODE = 1.) Note! The SFC returns this error information only if the active slave fails after parameterization and before the SFC ends. If only a single module is unavailable the SFC returns the error information 0000h. The SFC 12 was started and continued with another logical address. (This error code is possible only with MODE = 1.) • Temporary resource error: the CPU is currently processing the maximum possible activation and deactivation jobs. (this error code is possible only with MODE = 1 and MODE = 2). • The CPU is busy receiving a modified configuration. Currently you cannot enable/disable DP slaves. Not all slaves may be deactivated. At least 1 slave must remain activated. Unknown slave address HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Chapter 4 Integrated Standard SFCs SFC 13 - DPNRM_DG - Read diagnostic data of a DP slave Description The SFC 13 DPNRM_DG (read diagnostic data of a DP slave) reads up-todate diagnostic data of a DP slave. The diagnostic data of each DP slave is defined by EN 50 170 Volume 2, PROFIBUS. Input parameter RECORD determines the target area where the data read from the slave is saved after it has been transferred without error. The read operation is started when input parameter REQ is set to 1. The following table contains information about the principal structure of the slave diagnosis. For additional information please refer to the manuals for the DP slaves that you are using. Byte 0 1 2 3 4 5 6 ... description station status 1 station status 2 station status 3 master-station number manufacturer code (high byte) manufacturer code (low byte) additional slave-specific diagnostics Operation The SFC 13 is executed as asynchronous SFC, i.e. it can be active for multiple SFC-calls. Output parameters RET_VAL and BUSY indicate the status of the command as shown by the following table. Relationship between the call, REQ, RET_VAL and BUSY: Seq. No. of the call 1 Type of call first call REQ 1 2 ... (n-1) intermediate call last call irrelevant n HB00E - OPL_STD - Rev. 14/22 irrelevant RET_VAL 7001h or Error code 7002h If the command was completed without errors, then the number of bytes returned is entered as a positive number or the error code if an error did occur. BUSY 1 0 1 0 4-23 Manual VIPA Operation List Standard Chapter 4 Integrated Standard SFCs Parameters Parameter REQ RET_VAL Declaration Data type Memory block INPUT BOOL I, Q, M, D, L, constant INPUT WORD I, Q, M, D, L, constant OUTPUT INT I, Q, M, D, L RECORD OUTPUT ANY I, Q, M, D, L BUSY OUTPUT BOOL I, Q, M, D, L LADDR RECORD Description REQ = 1: read request The configured diagnostic address of the DP slave The return value contains an error code if an error is detected when the function is being processed. If no error did occur, then RET_VAL contains the length of the data that was transferred. Target area for the diagnostic data that has been read. Only data type BYTE is valid. The minimum length of the read record or respectively the target area is 6. The maximum length of the read record is 240. When the standard diagnostic data exceeds 240bytes on a norm slave and the maximum is limited to 244bytes, then only the first 240bytes are transferred into the target area and the respective overflow-bit is set in the data. BUSY = 1: read operation has not been completed. The CPU tests the actual length of the diagnostic data that was read: When the length of RECORD • is less than the amount of data the data is discarded and the respective error code is entered into RET_VAL. • is larger than or equal to the amount of data then the data is transferred into the target areas and RET_VAL is set to the actual length as a positive value. Note! It is essential that the matching RECORD parameters are be used for all calls that belong to a single task. A task is identified clearly by input parameter LADDR and RECORD. 4-24 HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Chapter 4 Integrated Standard SFCs Norm slaves The following conditions apply if the amount of standard diagnostic data of the norm slave lies between 241 and 244bytes: When the length of RECORD • is less than 240bytes the data is discarded and the respective error code is entered into RET_VAL. • is greater than 240bytes, then the first 240bytes of the standard diagnostic data are transferred into the target area and the respective overflow-bit is set in the data. RET_VAL (Return value) The return value contains an error code if an error is detected when the function is being processed. If no error did occur, then RET_VAL contains the length of the data that was transferred. Note! The amount of read data for a DP slave depends on the diagnostic status. Error information More detailed information about general error information is to be found at the beginning of this chapter. The SFC 13 specific error information consists of a subset of the error information for SFC 59 RD_REC. More detailed information is available from the help for SFC 59. HB00E - OPL_STD - Rev. 14/22 4-25 Chapter 4 Integrated Standard SFCs Manual VIPA Operation List Standard SFC 14 - DPRD_DAT - Read consistent data Description The SFC 14 DPRD_DAT (read consistent data of a DP norm slave) reads consistent data from a DP norm slave. The length of the consistent data must be three or more than four bytes, while the maximum length is 64Byte. Please refer to the manual of your specific CPU for details. Input parameter RECORD defines the target area where the read data is saved when the data transfer has been completed without errors. The length of the respective target area must be the same as the length that you have configured for the selected module. If the module consists of a DP-norm slave of modular construction or with multiple DP-identifiers, then a single SFC 14 call can only access the data of a single module / DP-identifier at the configured start address. SFC 14 is used because a load command accessing the periphery or the process image of the inputs can read a maximum of four contiguous bytes. Definition consistent data Consistent data is data, where the contents belongs to the same category and that may not be separated. It is, for instance, important that data returned by analog modules is always processed consistently, i.e. the value returned by analog modules must not be modified incorrectly when it is read at two different times. Parameters Parameter Declaration LADDR INPUT Data type Memory block WORD I, Q, M, D, L, constant RET_VAL OUTPUT INT I, Q, M, D, L RECORD OUTPUT ANY I, Q, M, D, L 4-26 Description Configured start address of the receive data buffer of the module from which the data must be read The return value contains an error code if an error is detected when the function is being processed Target area for the user data that was read. The length must be exactly the same as the length that was configured for the selected module. Only data type BYTE is permitted. HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Chapter 4 Integrated Standard SFCs RET_VAL (Return value) Value 0000h 8090h 8092h 8093h 80A0h 80B0h 80B1h 80B2h 80B3h 80C0h 80C2h 80Fxh 87xyh 808xh Description No error has occurred. You have not configured a module for the logical base address that you have specified, or you have ignored the restrictions that apply to the length of the consistent data. The ANY-reference contains a type that is not equal to BYTE. No DP-module from which consistent data can be read exists at the logical address that was specified under LADDR. Incorrect start address for the address range in the transfer I/O buffer. Slave failure at the external DP-interface The length of the specified target area is not equal to the configured user data length. External DP-interface system error External DP-interface system error External DP-interface system error External DP-interface system error External DP-interface system error External DP-interface system error External DP-interface system error HB00E - OPL_STD - Rev. 14/22 4-27 Chapter 4 Integrated Standard SFCs Manual VIPA Operation List Standard SFC 15 - DPWR_DAT - Write consistent data Description The SFC 15 DPWR_DAT (write consistent data to a DP-norm slave) writes consistent data that is located in parameter RECORD to the DP-norm slave. The length of the consistent data must be three or more than four bytes, while the maximum length is 64Byte. Please refer to the manual of your specific CPU for details. Data is transferred synchronously, i.e. the write process is completed when the SFC has terminated. The length of the respective source area must be the same as the length that you have configured for the selected module. If the module consists of a DP-norm slave of modular construction, then you can only access a single module of the DP-slave. The SFC 15 is used because a transfer command accessing the periphery or the process image of the outputs can write a maximum of four contiguous bytes. Definition Consistent data Consistent data is data, where the contents belongs to the same category and that may not be separated. For instance, it is important that data returned by analog modules is always processed consistently, i.e. the value returned by analog modules must not be modified incorrectly when it is read at two different times. Parameters Parameter Declaration LADDR INPUT Data type Memory block WORD I, Q, M, D, L, constant RECORD INPUT ANY I, Q, M, D, L RET_VAL OUTPUT INT I, Q, M, D, L 4-28 Description Configured start address of the output buffer of the module to which the data must be written Source area for the user data that will be written. The length must be exactly the same as the length that was configured for the selected module. Only data type BYTE is permitted. The return value contains an error code if an error is detected when the function is being processed. HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Chapter 4 Integrated Standard SFCs RET_VAL (Return value) Value 0000h 8090h 8092h 8093h 80A1h 80B0h 80B1h 80B2h 80B3h 80C1h 80C2h 80Fxh 85xyh 808xh Description No error has occurred. You have not configured a module for the logical base address that you have specified, or you have ignored the restrictions that apply to the length of the consistent data. The ANY-reference contains a type that is not equal to BYTE. No DP-module to which consistent data can be written exists at the logical address that was specified under LADDR. The selected module has failed. Slave failure at the external DP-interface The length of the specified source area is not equal to the configured user data length. External DP-interface system error External DP-interface system error The data of the write command that was previously issued to the module has not yet been processed. External DP-interface system error External DP-interface system error External DP-interface system error External DP-interface system error HB00E - OPL_STD - Rev. 14/22 4-29 Chapter 4 Integrated Standard SFCs Manual VIPA Operation List Standard SFC 17 - ALARM_SQ and SFC 18 - ALARM_S Description Every call to the SFC 17 ALARM_SQ and the SFC 18 ALARM_S generates a message that can have an associated value. This message is sent to all stations that have registered for this purpose. The call to the SFC 17 and the SFC 18 can only be issued if the value of signal SIG triggering the message was inverted with respect to the previous call. If this is not true output parameter RET_VAL will contain the respective information and the message will not be sent. Input SIG must be set to "1" when the call to the SFC 17 and SFC 18 is issued for the first time, else the message will not be sent and RET_VAL will return an error code. Note! The SFC 17 and the SFC 18 should always be called from a FB after you have assigned the respective system attributes to this FB. System resources The SFC 17 and the SFC 18 occupy temporary memory that is also used to save the last two signal statuses with a time stamp and the associated value. When the call to the SFC occurs at a time when the signal statuses of the two most recent "valid" SFC-calls has not been sent (signal overflow), then the current signal status as well as the last signal status are discarded and an overflow-code is entered into temporary memory. The signal that occurred before the last signal will be sent as soon as possible including the overflow-code. Message acknowledgement Messages sent by means of the SFC 17 can be acknowledged via a display device. The acknowledgement status for the last "message entering state" and the signal status of the last SFC 17-call may be determined by means of the SFC 19 ALARM_SC. Messages that are sent by SFC 18 are always acknowledged implicitly. The signal status of the last SFC 18-call may be determined by means of the SFC 19 ALARM_SC. 4-30 HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Chapter 4 Integrated Standard SFCs Temporarily saving The SFCs 17 and 18 occupy temporary memory that is also used to save the last two signal statuses with a time stamp and the associated value. When the call to the SFC occurs at a time when the signal statuses of the two most recent "valid" SFC-calls has not been sent (signal overflow), then the current signal status as well as the last signal status are discarded and an overflow-code is entered into temporary memory. The signal that occurred before the last signal will be sent as soon as possible including the overflow-code. Instance overflow The maximum number of SFC 17- and SFC 18-calls depends on the type of CPU being used. A resource bottleneck (instance overflow) can occur when the number of SFC-calls exceeds the maximum number of dynamic instances. This condition is signaled by means of an error condition in RET_VAL and via the registered display device. Parameters Parameter SIG ID EV_ID Declaration INPUT INPUT INPUT Data type BOOL WORD DWORD SD RET_VAL INPUT OUTPUT ANY INT SD Memory block I, Q, M, D, L I, Q, M, D, L Const. (I, Q, M, D, L) I, Q, M, D, T, C I, Q, M, D, L Description The signal that triggered the message. Data channel for messages: EEEEh Message number (0: not permitted) Associated value Error information Associated value Maximum length: 12byte Valid data types BOOL (bit field not permitted), BYTE, CHAR, WORD, INT, DWORD, DINT, REAL, DATE, TOD, TIME, S5TIME, DATE_AND_TIME HB00E - OPL_STD - Rev. 14/22 4-31 Chapter 4 Integrated Standard SFCs RET_VAL (Return value) Value 0000h 0001h 0002h 8081h 8082h 8083h 8084h 8085h 8086h 8087h 8088h 8xyy 4-32 Manual VIPA Operation List Standard The return value contains an error code if an error is detected when the function is being processed. Description No error has occurred. • The associated value exceeds the maximum length, or • application memory cannot be accessed (e.g. access to deleted DB). The message will be transferred. • The associated value points to the local data area Warning: the last unused message acknowledgement memory has been allocated. The specified EV_ID lies outside of the valid range. Message loss because your CPU suffers from a lack of resources that are required to generate module related messages by means of SFCs. Message loss because a signal of the same type is already available but could not be sent (signal overflow). The triggering signal SIG for messages has the same value for the current and for the preceding SFC 17 / SFC 18 call. The specified EV_ID has not been registered. An SFC call for the specified EV_ID is already being processed with a lower priority class. The value of the message triggering signal was 0 during the first call to the SFC 17, SFC 18. The specified EV_ID has already been used by another type of SFC that is currently (still) occupying memory space. General error information HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Chapter 4 Integrated Standard SFCs SFC 19 - ALARM_SC - Acknowledgement state last Alarm The SFC 19 ALARM_SC can be used to: • determine the acknowledgement status of the last SFC 17-enteringstate message and the status of the message triggering signal during the last SFC 17 ALARM_SQ call • the status of the message triggering signal during the last SFC 18 ALARM_S call. The predefined message number identifies the message and/or the signal. The SFC 19 accesses temporary memory that was allocated to the SFC 17 or SFC 18. Description Parameters Parameter Declaration EV_ID INPUT Data type Memory block DWORD I, Q, M, D, L, constant RET_VAL STATE OUTPUT OUTPUT INT BOOL I, Q, M, D, L I, Q, M, D, L Q_STATE OUTPUT BOOL I, Q, M, D, L RET_VAL (Return value) Value 0000h 8081h 8082h 8xyy Description Message number for which you want to determine the status of the signal during the last SFC call or the acknowledgement status of the last entering-state message (only for SFC 17!) Return value Status of the message triggering signal during the last SFC call. If the specified parameter EV_ID belongs to an SFC 18 call: "1" If the specified parameter EV_ID belongs to an SFC 17 call: acknowledgement status of the last entering-state message: "0": not acknowledged "1": acknowledged The return value contains an error code if an error is detected when the function is being processed. Description No error has occurred. The specified EV_ID lies outside of the valid range. No memory is allocated to this EV_ID at present (possible cause: the status of the respective signal has never been "1", or it has already changed back to status "0".) General Error information HB00E - OPL_STD - Rev. 14/22 4-33 Chapter 4 Integrated Standard SFCs Manual VIPA Operation List Standard SFC 20 - BLKMOV - Block move The SFC 20 BLKMOV (block move) copies the contents of one block of memory (source field) into another block of memory (target field). Any block of memory may be copied, with the exception of : • the following blocks: FC, SFC, FB, SFB, OB, SDB • counters • timers • memory blocks of the peripheral area. Description It is also possible that the source parameter is located in another data block in load memory that is not relevant to the execution (DB that was compiled with key word UNLINKED). Interruptability No limits apply to the nesting depth as long as the source field is not part of a data block that only exists in load memory. However, when interrupting an SFC 20 that copies blocks from a DB that is not relevant to the current process, then this SFC 20 cannot be nested any longer. Parameters Parameter Declaration SRCBLK INPUT Data type Memory block ANY I, Q, M, D, L RET_VAL OUTPUT INT I, Q, M, D, L DSTBLK OUTPUT ANY I, Q, M, D, L 4-34 Description Defines the memory block that must be copied (source field). Arrays of data type STRING are not permitted. The return value contains an error code if an error is detected when the function is being processed. Defines the destination memory block to which the data will be copied (target field). Arrays of data type STRING are not permitted. HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Chapter 4 Integrated Standard SFCs Note! Source and target field must not overlap. If the specified target field is larger than the source filed then only the amount of data located in the source field will be copied. When the specified target field should, however, be smaller than the source filed, then only the amount of data that the target field can accommodate will be copied. If the type of the ANY-pointer (source or target) is BOOL, then the specified length must be divisible by 8, otherwise the SFC cannot be executed. If the type of the ANY-pointer is STRING, then the specified length must be equal to 1. RET_VAL (Return value) Value 0000h 8091h The return value contains an error code if an error is detected when the function is being processed. Description No error The maximum nesting depth was exceeded HB00E - OPL_STD - Rev. 14/22 4-35 Manual VIPA Operation List Standard Chapter 4 Integrated Standard SFCs SFC 21 - FILL - Fill a field Description The SFC 21 FILL fills one block of memory (target field) with the contents of another block of memory (source field). The SFC 21 copies the contents from the source field into the specified target field until the block of memory has been filled completely. BVAL A B MW 14 A B MW 200 C D MW 16 C D MW 202 E F MW 18 E F MW 204 G H MW 20 G H MW 206 A B MW 208 C D MW 210 E F MW 212 G H MW 214 A B MW 216 C D MW 218 E F MW 220 BLK Note! Source and target field must not overlap. Even if the specified target field is not an integer multiple of the length of input parameter BVAL, the target field will be filled up to the last byte. If the target field is smaller than the source field, only the amount of data that can be accommodated by the target will be copied. Values cannot be written with the SFC 21 into: • the following blocks: FC, SFC, FB, SFB, SDB • counters • timers • memory blocks of the peripheral area 4-36 HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Chapter 4 Integrated Standard SFCs Parameters Parameter Declaration BVAL INPUT Data type Memory block ANY I, Q, M, D, L RET_VAL OUTPUT INT I, Q, M, D, L BLK OUTPUT ANY I, Q, M, D, L Parameter is a structure Description Contains the value or the description of the source field that should be copied into the target field. Arrays of the data type STRING are not permitted. The return value contains an error code if an error is detected when the function is being processed. Contains the description of the target field that must be filled. Arrays of the data type STRING are not permitted. Pay attention to the following when the input parameter consists of a structure: the length of a structure is always aligned with an even number of bytes. This means, that if you should declare a structure with an uneven number of bytes, the structure will require one additional byte in memory. Example: The structure is declared as follows: STRUKTUR_7_BYTE: STRUCT BYTE_1_2 : WORD BYTE_3_4 : WORD BYTE_5_6 : WORD BYTE_7: BYTE END_STRUCT Structure "STRUKTUR_7_BYTE" requires 8bytes of memory. RET_VAL (Return value) The return value contains an error code if an error is detected when the function is being processed. The SFC 21 only returns general error information. No specific error information is available. HB00E - OPL_STD - Rev. 14/22 4-37 Manual VIPA Operation List Standard Chapter 4 Integrated Standard SFCs SFC 22 - CREAT_DB - Create a data block Description The SFC 22 CREAT_DB (create data block) allows the application program to create a data block that does not contain any values. A data block is created that has a number in the specified range and with a specific size. The number assigned to the DB will always be the lowest number in the specified range. To create a DB with specific number you must assigned the same number to the upper and the lower limit of the range. If the application program already contains DBs then the respective numbers cannot be assigned any longer. The length of the DB must be an even number. Interruptability The SFC 22 may be interrupted by OBs with a higher priority. If a call is issued to an SFC 22 from an OB with a higher priority, then the call is rejected with error code 8091h. Parameters Parameter LOW_LIMIT Declaration Data type INPUT WORD Memory block I, Q, M, D, L, constant UP_LIMIT INPUT WORD I, Q, M, D, L, constant COUNT INPUT WORD I, Q, M, D, L, constant RET_VAL OUTPUT INT I, Q, M, D, L WORD I, Q, M, D, L DB_NUMBER OUTPUT 4-38 Description The lower limit is the lowest number in the range of numbers that you may assign to your data block. The upper limit is the highest number in the range of numbers that you may assign to your data block. The counter defines the number of data bytes that you wish to reserve for your data block. Here you must specify an even number of bytes (maximum 65534). The return value contains an error code if an error is detected when the function is being processed. The data block number is the number of the data block that was created. When an error occurs (bit 15 of RET_VAL was set) a value of 0 is entered into DB_NUMBFC. HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard RET_VAL (Return value) Value 0000h 8091h 8092h 80A1h 80A2h 80B1h 80B2h 80B3h Chapter 4 Integrated Standard SFCs The return value contains an error code if an error is detected when the function is being processed. Description no error You issued a nested call to the SFC 22. The function "Create a DB" cannot be executed at present because • the function "Compress application memory" is active Error in the number of the DB: • the number is 0 • the number exceeds the CPU-specific number of DBs • lower limit > upper limit Error in the length of the DB: • the length is 0 • the length was specified as an uneven number • the length is larger than permitted by the CPU No DB-number available Insufficient memory available Insufficient contiguous memory available (compress the memory!). HB00E - OPL_STD - Rev. 14/22 4-39 Manual VIPA Operation List Standard Chapter 4 Integrated Standard SFCs SFC 23 - DEL_DB - Deleting a data block Description The SFC 23 DEL_DB (delete data block) deletes a data block in application memory and if necessary from the load memory of the CPU. The specified DB must not be open on the current level or on a level with a lower priority, i.e. it must not have been entered into one of the two DB-registers and also not into B-stack. Otherwise the CPU will change to STOP mode when the call to the SFC 23 is issued. The following table indicates when a DB may be deleted by means of the SFC 23. When the DB ... was created by means of a call to SFC 22 "CREAT_DB", was not created with the key word UNLINKED, Interruptability The SFC 23 may be interrupted by OBs with a higher priority. When another call is issued to the SFC the second call is rejected and RET_VAL is set to error code 8091h. Parameters Parameter Declaration Data type DB_NUMBER INPUT WORD RET_VAL then SFC 23 ... can be used to delete it. can be used to delete it. OUTPUT INT Memory block I, Q, M, D, L, constant I, Q, M, D, L Description Number of the DB that must be deleted. The return value contains an error code if an error is detected when the function is being processed. The return value contains an error code if an error is detected when the RET_VAL function is being processed. (Return value) Value Description 0000h no error 8091h The maximum nesting depth of the respective CPU for nested calls to SFC 23 has been exceeded. 8092h The function "Delete a DB" cannot be executed at present because • the function "Compress application memory" is active • you are copying the DB to be deleted from the CPU to an offline project 4-40 80A1h Error in input parameter DB_NUMBER: • has a value of 0 • exceeds the maximum DB number that is possible on the CPU that is being used 80B1h 80B2h 80B3h A DB with the specified number does not exist on the CPU A DB with the specified number was created with the key word UNLINKED The DB is located on the flash memory card HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Chapter 4 Integrated Standard SFCs SFC 24 - TEST_DB - Test data block Description The SFC 24 TEST_DB (test data block) returns information about a data block that is located in the application memory of the CPU. The SFC determines the number of data bytes and tests whether the selected DB is write protected. Parameters Parameter DB_NUMBER Declaration Data type INPUT WORD RET_VAL OUTPUT INT Memory block I, Q, M, D, L, constant I, Q, M, D, L DB_LENGTH OUTPUT WORD I, Q, M, D, L BOOL I, Q, M, D, L WRITE_PROT OUTPUT RET_VAL (Return value) Description Number of the DB that must be tested. The return value contains an error code if an error is detected when the function is being processed. The number of data bytes that are contained in the selected DB. Information about the write protection code of the selected DB (1 = write protected). The return value contains an error code if an error is detected when the function is being processed. Value 0000h 80A1h Description no error Error in input parameter DB_NUMBER: the selected actual parameter • has a value of 0 • exceeds the maximum DB number that is possible on the CPU that is being used 80B1h 80B2h A DB with the specified number does not exist on the CPU. A DB with the specified number was created with the key word UNLINKED. HB00E - OPL_STD - Rev. 14/22 4-41 Chapter 4 Integrated Standard SFCs Manual VIPA Operation List Standard SFC 28 ... 31 - Time-of-day interrupt Conditions The following conditions must be satisfied before a time-of-day interrupt OB 10 may be called: • The time-of-day interrupt OB must have been configured by hardware configuration or by means of the SFC 28 (SET_TINT) in the user program. • The time-of-day interrupt OB must have been activated by hardware configuration or by means of the SFC 30 (ACT_TINT) in the user program. • The time-of-day interrupt OB must not have been de-selected. • The time-of-day interrupt OB must exist in the CPU. • When the SFC 30 is used to set the time-of-day interrupt by a single call to the function the respective start date and time must not have expired when the function is initiated; the periodic execution initiates the time-ofday interrupt OB when the specified period has expired (start time + multiple of the period). SFCs 28 ... 31 The system function are used as follows • Set: SFC 28 • Cancel: SFC 29 • Activate: SFC 30 • Query: SFC 31 SFC 28 SET_TINT The SFC 28 SET_TINT (set time-of-day interrupt) defines the start date and time for the time-of-day interrupt - organization modules. The start time ignores any seconds and milliseconds that may have been specified, these are set to 0. Parameters Parameter Declaration OB_NR INPUT Data type Memory block INT I, Q, M, D, L, constant SDT PERIOD INPUT INPUT DT WORD D, L I, Q, M, D, L, constant RET_VAL OUTPUT INT I, Q, M, D, L 4-42 Description Number of the OB, that is started at a time SDT + multiple of PERIOD (OB10, OB11). Start date and start time Period from the start of SDT: 0000h = single 0201h = at minute intervals 0401h = hourly 1001h = daily 1201h = weekly 1401h = monthly 1801h = annually 2001h = at the end of a month The return value contains an error code if an error is detected when the function is being processed. HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard The return value contains an error code if an error is detected when the function is being processed. RET_VAL (Return value) Value 0000h 8090h 8091h 8092h 80A1h Chapter 4 Integrated Standard SFCs Description No error has occurred. OB_NR parameter error SDT parameter error PERIOD parameter error The stated date/time has already expired. SFC 29 CAN_TINT Cancel time-ofday interrupt The SFC 29 CAN_TINT (cancel time-of-day interrupt) deletes the start date and time of the specified time-of-day interrupt - organization block Parameters Parameter OB_NR Declaration INPUT Data type INT Memory block I, Q, M, D, L, constant RET_VAL OUTPUT INT I, Q, M, D, L Description Number of the OB, in which the start date and time will be canceled (OB 10, OB 11). The return value contains an error code if an error is detected when the function is being processed. RET_VAL (Return value) Value 0000h 8090h 80A0h Description No error has occurred. OB_NR parameter error No start date/time was defined for the respective time-of-day interrupt OB. HB00E - OPL_STD - Rev. 14/22 4-43 Chapter 4 Integrated Standard SFCs SFC 30 ACT_TINT Activate time-ofday interrupt The SFC 30 ACT_TINT (activate time-of-day interrupt) is used to activate the specified time-of-day interrupt - organization block Parameters Parameter Declaration OB_NR INPUT RET_VAL OUTPUT Manual VIPA Operation List Standard Data type Memory block INT I, Q, M, D, L, constant INT I, Q, M, D, L Description Number of the OB to be activated (OB 10, OB 11) The return value contains an error code if an error is detected when the function is being processed. RET_VAL (Return value) Value 0000h 8090h 80A0h 80A1h 4-44 Description No error has occurred. OB_NR parameter error No start date/time was defined for the respective time-of.-day interrupt OB The activated time has expired; this error can only occur when the function is executed once only. HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard SFC 31 QRY_TINT Query time-ofday interrupt Parameters Parameter OB_NR Chapter 4 Integrated Standard SFCs The SFC 31 QRY_TINT (query time-of-day interrupt) can be used to make the status of the specified time-of-day interrupt - organization block available via the output parameter STATUS. RET_VAL Declaration Data type Memory block INPUT INT I, Q, M, D, L, constant OUTPUT INT I, Q, M, D, L STATUS OUTPUT WORD I, Q, M, D, L Description Number of the OB, whose status will be queried (OB 10, OB 11). The return value contains an error code if an error is detected when the function is being processed. Status of the time-of-day interrupt. RET_VAL (Return value) Value 0000h 8090h STATUS Bit 0 1 2 3 4 5 Description No error has occurred. OB_NR parameter error Value 0 0 0 0 0 Description The operating system has enabled the time-of-day interrupt. New time-of-day interrupts are not discarded. Time-of-day interrupt has not been activated and has not expired. reserved Time-of-day interrupt-OB has not been loaded. An active test function disables execution of the time-of-day interrupt-OB. HB00E - OPL_STD - Rev. 14/22 4-45 Manual VIPA Operation List Standard Chapter 4 Integrated Standard SFCs SFC 32 - SRT_DINT - Start time-delay interrupt Description The SFC 32 SRT_DINT (start time-delay interrupt) can be used to start a time-delay interrupt that issues a call to a time-delay interrupt OB after the pre-configured delay time (parameter DTIME) has expired. Parameter SIGN specifies a user-defined code that identifies the start of the timedelay interrupt. While the function is being executed the values of DTIME and SIGN appear in the startup event information of the specified OB. Conditions The following conditions must be satisfied before a time-delay interrupt OB may be called: • the time-delay interrupt OB must have been started (using the SFC 32) • the time-delay interrupt OB must not have been de-selected. • the time-delay interrupt OB must exist in the CPU. Parameters Parameter OB_NR Declaration Data type INPUT INT DTIME INPUT TIME SIGN INPUT WORD RET_VAL OUTPUT INT Accuracy Memory block I, Q, M, D, L, constant I, Q, M, D, L, constant I, Q, M, D, L, constant I, Q, M, D, L Description Number of the OB, that is started after the time delay (OB 20, OB 21). The delay time (1 ... 60 000ms) Code that is inserted into the startup event information of the OB when a call is issued to the time-delay interrupt. The return value contains an error code if an error is detected when the function is being processed. The time from the call to the SFC 32 and the start of the time-delay interrupt OB may be less than the configured time by no more than one millisecond, provided that no interrupt events have occurred that delay the call. RET_VAL (Return value) Value 0000h 8090h 8091h 4-46 Description No error has occurred. OB_NR parameter error DTIME parameter error HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Chapter 4 Integrated Standard SFCs SFC 33 - CAN_DINT - Cancel time-delay interrupt Description The SFC 33 CAN_DINT (cancel time-delay interrupt) cancels a time-delay interrupt that has already been started. The call to the respective timedelay interrupt OB will not be issued. Conditions The following conditions must be satisfied before a time-delay interrupt OB may be called: • The time-delay interrupt OB must have been started (using the SFC 32). • The time-delay interrupt OB must not have been de-selected. • The time-delay interrupt OB must exist in the CPU. Parameters Parameter Declaration OB_NR INPUT Data type INT RET_VAL INT OUTPUT Memory block I, Q, M, D, L, constant I, Q, M, D, L Description Number of the OB, that must be cancelled (OB 20, OB 21). The return value contains an error code if an error is detected when the function is being processed. RET_VAL (Return value) Value 0000h 8090h 80A0h Description No error has occurred. OB_NR parameter error Time-delay interrupt has not been started. HB00E - OPL_STD - Rev. 14/22 4-47 Manual VIPA Operation List Standard Chapter 4 Integrated Standard SFCs SFC 34 - QRY_DINT - Query time-delay interrupt Description The SFC 34 QRY_DINT (query time-delay interrupt) can be used to make the status of the specified time-delay interrupt available via the output parameter STATUS. Conditions The following conditions must be satisfied before a time-delay interrupt OB may be called: • The time-delay interrupt OB must have been started (using the SFC 32). • The time-delay interrupt OB must not have been de-selected. • The time-delay interrupt OB must exist in the CPU. Parameters Parameter OB_NR Declaration Data type INPUT INT RET_VAL OUTPUT INT Memory block I, Q, M, D, L, Constant I, Q, M, D, L STATUS OUTPUT WORD I, Q, M, D, L Description Number of the OB, that must be cancelled (OB 20, OB 21) The return value contains an error code if an error is detected when the function is being processed. Status of the time-delay interrupt RET_VAL (Return value) Value 0000h 8090h STATUS Bit 0 1 2 3 4 5 4-48 Description No error has occurred. OB_NR parameter error Value 0 0 0 0 0 Description The operating system has enabled the time-delay interrupt. New time-delay interrupts are not discarded. Time-delay interrupt has not been activated and has not expired. Time-delay interrupt-OB has not been loaded. An active test function disables execution of the time-delay interruptOB. HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Chapter 4 Integrated Standard SFCs SFC 36 - MSK_FLT - Mask synchronous errors Description The SFC 36 MSK_FLT (mask synchronous faults) is used to control the reaction of the CPU to synchronous faults by masking the respective synchronous faults. The call to the SFC 36 masks the synchronous faults of the current priority class. If you set individual bits of the synchronous fault mask in the input parameters to "1" other bits that have previously been set will remain at "1". This result in new synchronous fault masks that can be retrieved via the output parameters. Masked synchronous faults are entered into an error register and do not issue a call to an OB. The error register is read by means of the SFC 38 READ_ERR. Parameters Parameter PRGFLT_SET_MASK Declaration Data type INPUT DWORD ACCFLT_SET_MASK INPUT DWORD RET_VAL OUTPUT INT Memory block I, Q, M, D, L, constant I, Q, M, D, L, constant I, Q, M, D, L PRGFLT_MASKED ACCFLT_MASKED OUTPUT OUTPUT DWORD DWORD I, Q, M, D, L I, Q, M, D, L Description Programming faults that must be masked out Access faults that must be masked out The return value contains an error code if an error is detected when the function is being processed. Masked programming faults Masked access errors RET_VAL (Return value) Value 0000h 0001h Description None of the faults has previously been masked. One or more of the faults has already been masked, however, the other faults will still be masked out. HB00E - OPL_STD - Rev. 14/22 4-49 Manual VIPA Operation List Standard Chapter 4 Integrated Standard SFCs SFC 37 - DMSK_FLT - Unmask synchronous errors Description The SFC 37 DMSK_FLT (unmask synchronous faults) unmasks any masked synchronous faults. A call to the SFC 37 unmasks the synchronous faults of the current priority class. The respective bits in the fault mask of the input parameters are set to "1". This results in new fault masks that you can read via the output parameters. Queried entries are deleted from in the error register. Parameters Parameter PRGFLT_RESET_MASK Declaration INPUT ACCFLT_RESET_MASK INPUT RET_VAL OUTPUT Data type Memory block DWORD I, Q, M, D, L, constant DWORD I, Q, M, D, L, constant INT I, Q, M, D, L PRGFLT_MASKED OUTPUT DWORD I, Q, M, D, L ACCFLT_MASKED OUTPUT DWORD I, Q, M, D, L Description Programming faults that must be unmasked Access faults that must be unmasked The return value contains an error code if an error is detected when the function is being processed. Masked programming faults Masked access errors RET_VAL (Return value) Value 0000h 0001h 4-50 Description All the specified faults have been unmasked. One or more of the faults was not masked, however, the other faults will still be unmasked. HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Chapter 4 Integrated Standard SFCs SFC 38 - READ_ERR - Read error register Description Parameters Parameter PRGFLT_QUERY The SFC 38 READ_ERR (read error registers) reads the contents of the error register. The structure of the error register is identical to the structure of the programming fault and access fault masks that were defined as input parameters by means of the SFC 36 and 37. When you issue a call to the SFC 38 the specified entries are read and simultaneously deleted from the error register. The input parameters define which synchronous faults will be queried in the error register. The function indicates the masked synchronous faults of the current priority class that have occurred once or more than once. When a bit is set it signifies that the respective masked synchronous fault has occurred. RET_VAL Declaration Data type Memory block INPUT DWORD I, Q, M, D, L, constant INPUT DWORD I, Q, M, D, L, constant OUTPUT INT I, Q, M, D, L PRGFLT_ESR OUTPUT DWORD I, Q, M, D, L ACCFLT_ESR OUTPUT DWORD I, Q, M, D, L ACCFLT_QUERY Description Query programming faults Query access faults The return value contains an error code if an error is detected when the function is being processed. Programming faults that have occurred Access faults that have occurred RET_VAL (Return value) Value 0000h 0001h Description All the specified faults have been masked. One or more of the faults that have occurred was not masked. HB00E - OPL_STD - Rev. 14/22 4-51 Manual VIPA Operation List Standard Chapter 4 Integrated Standard SFCs SFC 39 - DIS_IRT - Disabling interrupts Description With the SFC 39 DIS_IRT (disable interrupt) you disable the processing of new interrupts and asynchronous errors. This means that if an interrupt occurs, the operating system of the CPU reacts as follows: • if neither calls an interrupt OB asynchronous error OB, • nor triggers the normal reaction if an interrupt OB or asynchronous error OB is not programmed. If you disable interrupts and asynchronous errors, this remains in effect for all priority classes. The effects of SFC 39 can only be canceled again by calling the SFC 40 or by a restart. Whether the operating system writes interrupts and asynchronous errors to the diagnostic buffer when they occur depends on the input parameter setting you select for MODE. Note! Remember that when you program the use of the SFC 39, all interrupts that occur are lost. Parameters Parameter MODE Declaration INPUT Data type Memory block BYTE I, Q, M, D, L, constant OB_NR INPUT INT RET_VAL OUTPUT INT 4-52 I, Q, M, D, L, constant I, Q, M, D, L Description Specifies which interrupts and asynchronous errors are disabled. OB number If an error occurs while the function is active, the return value contains an error code. HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard MODE MODE 00 01 02 80 81 82 Chapter 4 Integrated Standard SFCs Description All newly occurring interrupts and asynchronous errors are disabled (Synchronous errors are not disabled). All newly occurring events belonging to a specified interrupt class are disabled. Identify the interrupt class by specifying it as follows: • Time-of-day interrupts: 10 • Time-delay interrupts: 20 • Cyclic interrupts: 30 • Hardware interrupts: 40 • Interrupts for DP-V1: 50 • Asynchronous error interrupts: 80 Entries into the diagnostic buffer are continued. All new occurrences of a specified interrupt are disabled. You specify the interrupt using the OB number. Entries into the diagnostic buffer are continued. All new occurrences of a specified interrupt are disabled. You specify the interrupt using the OB number. Entries continue to be made in the diagnostic buffer. All new occurrences belonging to a specified interrupt class are disabled and are no longer entered in the diagnostic buffer. The operating system enters event 5380h in the diagnostic buffer. All new occurrences belonging to a specified interrupt are disabled and are no longer entered in the diagnostic buffer. The operating system enters event 5380h in the diagnostic buffer. RET_VAL (Return value) Value 0000h 8090h 8091h 8xyyh Description No error occurred. The input parameter OB_NR contains an illegal value. The input parameter MODE contains an illegal value. General error information, see Evaluating Errors with the Output parameter RET_VAL. HB00E - OPL_STD - Rev. 14/22 4-53 Manual VIPA Operation List Standard Chapter 4 Integrated Standard SFCs SFC 40 - EN_IRT - Enabling interrupts Description With the SFC 40 EN_IRT (enable interrupt) you enable the processing of new interrupts and asynchronous errors that you previously disabled with the SFC 39. This means that if an interrupt event occurs, the operating system of the CPU reacts in one of the follows ways: • it calls an interrupt OB or asynchronous error OB, or • it triggers the standard reaction if an interrupt OB or asynchronous error OB is not programmed. Parameters Parameter MODE Declaration INPUT Data type Memory block BYTE I, Q, M, D, L, constant OB_NR INPUT INT RET_VAL OUTPUT INT MODE MODE 00 01 02 I, Q, M, D, L, constant I, Q, M, D, L Description Specifies which interrupts and asynchronous errors will be enabled. OB number If an error occurs while the function is active, the return value contains an error code. Description All newly occurring interrupts and asynchronous errors are enabled. All newly occurring events belonging to a specified interrupt class are enabled. Identify the interrupt class by specifying it as follows: • Time-of-day interrupts: 10 • Time-delay interrupts: 20 • Cyclic interrupts: 30 • Hardware interrupts: 40 • Interrupts for DP-V1: 50 • Asynchronous error interrupts: 80 All newly occurring events of a specified interrupt are enabled. You specify the interrupt using the OB number. RET_VAL (Return value) Value 0000h 8090h 8091h 8xyyh 4-54 Description No error occurred. The input parameter OB_NR contains an illegal value. The input parameter MODE contains an illegal value. General error information, see Evaluating Errors with the Output parameter RET_VAL. HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Chapter 4 Integrated Standard SFCs SFC 41 - DIS_AIRT - Delaying interrupts Description Parameters Parameter RET_VAL RET_VAL (Return value) The SFC 41 DIS_AIRT (disable alarm interrupts) disables processing of interrupt OBs and asynchronous fault OBs with a priority that is higher than the priority of the current OB. You can issue multiple calls to the SFC 41. The operating system will count the number of calls to the SFC 41. Processing of interrupt OBs is disabled until you issue an SFC 42 EN_AIRT to enable all interrupt OBs and asynchronous fault OBs that were disabled by means of SFC 41 or until processing of the current OB has been completed. Any queued interrupt or asynchronous fault interrupts will be processed as soon as you enable processing by means of the SFC 42 EN_AIRT or when processing of the current OB has been completed. Declaration OUTPUT Data type Memory area INT I, Q, M, D, L Description Number of disable calls (= number of calls to the SFC 41) When the SFC has been completed the return value RET_VAL indicates the number of disables, i.e. the number of calls to the SFC 41 (processing of all alarm interrupts is only enabled again when RET_VAL = 0). HB00E - OPL_STD - Rev. 14/22 4-55 Chapter 4 Integrated Standard SFCs Manual VIPA Operation List Standard SFC 42 - EN_AIRT - Enabling delayed interrupts The SFC 42 EN_AIRT (enable alarm interrupts) enables processing of high priority interrupt OBs and asynchronous fault OBs. Every disabled interrupt must be re-enabled by means of the SFC 42. If you have disabled 5 different interrupts by means of 5 SFC 41 calls you must re-enable every alarm interrupt by issuing 5 individual SFC 42 calls. Description Parameters Parameter Declaration RET_VAL OUTPUT RET_VAL (Return value) Value 8080h Data type Memory block INT I, Q, M, D, L Description Number of disabled interrupts when the SFC 42 has been completed or the error code when an error has occurred while the function was being processed. When the SFC has been completed the return value RET_VAL indicates the number of disables, i.e. the number of calls to the SFC 41 (processing of all alarm interrupts is only enabled again when RET_VAL = 0). Description The function was started in spite of the fact that the alarm interrupt had already been enabled. SFC 43 - RE_TRIGR - Retrigger the watchdog Description The SFC 43 RE_TRIGR (retrigger watchdog) restarts the watchdog timer of the CPU. Parameter and return values The SFC 43 has neither parameters nor return values. 4-56 HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Chapter 4 Integrated Standard SFCs SFC 44 - REPL_VAL - Replace value to AKKU1 The SFC 44 REPL_VAL (replace value) transfers a value into AKKU1 of the program level that cause the fault. A call to the SFC 44 can only be issued from synchronous fault OBs (OB 121, OB 122). Description Application example for the SFC 44: When an input module malfunctions so that it is not possible to read any values from the respective module then OB 122 will be started after each attempt to access the module. The SFC 44 REPL_VAL can be used in OB 122 to transfer a suitable replacement value into AKKU1 of the program level that was interrupted. The program will be continued with this replacement value. The information required to select a replacement value (e.g. the module where the failure occurred, the respective address) are available from the local variables of OB 122. Parameters Parameter Declaration VAL INPUT Data type DWORD RET_VAL INT OUTPUT Memory block I, Q, M, D, L, constant I, Q, M, D, L Description Replacement value The return value contains an error code if an error is detected when the function is being processed. RET_VAL (Return value) Value 0000h 8080h Description No error has occurred. A replacement value has been entered. The call to the SFC 44 was not issued from a synchronous fault OB (OB 121, OB 122). SFC 46 - STP - STOP the CPU Description The SFC 46 STP changes the operation mode of the CPU to STOP. Parameter and return values The SFC 46 has neither parameters nor return values. HB00E - OPL_STD - Rev. 14/22 4-57 Chapter 4 Integrated Standard SFCs Manual VIPA Operation List Standard SFC 47 - WAIT - Delay the application program Description The SFC 47 WAIT can be used to program time delays or wait times from 1 up to 32767µs in your application program. Interruptability The SFC 47 may be interrupted by high priority OBs. Note! Delay times that were programmed by means of the SFC 47 are minimum times that may be extended by the execution time of the nested priority classes as well as the load on the system! Parameters Parameter Declaration WT INPUT Error information 4-58 Data type Memory block INT I, Q, M, D, L, constant Description Parameter WT contains the delay time in µs. The SFC 47 does not return specific error codes. HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Chapter 4 Integrated Standard SFCs SFC 49 - LGC_GADR - Read the slot address The SFC 49 LGC_GADR (convert logical address to geographical address) determines the slot location for a module from the logical address as well as the offset in the user-data address space for the module. Description Parameters Parameter Declaration Data type Memory block Description IOID INPUT BYTE I, Q, M, D, L, Identifier for the address space: constant 54h = peripheral input (PI) 55h = peripheral output (PQ) For hybrid modules the SFC returns the area identifier of the lower address. When the addresses are equal the SFC returns identifier 54h. LADDR INPUT WORD I, Q, M, D, L, Logical address. For hybrid modules the constant lower of the two addresses must be specified. RET_VAL OUTPUT INT I, Q, M, D, L The return value contains an error code if an error is detected when the function is being processed. AREA OUTPUT BYTE I, Q, M, D, L Area identifier: this defines how the remaining output parameters must be interpreted. RACK OUTPUT WORD I, Q, M, D, L See next page. SLOT OUTPUT WORD I, Q, M, D, L SUBADDR OUTPUT WORD I, Q, M, D, L AREA Value of AREA 0 1 2 3 ... 6 AREA specifies how the output parameters RACK, SLOT and SUBADDR must be interpreted. These dependencies are depicted below. System Significance of RACK, SLOT and SUBADDR reserved Siemens RACK: Rack number S7-300 SLOT: Slot number SUBADDR : Address offset to base address Decentra- RACK (Low Byte): Station number lized RACK (High Byte): DP master system ID periphery SLOT: Slot number at station SUBADDR : Address offset to base address reserved RET_VAL (Return value) Value 0000h 8090h The return value contains an error code if an error is detected when the function is being processed. Description No error has occurred. The specified logical address is not valid or an illegal value exists for parameter IOID HB00E - OPL_STD - Rev. 14/22 4-59 Manual VIPA Operation List Standard Chapter 4 Integrated Standard SFCs SFC 50 - RD_LGADR - Read all logical addresses of a module The SFC 50 RD_LGADR (read module logical addresses) determines all the stipulated logical addresses of a module starting with a logical address of the respective module. You must have previously configured the relationship between the logical addresses and the modules. The logical addresses that were determined are entered in ascending order into the field PEADDR or into field PAADDR. Description Parameters Parameter IOID Declaration Data type Memory block INPUT BYTE I, Q, M, D, L, constant LADDR INPUT WORD RET_VAL OUTPUT INT I, Q, M, D, L, constant I, Q, M, D, L PEADDR OUTPUT ANY I, Q, M, D, L PECOUNT PAADDR OUTPUT OUTPUT INT ANY I, Q, M, D, L I, Q, M, D, L PACOUNT OUTPUT INT I, Q, M, D, L RET_VAL (Return value) Value 0000h 8090h 80A0 h 80A1h 80A2h 80A3h 4-60 Description Area identification: 54h = peripheral input (PI) 55h = peripheral output (PQ) A logical address The return value contains an error code if an error is detected when the function is being processed. Field for the PI-addresses, field elements must be of data type WORD. Number of returned PI addresses Field for PQ addresses, field elements must be of data type WORD. Number of returned PQ addresses The return value contains an error code if an error is detected when the function is being processed. Description No error has occurred. The specified logical address is not valid or illegal value for parameter IOID. Error in output parameter PEADDR: data type of the field elements is not WORD. Error in output parameter PAADDR: data type of the field elements is not WORD. Error in output parameter PEADDR: the specified field could not accommodate all the logical addresses. Error in output parameter PAADDR: the specified field could not accommodate all the logical addresses. HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Chapter 4 Integrated Standard SFCs SFC 51 - RDSYSST - Read system status list SSL Description With the SFC 51 RDSYSST (read system status) a partial list respectively an extract of a partial list of the SSL (system status list) may be requested. Here with the parameters SSL_ID and INDEX the objects to be read are defined. The INDEX is not always necessary. It is used to define an object within a partial list. By setting REQ the query is started. As soon as BUSY = 0 is reported, the data are located in the target area DR. Information about the SSL may be found in Chapter "System status list SSL". Parameters Parameter REQ Declaration Data type INPUT BOOL SSL_ID INPUT WORD INDEX INPUT WORD RET_VAL OUTPUT INT Memory block I, Q, M, D, L, constant I, Q, M, D, L, constant I, Q, M, D, L, constant I, Q, M, D, L BUSY OUTPUT BOOL I, Q, M, D, L SSL_HEADER OUTPUT STRUCT D, L DR ANY I, Q, M, D, L OUTPUT HB00E - OPL_STD - Rev. 14/22 Description REQ = 1: start processing SSL-ID of the partial list or the partial list extract Type or number of an object in a partial list The return value contains an error code if an error is detected when the function is being processed BUSY = 1: read operation has not been completed WORD structure with 2 types: LENGTHDR: length record set N_DR: number of existing related records (for access to partial list header information) or number of records transmitted in DR. Target area for the SSL partial list or the extraction of the partial list that was read: If you have only read the SSL partial list header info of a SSL partial list, you may not evaluate DR, but only SSL_HEADER. Otherwise the product of LENGTHDR and N_DR shows the number of bytes stored in DR. 4-61 Chapter 4 Integrated Standard SFCs RET_VAL (Return value) Value 0000h 0081h 7000h 7001h 7002h 8081h 8082h 8083h 8085h 8086h 8087h 8088h 8089h 80A2h 80A3h 80A4h 80C5h 4-62 Manual VIPA Operation List Standard The return value contains an error code if an error is detected when the function is being processed. Description no error The length of the result field is too low. The function still returns as many records as possible. The SSL header indicates the returned number of records. First call with REQ = 0: data transfer not active; BUSY = 0. First call with REQ = 1: data transfer initiated; BUSY = 1. Intermediate call (REQ irrelevant): data transfer active; BUSY = 1. The length of the result field is too low. There is not enough space for one record. SSL_ID is wrong or unknown to the CPU or the SFC. Bad or illegal INDEX. Information is not available for system-related reasons, e.g. because of a lack of resources. Record set may not be read due to a system error. Record set may not be read because the module does not exist or it does not return an acknowledgement. Record set may not be read because the current type identifier differs from the expected type identifier. Record set may not be read because the module does not support diagnostic functions. DP protocol error - Layer-2 error (temporary fault). DP protocol error on user-interface/user (temporary fault) Bus communication failure. This error occurs between the CPU and the external DP interface (temporary fault). Decentralized periphery not available (temporary fault). HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Chapter 4 Integrated Standard SFCs SFC 52 - WR_USMSG - Write user entry into diagnostic buffer Description The SFC 52 WR_USMSG (write user element in diagnosis buffer) writes a used defined diagnostic element into the diagnostic buffer. Send diagnostic message To determine whether it is possible to send user defined diagnostic messages you must issue a call to SFC 51 "RDSYSST" with parameters SZL_ID = 0132h and INDEX = 0005h. Sending of user defined diagnostic messages is possible if the fourth word of the returned record set is set to "1". If it should contain a value of "0", sending is not possible. Send buffer full The diagnostic message can only be entered into the send buffer if this is not full. At a maximum of 50 entries can be stored in the send buffer. If the send buffer is full • the diagnostic event is still entered into the diagnostic buffer • the respective error message (8092h) is entered into parameter RET_VAL. Partner not registered When a user defined diagnostic message must be sent and no partner has registered, then • the diagnostic event is still entered into the diagnostic buffer. • the respective error message (0091h or 8091h) is entered into parameter RET_VAL. HB00E - OPL_STD - Rev. 14/22 4-63 Chapter 4 Integrated Standard SFCs The contents of an entry Manual VIPA Operation List Standard The structure of the entry in the diagnostic buffer is as follows: Byte 1, 2 3 4 5, 6 7, 8 9, 10, 11, 12 13 ... 20 Contents Event ID Priority class OB number reserved Additional information 1 Additional information 2 Time stamp: The data type of the time stamp is Date_and_Time. Event ID Every event is assigned to an event ID. Additional information The additional information contains more specific information about the event. This information differs for each event. When a diagnostic event is generated the contents of these entries may be defined by the user. When a user defined diagnostic message is sent to the partners this additional information may be integrated into the (event-ID specific) message text as an associated value. 4-64 HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Parameters Parameter SEND Chapter 4 Integrated Standard SFCs Declaration Data type Memory block INPUT BOOL I, Q, M, D, L, constant EVENTN INPUT WORD I, Q, M, D, L, constant INFO1 INFO2 RET_VAL INPUT INPUT OUTPUT ANY ANY INT I, Q, M, D, L I, Q, M, D, L I, Q, M, D, L Description Enable sending of user defined diagnostic messages to all registered partners Event-ID. The user assigns the eventID. This is not preset by the message server. Additional information, length 1 word Additional information, length 2 words The return value contains an error code if an error is detected when the function is being processed. SEND When SEND is set to 1 the user defined diagnostic message is sent to all partners that have registered for this purpose. Sending is only initiated when one or more partners have registered and the send buffer is not full. Messages are sent asynchronously with respect to the application program. EVENTN The event ID of the user event is entered into EVENTN. Event IDs must be of the format 8xyzh , 9xyzh, Axyzh and Bxyzh. Here the IDs of format 8xyzh and 9xyzh refer to predefined events and IDs of format Axyzh and Bxyzh refer to user-defined events. An event being activated is indicated by x = 1, an event being deactivated by x = 0. For events of the class A and B, yz refers to the message number that was predefined in hexadecimal representation when the messages were configured. INFO1 INFO1 contains information with a length of one word. The following data types are valid: • WORD • INT • ARRAY [0...1] OF CHAR INFO1 can be integrated as associated value into the message text, i.e. to add current information to the message. HB00E - OPL_STD - Rev. 14/22 4-65 Chapter 4 Integrated Standard SFCs INFO2 Manual VIPA Operation List Standard INFO2 contains information with a length of two words. The following data types are valid: • DWORD • DINT • REAL • TIME • ARRAY [0...3] OF CHAR INFO2 can be integrated as associated value into the message text, i.e. to add current information to the message. RET_VAL (Return value) Value 0000h 0091h 8083h 8084h 8085h 8086h 8087h 8091h 8092h 4-66 The return value contains an error code if an error is detected when the function is being processed. Description no error No partner registered (the diagnostic event has been entered into the diagnostic buffer) Data type INFO1 not valid Data type INFO2 not valid EVENTN not valid Length of INFO1 not valid Length of INFO2 not valid Error message identical to error code 0091h Send operation currently not possible, send buffer full (the diagnostic event has been entered into the diagnostic buffer) HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Chapter 4 Integrated Standard SFCs SFC 54 - RD_DPARM - Read predefined parameter The SFC 54 RD_DPARM (read defined parameter) reads the record with number RECNUM of the selected module from the respective SDB1xy. Parameter RECORD defines the target area where the record will be saved Description Parameters Parameter IOID Declaration Data type Memory block INPUT BYTE I, Q, M, D, L, constant LADDR INPUT WORD I, Q, M, D, L, constant RECNUM INPUT BYTE RET_VAL OUTPUT INT I, Q, M, D, L, constant I, Q, M, D, L RECORD OUTPUT ANY I, Q, M, D, L HB00E - OPL_STD - Rev. 14/22 Description Identifier for the address space: 54h = peripheral input (PI) 55h = peripheral output (PQ) For hybrid modules the SFC returns the area identifier of the lower address. When the addresses are equal the SFC returns identifier 54h. Logical address. For hybrid modules the lower of the two addresses must be specified. record number (valid range: 0 ... 240) The return value contains an error code if an error is detected when the function is being processed. Additionally: the length of the record that was read in bytes, provided the size of the record fits into the target area and that no communication errors have occurred. Target area for the record that was read. Only data type BYTE is valid. 4-67 Chapter 4 Integrated Standard SFCs RET_VAL (Return value) Value 7000h 7001h 7002h 8090h 8092h 8093h 80B1h 80D0h 80D1h 80D2h 80D3h 80D4h 4-68 Manual VIPA Operation List Standard Two distinct cases exist for RET_VAL = 8xxxh: • Temporary error (error codes 80A2h ... 80A4h, 80Cxh): For this type of error it is possible that the error corrects itself without intervention. For this reason it is recommended that you re-issue the call to the SFC (once or more than once). Example for temporary errors: the required resources are occupied at present (80C3h). • Permanent error (error codes 809xh, 80A1h, 80Bxh, 80Dxh): These errors cannot be corrected without intervention. A repeat of the call to the SFC is only meaningful when the error has been removed. Example for permanent errors: incorrect length of the record that must be transferred (80B1h). Description First call with REQ = 0: data transfer not active; BUSY is set to 0. First call with REQ = 1: data transfer initiated; BUSY is set to 1. Intermediate call (REQ irrelevant): data transfer active; BUSY is set to 1. The specified logical base address is invalid: no assignment available in SDB1/SDB2x, or this is not a base address. ANY-reference contains a type definition that is not equal to BYTE. This SFC is not valid for the module selected by LADDR and IOID. The length of the target area defined by RECORD is too small. The respective SDB does not contain an entry for the module. The record number has not been configured in the respective SDB for the module. According to the type identifier the module cannot be configured. SDB cannot be accessed since it does not exist. Bad SDB structure: the SDB internal pointer points to an element outside of the SDB. HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Chapter 4 Integrated Standard SFCs SFC 55 - WR_PARM - Write dynamic parameter Description The SFC 55 WR_PARM (write parameter) transfers the record RECORD to the target module. Any parameters for this module that exist in the respective SDB will not be replaced by the parameters that are being transferred to the module. These SFC can be used for digital-, analog modules, FMs, CPs and via PROFIBUS DP-V1. Conditions It is important that the record that must be transferred is not static, i.e.: • do not use record 0 since this record is static for the entire system. • if the record appears in SDBs 100 ... 129 then the static-bit must not be set. Parameter Parameter REQ IOID Declaration Data type Memory block INPUT BOOL I, Q, M, D, L, constant INPUT BYTE I, Q, M, D, L, constant LADDR INPUT WORD I, Q, M, D, L, constant RECNUM INPUT BYTE RECORD RET_VAL INPUT OUTPUT ANY INT I, Q, M, D, L, constant I, Q, M, D, L I, Q, M, D, L BUSY OUTPUT BOOL I, Q, M, D, L HB00E - OPL_STD - Rev. 14/22 Description REQ = 1: write request Identifier for the address space: 54h = peripheral input (PI) 55h = peripheral output (PQ) For hybrid modules the SFC returns the area identifier of the lower address. When the addresses are equal the SFC returns identifier 54h. Logical base address of the module. For hybrid modules the lower of the two addresses must be specified. record number (valid values: 0 ... 240) Record The return value contains an error code if an error is detected when the function is being processed. BUSY = 1: the write operation has not been completed. 4-69 Chapter 4 Integrated Standard SFCs Manual VIPA Operation List Standard RECORD With the first call to the SFC the data that must be transferred is read from the parameter RECORD. However, if the transfer of the record should require more than one call duration, the contents of the parameter RECORD is no longer valid for subsequent calls to the SFC (of the same job). RET_VAL (Return value) Two distinct cases exist for RET_VAL = 8xxxh: • Temporary error (error codes 80A2h ... 80A4h, 80Cxh): For this type of error it is possible that the error corrects itself without intervention. For this reason it is recommended that you re-issue the call to the SFC (once or more than once). Example for temporary errors: the required resources are occupied at present (80C3h). • Permanent error (error codes 809xh, 80A1h, 80Bxh, 80Dxh): These errors cannot be corrected without intervention. A repeat of the call to the SFC is only meaningful when the error has been removed. Example for permanent errors: incorrect length of the record that must be transferred (80B1h). Value 7000h 7001h 7002h 8090h 8092h 8093h 80A1h 80A2h 80A3h 80A4h 80B0h 4-70 Description First call with REQ = 0: data transfer not active; BUSY is set to 0. First call with REQ = 1: data transfer initiated; BUSY is set to 1. Intermediate call (REQ irrelevant): data transfer active; BUSY is set to 1. The specified logical base address is invalid: no assignment available in SDB1/SDB2x, or this is not a base address. ANY-reference contains a type definition that is not equal to BYTE. This SFC is not valid for the module selected by LADDR and IOID. Negative acknowledgement when the record is being transferred to the module (module was removed during the transfer or module failed) DP protocol fault in layer 2, possible hardware-/ interface fault in the DP slave DP protocol fault for user Interface/user Communication failure (this fault occurs between the CPU and the external DP interface) SFC cannot be used with this type of module or the module does not recognize the record. continued ... HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard ... continue Value 80B1h 80B2h 80B3h 80C1h 80C2h 80C3h 80C4h 80C5h 80C6h 80D0h 80D1h 80D2h 80D3h 80D4h 80D5h Chapter 4 Integrated Standard SFCs Description The length of the target area determined by RECORD is too small. The slot that was configured has not been populated. The actual type of module is not equal to the required type of module in SDB1 The module has not yet completed processing of the data of the preceding write operation for the same record. The module is currently processing the maximum number of jobs for a CPU. Required resources (memory, etc.) are currently occupied. Communication error: Decentralized periphery not available. The transfer of records was aborted due to a priority class abort. The respective SDB does not contain an entry for the module. The record number was not configured in the respective SDB. Based on the type identifier the module cannot be configured. The SDB cannot be accessed since it does not exist. Bad SDB structure: the SDB internal pointer points to an element outside of the SDB. The record is not static. HB00E - OPL_STD - Rev. 14/22 4-71 Manual VIPA Operation List Standard Chapter 4 Integrated Standard SFCs SFC 56 - WR_DPARM - Write default parameter The SFC 56 WR_DPARM (write default parameter) transfers the record RECNUM from the respective SDB to the target module, irrespective of whether the specific record is static or dynamic. These SFC can be used for digital-, analog modules, FMs, CPs and via PROFIBUS DP-V1. Description Parameters Parameter REQ IOID Declaration Data type Memory block INPUT BOOL I, Q, M, D, L, constant INPUT BYTE I, Q, M, D, L, constant LADDR INPUT WORD I, Q, M, D, L, constant RECNUM INPUT BYTE RET_VAL OUTPUT INT I, Q, M, D, L, constant I, Q, M, D, L BUSY OUTPUT BOOL I, Q, M, D, L 4-72 Description REQ = 1: write request Identifier for the address space: 54h = peripheral input (PI) 55h = peripheral output (PQ) For hybrid modules the SFC returns the area identifier of the lower address. When the addresses are equal the SFC returns identifier 54h. Logical base address of the module. For hybrid modules the lower of the two addresses must be specified. Record number (valid values: 0 ... 240) The return value contains an error code if an error is detected when the function is being processed. BUSY = 1: the write operation has not been completed. HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard RET_VAL (Return value) Value 7000h 7001h 7002h 8090h 8093h 80A1h 80A2h 80A3h 80A4h 80B0h 80B1h 80B2h 80B3h 80C1h 80C2h 80C3h 80C4h 80C5h 80C6h 80D0h 80D1h 80D2h 80D3h 80D4h Chapter 4 Integrated Standard SFCs Two distinct cases exist for RET_VAL = 8xxxh: • Temporary error (error codes 80A2h ... 80A4h, 80Cxh): For this type of error it is possible that the error corrects itself without intervention. For this reason it is recommended that you re-issue the call to the SFC (once or more than once). Example for temporary errors: the required resources are occupied at present (80C3h). • Permanent error (error codes 809xh, 80A1h, 80Bxh, 80Dxh): These errors cannot be corrected without intervention. A repeat of the call to the SFC is only meaningful when the error has been removed. Example for permanent errors: incorrect length of the record that must be transferred (80B1h). Description First call with REQ = 0: data transfer not active; BUSY is set to 0. First call with REQ = 1: data transfer initiated; BUSY is set to 1. Intermediate call (REQ irrelevant): data transfer active; BUSY is set to 1. The specified logical base address is invalid: no assignment available in SDB1/SDB2x, or this is not a base address. This SFC is not valid for the module selected by means of LADDR and IOID. Negative acknowledgement when the record is being transferred to the module (module was removed during the transfer or module failed) DP protocol fault in layer 2, possible hardware-/ interface fault in the DP slave DP protocol fault for user Interface/user Communication failure (this fault occurs between the CPU and the external DP interface). SFC cannot be used with this type of module or the module does not recognize the record. The length of the target area determined by RECORD is too small. The slot that was configured has not been populated. The actual type of module is not equal to the required type of module in SDB1. The module has not yet completed processing of the data of the preceding write operation for the same record. The module is currently processing the maximum number of jobs for a CPU. Required resources (memory, etc.) are currently occupied. Communication error Decentralized periphery not available. The transfer of records was aborted due to a priority class abort. The respective SDB does not contain an entry for the module. The record number was not configured in the respective SDB. Based on the type identifier the module cannot be configured. The SDB cannot be accessed since it does not exist. Bad SDB structure: the SDB internal pointer points to an element outside of the SDB. HB00E - OPL_STD - Rev. 14/22 4-73 Manual VIPA Operation List Standard Chapter 4 Integrated Standard SFCs SFC 57 - PARM_MOD - Parameterize module The SFC 57 PARM_MOD (parameterize module) transfers all the records that were configured in the respective SDB into a module, irrespective of whether the specific record is static or dynamic. These SFC can be used for digital-, analog modules, FMs, CPs and via PROFIBUS DP-V1. Description Parameters Parameter REQ IOID Declaration Data type Memory block INPUT BOOL I, Q, M, D, L, constant INPUT BYTE I, Q, M, D, L, constant LADDR INPUT WORD I, Q, M, D, L, constant RET_VAL OUTPUT INT I, Q, M, D, L BUSY OUTPUT BOOL I, Q, M, D, L 4-74 Description REQ = 1: write request Identifier for the address space: 54h = peripheral input (PI) 55h = peripheral output (PQ) For hybrid modules the SFC returns the area identifier of the lower address. When the addresses are equal the SFC returns identifier 54h. Logical base address of the module. For hybrid modules the lower of the two addresses must be specified. The return value contains an error code if an error is detected when the function is being processed. BUSY = 1: the write operation has not been completed. HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard RET_VAL (Return value) Chapter 4 Integrated Standard SFCs Two distinct cases exist for RET_VAL = 8xxxh: • Temporary error (error codes 80A2h ... 80A4h, 80Cxh): For this type of error it is possible that the error corrects itself without intervention. For this reason it is recommended that you re-issue the call to the SFC (once or more than once). Example for temporary errors: the required resources are occupied at present (80C3h). • Permanent error (error codes 809xh, 80A1h, 80Bxh, 80Dxh): These errors cannot be corrected without intervention. A repeat of the call to the SFC is only meaningful when the error has been removed. Example for permanent errors: incorrect length of the record that must be transferred (80B1h). Value 7000h 7001h 7002h 8090h 8093h 80A1h 80A2h 80A3h 80A4h 80B0h 80B1h 80B2h 80B3h 80C1h 80C2h 80C3h 80C4h 80C5h 80C6h 80D0h 80D1h 80D2h 80D3h 80D4h Description First call with REQ = 0: data transfer not active; BUSY is set to 0. First call with REQ = 1: data transfer initiated; BUSY is set to 1. Intermediate call (REQ irrelevant): data transfer active; BUSY is set to 1. The specified logical base address is invalid: no assignment available in SDB1/SDB2x, or this is not a base address. This SFC is not valid for the module selected by means of LADDR and IOID. Negative acknowledgement when the record is being transferred to the module (module was removed during the transfer or module failed) DP protocol fault in layer 2, possible hardware-/ interface fault in the DP slave DP protocol fault for user Interface/user Communication failure (this fault occurs between the CPU and the external DP interface) SFC cannot be used with this type of module or the module does not recognize the record. The length of the target area determined by RECORD is too small. The slot that was configured has not been populated. The actual type of module is not equal to the required type of module in SDB1 The module has not yet completed processing of the data of the preceding write operation for the same record. The module is currently processing the maximum number of jobs for a CPU. Required resources (memory, etc.) are currently occupied. Communication error Decentralized periphery not available. The transfer of records was aborted due to a priority class abort. The respective SDB does not contain an entry for the module. The record number was not configured in the respective SDB. Based on the type identifier the module cannot be configured. The SDB cannot be accessed since it does not exist. Bad SDB structure: the SDB internal pointer points to an element outside of the SDB. HB00E - OPL_STD - Rev. 14/22 4-75 Manual VIPA Operation List Standard Chapter 4 Integrated Standard SFCs SFC 58 - WR_REC - Write record The SFC 58 WR_REC (write record) transfers the record RECORD into the selected module. The write operation is started when input parameter REQ is set to 1 when the call to the SFC 58 is issued. Output parameter BUSY returns a value of 0 if the write operation was executed immediately. BUSY is set to 1 if the write operation could not be completed. These SFC can be used for digital-, analog modules, FMs, CPs and via PROFIBUS DP-V1. System dependent this block cannot be interrupted! Description Parameter Parameter REQ IOID Declaration Data type Memory block INPUT BOOL I, Q, M, D, L, constant INPUT BYTE I, Q, M, D, L, constant LADDR INPUT WORD I, Q, M, D, L, constant RECNUM INPUT BYTE RECORD RET_VAL INPUT OUTPUT ANY INT I, Q, M, D, L, constant I, Q, M, D, L I, Q, M, D, L BUSY OUTPUT BOOL I, Q, M, D, L 4-76 Description REQ = 1: write request Identifier for the address space: 54h = peripheral input (PI) 55h = peripheral output (PQ) For hybrid modules the SFC returns the area identifier of the lower address. When the addresses are equal the SFC returns identifier 54h. Logical base address of the module. For hybrid modules the lower of the two addresses must be specified. Record number (valid range: 2 ... 240) Record. Only data type BYTE is valid. The return value contains an error code if an error is detected when the function is being processed. BUSY = 1: the write operation has not been completed. HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Chapter 4 Integrated Standard SFCs RECORD With the first call to the SFC the data that must be transferred is read from the parameter RECORD. However, if the transfer of the record should require more than one call duration, the contents of the parameter RECORD is no longer valid for subsequent calls to the SFC (of the same job). RET_VAL (Return value) Two distinct cases exist for RET_VAL = 8xxxh: • Temporary error (error codes 80A2h ... 80A4h, 80Cxh): For this type of error it is possible that the error corrects itself without intervention. For this reason it is recommended that you re-issue the call to the SFC (once or more than once). Example for temporary errors: the required resources are occupied at present (80C3h). • Permanent error (error codes 809xh, 80A0, 80A1h, 80Bxh): These errors cannot be corrected without intervention. A repeat of the call to the SFC is only meaningful when the error has been removed. Example for permanent errors: incorrect length of the record that must be transferred (80B1h). Value 7000h 7001h 7002h 8090h 8092h 8093h 80A1h 80A2h 80A3h 80A4h Description First call with REQ = 0: data transfer not active; BUSY is set to 0. First call with REQ = 1: data transfer initiated; BUSY is set to 1. Intermediate call (REQ irrelevant): data transfer active; BUSY is set to 1. The specified logical base address is invalid: no assignment available in SDB1/SDB2x, or this is not a base address. ANY-reference contains a type definition that is not equal to BYTE. This SFC is not valid for the module selected by LADDR and IOID. Negative acknowledgement when the record is being transferred to the module (module was removed during the transfer or module failed) DP protocol fault in layer 2, possible hardware-/ interface fault in the DP slave DP protocol fault for user Interface/user Communication failure (this fault occurs between the CPU and the external DP interface) continued ... HB00E - OPL_STD - Rev. 14/22 4-77 Chapter 4 Integrated Standard SFCs ... continue Value 80B0h 80B1h 80B2h 80B3h 80C1h 80C2h 80C3h 80C4h 80C5h 80C6h Manual VIPA Operation List Standard Description • SFC not valid for the type of module. • Module does not recognize the record. • Record number ≥ 241 not permitted. • Records 0 and 1 not permitted. The length specified in parameter RECORD is wrong. The slot that was configured has not been populated. The actual type of module is not equal to the required type of module in SDB1 The module has not yet completed processing of the data of the preceding write operation for the same record. The module is currently processing the maximum number of jobs for a CPU. Required resources (memory, etc.) are currently occupied. Communication error Decentralized periphery not available. The transfer of records was aborted due to a priority class abort. Note! A general error 8544h only indicates that access to at least one byte of I/O memory containing the record was disabled. However, the data transfer was continued. 4-78 HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Chapter 4 Integrated Standard SFCs SFC 59 - RD_REC - Read record The SFC 59 RD_REC (read record) reads the record with the number RECNUM from the selected module. These SFC can be used for digital-, analog modules, FMs, CPs and via PROFIBUS DP-V1. The read operation is started when input parameter REQ is set to 1 when the call to SFC 59 is issued. Output parameter BUSY returns a value of 0 if the read operation was executed immediately. BUSY is set to 1 if the read operation could not be completed. Parameter RECORD determines the target area where the record is saved when it has been transferred successfully. System dependent this block cannot be interrupted! Description Parameter Parameter REQ IOID Declaration Data type Memory block INPUT BOOL I, Q, M, D, L, constant INPUT BYTE I, Q, M, D, L, constant LADDR INPUT WORD I, Q, M, D, L, constant RECNUM INPUT BYTE RET_VAL OUTPUT INT I, Q, M, D, L, constant I, Q, M, D, L BUSY OUTPUT BOOL I, Q, M, D, L HB00E - OPL_STD - Rev. 14/22 Description REQ = 1: read request Identifier for the address space: 54h = peripheral input (PI) 55h = peripheral output (PQ) For hybrid modules the SFC returns the area identifier of the lower address. When the addresses are equal the SFC returns identifier 54h. Logical base address of the module. For hybrid modules the lower of the two addresses must be specified. Record number (valid range: 0 ... 240) The return value contains an error code if an error is detected when the function is being processed. Additionally: the length of the actual record that was read, in bytes (range: +1 ... +240), provided that the target area is greater than the transferred record and that no communication errors have occurred. BUSY = 1: the write operation has not been completed. continued ... 4-79 Chapter 4 Integrated Standard SFCs ... continue Parameter RECORD Declaration Data type Memory block OUTPUT ANY I, Q, M, D, L Manual VIPA Operation List Standard Description Target area for the record that was read. When SFC 59 is processed in asynchronous mode you must ensure that the actual parameters of RECORD have the same length information for all calls. Only data type BYTE is permitted. Suitable choice of RECORD To ensure that an entire record is read you must select a target area with a length of 241bytes. In this case the value in RET_VAL indicates the actual length of the data that was transferred successfully. RET_VAL (Return value) RET_VAL contains an error code when an error occurs while the function was being processed. When the transfer was successful RET_VAL contains: • a value of 0 if the entire target area was filled with data from the selected record (the record may, however, be incomplete). • the length of the record that was transferred, in bytes (valid range: 1 ... 240), provided that the target area is greater than the transferred record. Error information Two distinct cases exist for RET_VAL = 8xxxh: • Temporary error (error codes 80A2h ... 80A4h, 80Cxh): For this type of error it is possible that the error corrects itself without intervention. For this reason it is recommended that you re-issue the call to the SFC (once or more than once). Example for temporary errors: the required resources are occupied at present (80C3h). • Permanent error (error codes 809xh, 80A0h, 80A1h, 80Bxh): These errors cannot be corrected without intervention. A repeat of the call to the SFC is only meaningful when the error has been removed. Example for permanent errors: incorrect length of the record that must be transferred (80B1h). 4-80 HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Chapter 4 Integrated Standard SFCs Error information Value Description 7000h First call with REQ = 0: data transfer not active; BUSY is set to 0. 7001h First call with REQ = 1: data transfer initiated; BUSY is set to 1. 7002h Intermediate call (REQ irrelevant): data transfer active; BUSY is set to 1. 8090h The specified logical base address is invalid: no assignment available in SDB1/SDB2x, or this is not a base address. 8092h ANY-reference contains a type definition that is not equal to BYTE. 8093h This SFC is not valid for the module selected by LADDR and IOID. 80A0h Negative acknowledgement when reading from the module (module was removed during the transfer or module failed) 80A2h DP protocol fault in layer 2, possible hardware-/ interface fault in the DP slave 80A3h DP protocol fault for user Interface/user 80A4h Communication failure (this fault occurs between the CPU and the external DP interface) 80B0h • SFC not valid for the type of module. 80B1h 80B2h 80B3h 80C0h 80C1h 80C2h 80C3h 80C4h 80C5h 80C6h • Module does not recognize the record. • Record number ≥ 241 not permitted. The length specified in parameter RECORD is wrong. The slot that was configured has not been populated. The actual type of module is not equal to the required type of module in SDB1 The module has registered the record but this does not contain any read data as yet. The module has not yet completed processing of the data of the preceding write operation for the same record. The module is currently processing the maximum number of jobs for a CPU. Required resources (memory, etc.) are currently occupied. Communication error Decentralized periphery not available. The transfer of records was aborted due to a priority class abort. Note! A general error 8745h only indicates that access to at least one byte of I/O memory containing the record was disabled. However, the data was read successfully from the module and saved to the I/O memory block. HB00E - OPL_STD - Rev. 14/22 4-81 Manual VIPA Operation List Standard Chapter 4 Integrated Standard SFCs SFC 64 - TIME_TCK - Read system time tick Description The SFC 64 TIME_TCK (time tick) retrieves the system time tick from the CPU. This ma be used to assess the time that certain processes require calculating the difference between the values returned by two SFC 64 calls. The system time is a "time counter" that counts from 0 to a max. of 2147483647ms and that restarts from 0 when an overflow occurs. The timing intervals and the accuracy of the system time depend on the CPU. Only the operating modes of the CPU influence the system time. System time and operating modes Operating mode Restart RUN STOP reboot System time ... ... permanently updated. ... stopped to retain the last value. ... is deleted and starts from "0". Parameters Parameter Declaration Data type RET_VAL OUTPUT TIME RET_VAL (Return value) 4-82 Memory block I, Q, M, D, L Description Parameter RET_VAL contains the system time that was retrieved, range 31 from 0 ... 2 -1ms. The SFC 64 does not return any error information. HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Chapter 4 Integrated Standard SFCs SFC 65 - X_SEND - Send data The SFC 65 X_SEND can be used to send data to an external communication partner outside the local station. The communication partner receives the data by means of the SFC 66 X_RCV. Input parameter REQ_ID is used to identify the transmit data. This code is transferred along with the transmit data and it can be analyzed by the communication partner to determine the origin of the data. The transfer is started when input parameter REQ is set to 1. The size of the transmit buffer that is defined by parameter SD (on the sending CPU) must be less than or equal to the size of the receive buffer (on the communication partner) that was defined by means of parameter RD. In addition, the data type of the transmit buffer and the receive buffer must be identical. Description Parameters Parameter REQ Declaration Data type INPUT BOOL CONT INPUT BOOL DEST_ID INPUT WORD I, Q, M, D, L, constant REQ_ID INPUT DWORD SD INPUT ANY I, Q, M, D, L, constant I, Q, M, D RET_VAL OUTPUT INT I, Q, M, D, L BUSY OUTPUT BOOL I, Q, M, D, L HB00E - OPL_STD - Rev. 14/22 Memory block I, Q, M, D, L, constant I, Q, M, D, L, constant Description control parameter "request to activate", initiates the operation control parameter "continue", defines whether the connection to the communication partner is terminated or not when the operation has been completed Address parameter "destination ID". Contains the MPI-address of the communication partners. Operation code identifying the data on the communication partner. Reference to the send buffer. The following data types are possible: BOOL, BYTE, CHAR, WORD, INT, DWORD, DINT, REAL, DATE, TOD, TIME, S5_TIME, DATE_AND_TIME as well as arrays of the respective data types, with the exception of BOOL. The return value contains an error code if an error is detected when the function is being processed. BUSY = 1: the send operation has not yet been completed. BUSY = 0: the send operation has been completed, or no send operation is active. 4-83 Chapter 4 Integrated Standard SFCs Manual VIPA Operation List Standard Input parameter REQ_ID identifies the send data. Parameter REQ_ID is required by the receiver when • the sending CPU issues multiple calls to SFC 65 with different REQ_ID parameters and the data is transferred to a single communication partner. • more than one sending CPU are transferring data to a communication partner by means of the SFC 65. Receive data can be saved into different memory blocks by analyzing the REQ_ID parameter. REQ_ID Data consistency Since send data is copied into an internal buffer of the operating system when the first call is issued to the SFC it is important to ensure that the send buffer is not modified before the first call has been completed successfully. Otherwise an inconsistency could occur in the transferred data. Any write-access to send data that occurs after the first call is issued does not affect the data consistency. RET_VAL (Return value) The return value contains an error code if an error is detected when the function is being processed. The "real error information" that is contained in the table "specific error information" a. o. may be classified as follows: Value 809xh 80Axh 80Bxh 80Cxh 4-84 Description Error on the CPU where the SFC is being executed Permanent communication error. Error on the communication partner. Temporary error. HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Chapter 4 Integrated Standard SFCs Specific error information: Value Description 0000h Processing completed without errors. 7000h First call with REQ = 0: no data transfer is active; BUSY is set to 0. 7001h First call with REQ = 1: data transfer initiated; BUSY is set to 1. 7002h Intermediate call (REQ irrelevant): data transfer active; BUSY is set to 1. 8090h The specified target address of the communication partners is not valid, e.g. • bad IOID • bad base address exists • bad MPI-address (> 126) 8092h Error in SD or RD, e.g.: • illegal length for SD • SD = NIL is not permitted 8095h 80A0h 80A1h 80B1h 80B4h 80B5h 80B6h 80B8h The block is already being processed on a priority class that has a lower priority. Error in received acknowledgement. Communication failures: SFC-call after an existing connection has been terminated. ANY-pointer error. The length of the data buffer that must be transferred is wrong. ANY-pointer data type error, or ARRAY of the specified data type is not permitted. Processing rejected because of an illegal operating mode. The received acknowledgement contains an unknown error code. The SFC 66 "X_RCV" of the communication partner rejected the data transfer (RD = NIL). The data block was identified by the communication partner (SFC 66 "X_RCV" was called with EN_DT = 0) but it has not yet been accepted into the application program because the operating mode is STOP. The answer of the communication partner does not fit into the communication telegram. The specified connection is already occupied by another operation. Lack of resources on the CPU where the SFC is being executed, e.g.: • The module is already executing the maximum number of different send operations. • Connection resources may be occupied, e.g. by a receive operation. 80B9h 80BAh 80C0h 80C1h 80C2h Temporary lack of resources for the communication partner, e.g.: • The communication partner is currently processing the maximum number of operations. • The required resources (memory, etc.) are already occupied. • Not enough memory (initiate compression.) 80C3h Error when establishing a connection, e.g.: • The local station is connected to the MPI sub-net. • You have addressed the local station on the MPI sub-net. • The communication partner cannot be contacted any longer • Temporary lack of resources for the communication partner. HB00E - OPL_STD - Rev. 14/22 4-85 Chapter 4 Integrated Standard SFCs Manual VIPA Operation List Standard SFC 66 - X_RCV - Receive data The SFC 66 X_RCVS can be used to receive data, that was sent by means of SFC 65 X_SEND by one or more external communication partners. SFC 66 can determine whether the data that was sent is available at the current point in time. The operating system could have stored the respective data in an internal queue. If the data exists in the queue the oldest data block can be copied into the specified receive buffer. Description Parameters Parameter Declaration EN_DT INPUT Data type Memory block BOOL I, Q, M, D, L, constant RET_VAL OUTPUT INT I, Q, M, D, L REQ_ID OUTPUT DWORD I, Q, M, D, L NDA OUTPUT BOOL I, Q, M, D, L 4-86 Description Control parameter "enable data transfer". You can check whether one or more data blocks are available by setting this to 0. A value of 1 results in the oldest data block of the queue being copied into the memory block that was specified by means of RD. The return value contains an error code if an error is detected when the function is being processed. Operation code of the SFC 65 "X_SEND" whose send data is located uppermost in the queue, i.e. the oldest data in the queue. If the queue does not contain a data block REQ_ID is set to 0. Status parameter "new data arrived". NDA = 0: • The queue does not contain a data block. NDA = 1: • The queue does contain one or more data blocks. (call to the SFC 66 with EN_DT = 0). • The oldest data block in the queue was copied into the application program. (call to the SFC 66 with EN_DT = 1). continued ... HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard ... continue Parameter RD Declaration OUTPUT Data reception indication Data type Memory block ANY I, Q, M, D Chapter 4 Integrated Standard SFCs Description Reference to the receive data buffer (receive data area). The following data types are available: BOOL, BYTE, CHAR, WORD, INT, DWORD, DINT, REAL, DATE, TOD, TIME, S5_TIME, DATE_AND_TIME as well as arrays of these data types with the exception of BOOL. If you wish to discard the oldest data block in the queue you must assign a value of NIL to RD. with EN_DT = 0 The operating system inserts data received from a communication partner in the sequence in which they are received. You can test whether at least one data block is ready by issuing a call to the SFC 66 with EN_DT = 0 and testing the resulting output parameter NDA. • NDA = 0 means that the queue does not contain a data block. REQ_ID is irrelevant, RET_VAL contains a value of 7000h. • NDA = 1 means that the queue does contain one or more data blocks. If the queue contains a data block you should also test output parameters RET_VAL and REQ_ID. RET_VAL contains the length of the data block in bytes, REQ_ID contains the operation code of the send block. If the queue should contain multiple data blocks parameters REQ_ID and RET_VAL refer to the oldest data block contained in the queue. HB00E - OPL_STD - Rev. 14/22 4-87 Chapter 4 Integrated Standard SFCs Manual VIPA Operation List Standard Transferring data into the receive buffer with EN_DT = 1 When input parameter EN_DT = 1 then the oldest data block in the queue is copied into the target block defined by RD. You must ensure that the size of RD is greater than or equal to the size of the transmit buffer of the respective SFC 65 X_SEND defined by parameter SD and that that the data types match. If received data should be saved into different areas you can determine the REQ_ID in the first call (SFC-call with EN_DT = 0) and select a suitable value for RD in the subsequent call (with EN_DT = 1). If the operation was processed successfully RET_VAL contains the length (in bytes) of data block that was copied and a positive acknowledgement is returned to the sending station. Discarding data If you do not want to accept the received data assign a value of NIL to RD. The respective communication partner receives a negative acknowledgement (the value of RET_VAL of the respective SFC 65 X_SEND is 80B8h) and parameter RET_VAL is set to 0. Data consistency You must make sure that the receive buffer is not read before the operation has been completed since you could otherwise be reading could cause inconsistent data. Operating mode transition to STOP mode When the CPU changes to STOP mode, • all newly received commands receive a negative acknowledgement. • for commands that have already been received: all commands that have been entered into the in receive queue receive a negative acknowledgement. • all data blocks are discarded when a new start follows. Termination of a connection When the connection is terminated any operation that was entered into the receive queue of this connection is discarded. Exception: if this is the oldest operation in the queue that has already been recognized by a SFC-call with EN_DT = 0 it can be transferred into the receive buffer by means of EN_DT = 1. 4-88 HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard RET_VAL (Return value) Chapter 4 Integrated Standard SFCs If no error has occurred, RET_VAL contains: • when EN_DT = 0/1 and NDA = 0: 7000h. In this case the queue does not contain a data block. • when EN_DT = 0 and NDA = 1, RET_VAL contains the length (in bytes) of the oldest data block that was entered into the queue as a positive number. • when EN_DT = 1 and NDA = 1, RET_VAL contains the length (in bytes) of the data block that was copied into the receive buffer RD as a positive number. Error information The "real error information" that is contained in the table "specific error information" a. o. may be classified as follows: Value 809xh 80Axh 80Bxh 80Cxh Description Error on the CPU where the SFC is being executed Permanent communication error Error on the communication partner Temporary error HB00E - OPL_STD - Rev. 14/22 4-89 Chapter 4 Integrated Standard SFCs Manual VIPA Operation List Standard Specific Error information: Value Description 0000h Processing completed without errors. 00xyh When NDA = 1 and RD <> NIL: RET_VAL contains the length of the received data block (when EN_DT = 0) or the data block copied into RD (when EN_DT = 1). 7000h EN_DT = 0/1 and NDA = 0 7001h First call with REQ = 1: data transfer initiated; BUSY is set to 1. 7002h Intermediate call (REQ irrelevant): data transfer active; BUSY is set to 1. 8090h The specified target address of the communication partners is not valid, e.g. • bad IOID • bad base address exists • bad MPI-address (> 126) 8092h Error in SD or RD, e.g.: • The amount of data received is too much for the buffer defined by RD. • RD has data type BOOL but the length of the received data is greater than one byte. 8095h The block is already being processed on a priority class that has a lower priority. 80A0h Error in received acknowledgement. 80A1h Communication failures: SFC-call after an existing connection has been terminated. 80B1h ANY-pointer error. The length of the data block that must be transferred is wrong. 80B4h ANY-pointer data type error, or ARRAY of the specified data type is not permitted. 80B6h The received acknowledgement contains an unknown error code. 80BAh The answer of the communication partner does not fit into the communication telegram. 80C0h The specified connection is already occupied by another operation. 80C1h Lack of resources on the CPU where the SFC is being executed, e.g.: • the module is already executing the maximum number of different send operations. • connection resources may be occupied, e.g. by a receive operation. 80C2h Temporary lack of resources for the communication partner, e.g.: • The communication partner is currently processing the maximum number of operations. • The required resources (memory, etc.) are already occupied. • Not enough memory (initiate compression). 80C3h Error when establishing a connection, e.g.: • The local station is connected to the MPI sub-net. • You have addressed the local station on the MPI sub-net. • The communication partner cannot be contacted any longer. • Temporary lack of resources for the communication partner. 4-90 HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Chapter 4 Integrated Standard SFCs SFC 67 - X_GET - Read data Description The SFC 67 X_GET can be used to read data from an external communication partner that is located outside the local station. No relevant SFC exists on the communication partner. The operation is started when input parameter REQ is set to 1. Thereafter the call to the SFC 67 is repeated until the value of output parameter BUSY becomes 0. Output parameter RET_VAL contains the length of the received data block in bytes. The length of the receive buffer defined by parameter RD (in the receiving CPU) must be identical or greater than the read buffer defined by parameter VAR_ADDR (for the communication partner) and the data types of RD and VAR_ADDR must be identical. Parameters Parameter REQ Declaration Data type INPUT BOOL CONT INPUT BOOL DEST_ID INPUT WORD I, Q, M, D, L, constant VAR_ADDR INPUT ANY I, Q, M, D RET_VAL OUTPUT INT I, Q, M, D, L BUSY OUTPUT BOOL I, Q, M, D, L RD OUTPUT ANY I, Q, M, D HB00E - OPL_STD - Rev. 14/22 Memory block I, Q, M, D, L, constant I, Q, M, D, L, constant Description Control parameter "request to activate", used to initiate the operation Control parameter "continue", determines whether the connection to the communication partner is terminated or not when the operation has been completed Address parameter "destination ID". Contains the MPI address of the communication partner. Reference to the buffer in the partner-CPU from where data must be read. You must select a data type that is supported by the communication partner. The return value contains an error code if an error is detected when the function is being processed. If no error has occurred, RET_VAL contains the length of the data block that was copied into receive buffer RD as positive number of bytes. BUSY = 1: the receive operation has not been completed. BUSY = 0: The receive operation has been completed or no receive operation active. Reference to the receive buffer (receive data area). The following data types are permitted: BOOL, BYTE, CHAR, WORD, INT, DWORD, DINT, REAL, DATE, TOD, TIME, S5_TIME, DATE_AND_TIME as well as arrays of the above data types, with the exception of BOOL 4-91 Chapter 4 Integrated Standard SFCs Data consistency Manual VIPA Operation List Standard The following rules must be satisfied to prevent the data consistency from being compromised: • Active CPU (receiver of data): The receive buffer should be read in the OB that issues the call to the respective SFC. If this is not possible the receive buffer should only be read when processing of the respective SFC has been completed. • Passive CPU (sender of data): The maximum amount of data that may be written into the send buffer is determined by the block size of the passive CPU (sender of data ). • Passive CPU (sender of data): Send data should be written to the send buffer while interrupts are inhibited. Operating mode transition to STOP mode When the CPU changes to STOP mode the connection established by means of the SFC 67 is terminated. The type of start-up that follows determines whether any previously received data located in a buffer of the operating system are discarded or not. A reboot start means that the data is discarded. Operating mode transition of the communication partners to STOP mode A transition to operating mode STOP of the CPU of the communication partner does not affect the data transfer, since it is also possible to read data in operating mode STOP. 4-92 HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard RET_VAL (Return value) Value 809xh 80Axh 80Bxh 80Cxh Chapter 4 Integrated Standard SFCs The "real error information" that is contained in the table "specific error information" a. o. may be classified as follows: Description Error on the CPU where the SFC is being executed Permanent communication error Error on the communication partner Temporary error Specific error information: Value Description 0000h Processing completed without errors. 00xyh RET_VAL contains the length of the received data block. 7000h Call issued with REQ = 0 (call without processing), BUSY is set to 0, no data transfer is active. 7001h First call with REQ = 1: data transfer initiated; BUSY is set to 1. 7002h Intermediate call (REQ irrelevant): data transfer active; BUSY is set to 1. 8090h The specified target address of the communication partners is not valid, e.g. • bad IOID • bad base address exists • bad MPI-address (> 126) 8092h Error in SD or RD, e.g.: • illegal length for RD • the length or the data type of RD does not correspond with the received data. • RD = NIL is not permitted. 8095h The block is already being processed on a priority class that has a lower priority. Error in received acknowledgement. Communication failures: SFC-call after an existing connection has been terminated. Object cannot be found, e.g. DB was not loaded. ANY-pointer error. The length of the data block that must be transferred is wrong. continued ... 80A0h 80A1h 80B0h 80B1h HB00E - OPL_STD - Rev. 14/22 4-93 Chapter 4 Integrated Standard SFCs ... continue Value 80B2h 80B3h 80B4h 80B6h 80BAh 80C0h 80C1h 4-94 Manual VIPA Operation List Standard Description HW-error: module does not exist • The slot that was configured is empty. • Actual module type does not match the required module type. • Decentralized periphery not available. • The respective SDB does not contain an entry for the module. Data may only be read or written, e.g. write protected DB The communication partner does not support the data type specified in VAR_ADDR. The received acknowledgement contains an unknown error code. The answer of the communication partner does not fit into the communication telegram. The specified connection is already occupied by another operation. Lack of resources on the CPU where the SFC is being executed, e.g.: • The module is already executing the maximum number of different send operations. • Connection resources may be occupied, e.g. by a receive operation. 80C2h Temporary lack of resources for the communication partner, e.g.: • The communication partner is currently processing the maximum number of operations. • The required resources (memory, etc.) are already occupied • Not enough memory (initiate compression.) 80C3h Error when establishing a connection, e.g.: • The local station is connected to the MPI sub-net. • You have addressed the local station on the MPI sub-net. • The communication partner cannot be contacted any longer. • Temporary lack of resources for the communication partner. HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Chapter 4 Integrated Standard SFCs SFC 68 - X_PUT - Write data Description The SFC 68 X_PUT can be used to write data to an external communication partner that is located outside the local station. No relevant SFC exists on the communication partner. The operation is started when input parameter REQ is set to 1. Thereafter the call to SFC 68 is repeated until the value of output parameter BUSY becomes 0. The length of the send buffer defined by parameter SD (in the sending CPU) must be identical or greater than the receive buffer defined by parameter VAR_ADDR (for the communication partner) and the data types of SD and VAR_ADDR must be identical. Parameters Parameter REQ Declaration Data type INPUT BOOL Memory block I, Q, M, D, L, constant CONT INPUT BOOL I, Q, M, D, L, constant DEST_ID INPUT WORD I, Q, M, D, L, constant VAR_ADDR INPUT ANY I, Q, M, D SD INPUT ANY I, Q, M, D RET_VAL OUTPUT INT I, Q, M, D, L BUSY OUTPUT BOOL I, Q, M, D, L HB00E - OPL_STD - Rev. 14/22 Description control parameter "request to activate", used to initiate the operation control parameter "continue", determines whether the connection to the communication partner is terminated or not when the operation has been completed Address parameter "destination ID". Contains the MPI address of the communication partner. Reference to the buffer in the partner-CPU into which data must be written. You must select a data type that is supported by the communication partner. Reference to the buffer in the local CPU that contains the send data. The following data types are permitted: BOOL, BYTE, CHAR, WORD, INT, DWORD, DINT, REAL, DATE, TOD, TIME, S5_TIME, DATE_AND_TIME as well as arrays of the above data types, with the exception of BOOL. The return value contains an error code if an error is detected when the function is being processed. BUSY = 1: the send operation has not been completed. BUSY = 0: The send operation has been completed or no send operation is active. 4-95 Chapter 4 Integrated Standard SFCs Manual VIPA Operation List Standard Data consistency The following rules must be satisfied to prevent the data consistency from being compromised: • Active CPU (sender of data): The send buffer should be written in the OB that issues the call to the respective SFC. If this is not possible the send buffer should only be written when processing of the first call to the respective SFC has been completed. • Active CPU (sender of data): The maximum amount of data that may be written into the send buffer is determined by the block size of the passive CPU (sender of data ). • Passive CPU (receiver of data): Receive data should be read from the receive buffer while interrupts are inhibited. Operating mode transition to STOP mode When the CPU changes to STOP mode the connection established by means of the SFC 68 is terminated and data can no longer be sent. If the send data had already been copied into the internal buffer when the transition to STOP mode occurs the contents of the buffer is discarded. Operating mode transition of the partners to STOP mode A transition to operating mode STOP of the CPU of the communication partner does not affect the data transfer, since it is also possible to write data in operating mode STOP. RET_VAL (Return value) The "real error information" that is contained in the table "specific error information" a. o. may be classified as follows: Value 809xh 80Axh 80Bxh 80Cxh 4-96 Description Error on the CPU where the SFC is being executed. Permanent communication error. Error on the communication partner. Temporary error. HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Chapter 4 Integrated Standard SFCs Specific error information: Value Description 0000h Processing completed without errors. 7000h Call issued with REQ = 0 (call without processing), BUSY is set to 0, no data transfer is active. 7001h First call with REQ = 1: data transfer initiated; BUSY is set to 1. 7002h Intermediate call (REQ irrelevant): data transfer active; BUSY is set to 1. 8090h The specified target address of the communication partners is not valid, e.g. • bad IOID • bad base address exists • bad MPI-address (> 126) 8092h Error in SD or RD, e.g.: • illegal length of SD • SD = NIL is not permitted 8095h The block is already being processed on a priority class that has a lower priority. 80A0h The data type specified by SD of the sending CPU is not supported by the communication partner. 80A1h Communication failures: SFC-call after an existing connection has been terminated. 80B0h Object cannot be found, e.g. DB was not loaded. 80B1h ANY-pointer error. The length of the data block that must be transferred is wrong. 80B2h HW-error: module does not exist • the slot that was configured is empty. • Actual module type does not match the required module type. • Decentralized periphery not available. • The respective SDB does not contain an entry for the module. 80B3h Data can either be read or written, e.g. write protected DB 80B4h The communication partner does not support the data type specified in VAR_ADDR. 80B6h The received acknowledgement contains an unknown error code. 80B7h Data type and / or the length of the transferred data does not fit the buffer in the partner CPU where the data must be written. 80BAh The answer of the communication partner does not fit into the communication telegram. 80C0h The specified connection is already occupied by another operation. 80C1h Lack of resources on the CPU where the SFC is being executed, e.g.: • the module is already executing the maximum number of different send operations. • connection resources may be occupied, e.g. by a receive operation. 80C2h Temporary lack of resources for the communication partner, e.g.: • The communication partner is currently processing the maximum number of operations. • The required resources (memory, etc.) are already occupied • Not enough memory (initiate compression) 80C3h Error when establishing a connection, e.g.: • The local station is connected to the MPI sub-net. • You have addressed the local station on the MPI sub-net. • The communication partner cannot be contacted any longer. • Temporary lack of resources for the communication partner. HB00E - OPL_STD - Rev. 14/22 4-97 Manual VIPA Operation List Standard Chapter 4 Integrated Standard SFCs SFC 69 - X_ABORT - Disconnect Description The SFC 69 X_ABORT can be used to terminate a connection to a communication partner that is located outside the local station, provided that the connection was established by means one of SFCs 65, 67 or 68. The operation is started when input parameter REQ is set to 1. If the operation belonging to SFCs 65, 67 or 68 has already been completed (BUSY = 0) then the connection related resources occupied by both partners are enabled again when the call to the SFC 69 has been issued. However, if the respective operation has not yet been completed (BUSY = 1), the call to the respective SFC 65, 67 or 68 must be repeated after the connection has been terminated with REQ = 0 and CONT = 0. The connection resources are only available again when BUSY = 0. The SFC 69 can only be called on the side where SFC 65, 67 or 68 is being executed. Parameters Parameter REQ Declaration Data type INPUT BOOL DEST_ID INPUT WORD RET_VAL OUTPUT INT I, Q, M, D, L BUSY OUTPUT BOOL I, Q, M, D, L 4-98 Memory block I, Q, M, D, L, constant I, Q, M, D, L, constant Description Control parameter "request to activate", used to initiate the operation Address parameter "destination ID". Contains the MPI address of the communication partner. The return value contains an error code if an error is detected when the function is being processed. BUSY = 1: connection termination not yet completed. BUSY = 0: connection termination has been completed. HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Chapter 4 Integrated Standard SFCs Operating mode transition to STOP mode The connection termination initiated by means of the SFC 69 is still completed, even if the CPU changes to STOP mode. Operating mode transition of the partners to STOP mode A transition to operating mode STOP of the CPU of the communication partner does not affect the connection termination, the connection is terminated in spite of the change of operating mode. RET_VAL (Return value) The "real error information" that is contained in the table "specific error information" and others may be classified as follows: Value 809xh 80Axh 80Bxh 80Cxh Description Error on the CPU where the SFC is being executed Permanent communication error Error on the communication partner Temporary error HB00E - OPL_STD - Rev. 14/22 4-99 Chapter 4 Integrated Standard SFCs Manual VIPA Operation List Standard Specific error information: Value Description 0000h REQ = 1 when the specified connection has not been established. 7000h Call issued with REQ = 0 (call without processing), BUSY is set to 0, no data transfer is active. 7001h First call with REQ = 1: data transfer initiated; BUSY is set to 1. 7002h Intermediate call with REQ = 1. 8090h The specified target address of the communication partners is not valid, e.g. • bad IOID • bad base address exists • bad MPI-address (> 126) 8095h 80A0h 80A1h 80B1h 80B4h 80B6h 80BAh 80C0h 80C1h The block is already being processed on a priority class that has a lower priority. Error in the acknowledgement that was received. Communication failures: SFC-call after an existing connection has been terminated. ANY-pointer error. The length of the data block that must be transferred is wrong. ANY-pointer data type error, or ARRAY of the specified data type is not permitted. The received acknowledgement contains an unknown error code. The answer of the communication partner does not fit into the communication telegram. The specified connection is already occupied by another operation. Lack of resources on the CPU where the SFC is being executed, e.g.: • the module is already executing the maximum number of different send operations. • connection resources may be occupied, e.g. by a receive operation. 80C2h Temporary lack of resources for the communication partner, e.g.: • The communication partner is currently processing the maximum number of operations. • The required resources (memory, etc.) are already occupied. • Not enough memory (initiate compression). 80C3h Error when establishing a connection, e.g.: • The local station is connected to the MPI sub-net. • You have addressed the local station on the MPI sub-net. • The communication partner cannot be contacted any longer. • Temporary lack of resources for the communication partner. 4-100 HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Chapter 4 Integrated Standard SFCs SFC 81 - UBLKMOV - Copy data area without gaps Description The SFC 81 UBLKMOV (uninterruptible block move) creates a consistent copy of the contents of a memory block (= source field) in another memory block (= target field). The copy procedure cannot be interrupted by other activities of the operating system. It is possible to copy any memory block, with the exception of: • the following blocks: FC, SFC, FB, SFB, OB, SDB • counters • timers • memory blocks of the peripheral area • data blocks those are irrelevant to the execution. The maximum amount of data that can be copied is 512bytes. Interruptability It is not possible to interrupt the copy process. For this reason it is important to note that any use of the SFC 81 will increase the reaction time of your CPU to interrupts. Parameters Parameter SRCBLK Declaration Data type Memory block INPUT ANY I, Q, M, D, L RET_VAL OUTPUT INT I, Q, M, D, L DSTBLK OUTPUT ANY I, Q, M, D, L HB00E - OPL_STD - Rev. 14/22 Description Specifies the memory block that must be copied (source field). Arrays of data type STRING are not permitted. The return value contains an error code if an error is detected when the function is being processed. Specifies the target memory block where the data must be copied (target field). Arrays of data type STRING are not permitted. 4-101 Chapter 4 Integrated Standard SFCs Manual VIPA Operation List Standard Note! The source and target field must not overlap. If the specified target field is larger than the source field, only the amount of data located in the source field will be copied into the target field. However, if the size of the specified target field is less than the size of the source field, then only the amount of data that will fit into the target field will be copied. If the data type of the ANY-pointer (source or target) is BOOL, then the specified length must be divisible by 8, otherwise the SFC will not be executed. If the data type of the ANY-pointer is STRING the specified length must be 1. RET_VAL (Return value) 4-102 Value Description 0000h no error 8091h The source area is located in a data block that is not relevant to execution. HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Chapter 5 VIPA specific blocks Chapter 5 VIPA specific blocks Overview Here the VIPA specific blocks are described that are exclusively may be used with the standard CPUs from VIPA of the Systems 100V, 200V, 300V and 500V. Please note that not every block listed here is integrated in every system CPU. The assignment to the according system may be in the table of the "Overview". Content Topic Page VIPA specific blocks ....................................................... 5-1 Chapter 5 Overview .............................................................................................. 5-2 Include VIPA library.............................................................................. 5-4 FB 55 - IP_CONFIG - Programmed Communication Connections ....... 5-5 FC 0 - SEND - Send to CP 240 .......................................................... 5-10 FC 1 - RECEIVE - Receive from CP 240............................................ 5-11 FC 5 - AG_SEND / FC 6 - AG_RECV - CP 243 communication......... 5-12 FC 8 - STEUERBIT - Modem functionality CP 240............................. 5-17 FC 9 - SYNCHRON_RESET - Synchronization CPU and CP 240...... 5-18 FC 11 - ASCII_FRAGMENT - Receive fragmented from CP 240 ....... 5-19 Serial communication - SFC 207 and SFC 216...218 ......................... 5-20 SFC 207 - SER_CTRL ...................................................................... 5-21 SFC 216 - SER_CFG ........................................................................ 5-22 SFC 217 - SER_SND ....................................................................... 5-26 SFC 218 - SER_RCV ....................................................................... 5-29 SFC 219 - CAN_TLGR - Send CAN telegram .................................... 5-30 MMC Access - SFC 220...222 ........................................................... 5-33 SFC 220 - MMC_CR_F ..................................................................... 5-34 SFC 221 - MMC_RD_F ..................................................................... 5-36 SFC 222 - MMC_WR_F .................................................................... 5-37 SFC 223 - PWM - Pulse duration modulation ..................................... 5-38 SFC 224 - HSC - High-speed counter ................................................ 5-40 SFC 225 - HF_PWM - HF pulse duration modulation ......................... 5-42 SFC 227 - TD_PRM - TD200 communication..................................... 5-44 SFC 228 - RW_KACHEL - Page frame direct access ........................ 5-46 Page frame communication - SFC 230 ... 238.................................... 5-48 Page frame communication - Parameter transfer............................... 5-51 Page frame communication - Source res. destination definition ......... 5-52 Page frame communication - Indicator word ANZW........................... 5-55 Page frame communication - Parameterization error PAFE ............... 5-62 SFC 230 - SEND ............................................................................... 5-63 SFC 231 - RECEIVE ......................................................................... 5-64 SFC 232 - FETCH ............................................................................. 5-65 SFC 233 - CONTROL ....................................................................... 5-66 SFC 234 - RESET ............................................................................. 5-67 SFC 235 - SYNCHRON ..................................................................... 5-68 SFC 236 - SEND_ALL ....................................................................... 5-69 SFC 237 - RECEIVE_ALL ................................................................. 5-70 SFC 238 - CTRL1 ............................................................................. 5-71 HB00E - OPL_STD - Rev. 14/22 5-1 Chapter 5 VIPA specific blocks Manual VIPA Operation List Standard Overview General The integrated SFCs are programmed in Assembler and for this they have a fast processing time. They do not occupy space in the internal program memory. The integrated blocks are called in the user application. The following pages show the VIPA specific blocks that may be called for special functions in the control application. Assignment table block ←→ CPU For not every block is integrated in every CPU family the following table shows the assignment between integrated block and CPU. The first number specifies the CPU family, e.g. 31x means CPU 31x from System 300V. For a better overview, in the following block descriptions the corresponding extract of this table is repeated. Block FB 55 FC 0 FC 1 FC 5 FC 6 FC 8 FC 9 SFC 204 SCF 205 SCF 206 SFC 207 SFC 216 SFC 217 SFC 218 SFC 219 SFC 220 SFC 221 SFC 222 SFC 223 SFC 224 SFC 225 Name IP_CONF SEND RECEIVE AG_SEND AG_RECEIVE STEUERBIT SYNCHRON_ RESET ASCII_ FRAGMENT IP_CONF AG_SEND AG_RECV SER_CTRL SER_CFG SER_SND SER_RCV CAN_TLGR MMC_CR_F MMC_RD_F MMC_WR_F PWM HSC HF_PWM SFC 227 TD_PRM FC 11 Description Programmed communication connections Send data to CP 240 Receive data from CP 240 Send data to Ethernet CP 243 Receive data from Ethernet CP 243 Modem functionality of CP 240 Synchronization between CPU and CP 240 21x •* • • •* •* • • Receive ASCII fragmented with CP 240 • Internal used for FB 55 IP_CONF Internal used for FC 5 AG_SEND Internal used for FC 6 AG_RECEIVE RS232 modem functionality RS232 parameterization RS232 Send RS232 Receive Send CAN telegram Create file on MMC Read file from MMC Write to file on MMC Parameterize pulse duration modulation Parameterize high-speed counter Parameterize HF pulse duration modulation ( up to 50kHz ) Parameterization for TD200 communication •* •* •* • • • • • • • • *) only in CPU 21x-2BT1x available 5-2 11x • • • • • • • • • • • • • 31x 51x • • • • • • • • • • continued ... HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Chapter 5 VIPA specific blocks ... continue Block SFC 228 SFC 230 SFC 231 SFC 232 SFC 233 SFC 234 SFC 235 SFC 236 SFC 237 SFC 238 Name RW_KACHEL SEND RECEIVE FETCH CONTROL RESET SYNCHRON SEND_ALL RECV_ALL CONTROL1 Description Read/Write page frame Send via page frame Receive via page frame Fetch via page frame Control for page frame communication Reset for page frame communication Synchron for page frame communication Send_All via page frame Receive via page frame Control for page frame communication with type ANZW: Pointer and parameter IND. HB00E - OPL_STD - Rev. 14/22 11x 21x • • • • • • • • • • 31x • • • • • • • • • • 51x • • • • • • • • • • 5-3 Chapter 5 VIPA specific blocks Manual VIPA Operation List Standard Include VIPA library Overview The VIPA specific blocks may be found at www.vipa.de as downloadable library at the service area with Downloads > VIPA LIB. The library is available as packed zip-file. If you want to use VIPA specific blocks, you have to import the library into your project. Execute the following steps: • Extract FX000011_Vxxx.zip • "Retrieve" the library • Open library and transfer blocks into the project Unzip FX000011_Vxxx.zip Start your un-zip application with a double click on the file FX000011_Vxxx.zip and copy the file VIPA.ZIP to your work directory. It is not necessary to extract this file, too. Retrieve library To retrieve your library for the SPEED7-CPUs, start the SIMATIC manager from Siemens. Open the dialog window for archive selection via File > Retrieve. Navigate to your work directory. Choose VIPA.ZIP and click at [Open]. Select a destination folder where the blocks are to be stored. [OK] starts the extraction. Open library and transfer blocks to project After the extraction open the library. Open your project and copy the necessary blocks from the library into the directory "blocks" of your project. Now you have access to the VIPA specific blocks via your user application. 5-4 HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Chapter 5 VIPA specific blocks 11x 21x 9* 31x 51x FB 55 - IP_CONFIG - Programmed Communication Connections Overview In some situations, it is an advantage to set up communication connections not with Siemens NetPro but program-controlled by a specific application. A VIPA function block (FB 55) is available for these applications that allows flexible transfer of data blocks with configuration data to a CP. Within the FB 55 the VIPA special block SFC 204 stored in the CPU is called. Principle Configuration data for communication connections may be transferred to the CP by the FB 55 called in the user program. DB FB 55 IP_CONF System data for CP Connection 1 Connection 2 . . . Configuration data transfered to the CP Connection 64 The configuration DB may be loaded into the CP at any time. Attention! As soon as the user program transfers the connection data via FB 55 IP_CONFIG, the CPU switches the CP briefly to STOP. The CP accepts the system data (including IP address) and the new connection data and processes it during startup (RUN). *) only with CPU 21x-2BT1x available HB00E - OPL_STD - Rev. 14/22 5-5 Manual VIPA Operation List Standard Chapter 5 VIPA specific blocks FB 55 IP_CONFIG Depending on the size of the configuration DB, the data may be transferred to the CP in several segments. This means that the FB must as long be called as the FB signals complete transfer by setting the DONE = 1. The Job is started with ACT = 1. Parameters Parameter Declaration Data type ACT INPUT BOOL LADDR INPUT Memory block Description When the FB is called with ACT = 1, the DBxx is I, Q, M, D, L WORD I, Q, M, D, constant ANY I, Q, M, D INPUT INT DONE OUTPUT BOOL I, Q, M, D, constant I, Q, M, D, L ERROR STATUS EXT_ STATUS OUTPUT OUTPUT OUTPUT BOOL WORD WORD I, Q, M, D, L I, Q, M, D I, Q, M, D CONF_DB INPUT LEN 5-6 transmitted to the CP. If the FB is called with ACT = 0, only the status codes DONE, ERROR and STATUS are updated. Module base address When the CP is configured by the Siemens hardware configuration, the module base address is displayed in the configuration table. Specify this address here. The parameter points to the start address of the configuration data area in a DB. Length information in bytes for the configuration data area. The parameter indicates whether the configuration data areas was completely transferred. Remember that it may be necessary to call the FB several times depending on the size of the configuration data area (in several cycles) until the parameter DONE = 1 to signal completion of the transfer. Error code Status code If an error occurs during the execution of a job, the parameter indicates, which parameter was detected as the cause of the error in the configuration DB. High byte: Index of the parameter block Low byte: Index of the subfield within the parameter block. HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Chapter 5 VIPA specific blocks Error information ERROR 0 0 1 1 STATUS 0000h 8181h 80B1h 80C4h 1 1 1 1 80D2h 8183h 8184h 8185h 1 8186h 1 8187h 1 1 8A01h 8A02h 1 8A03h 1 8A04h 1 8A05h 1 8A06h 1 1 1 1 8B01h 8B02h 8B03h 8B04h 1 1 1 1 1 1 1 1 1 8B05h 8B06h 8B07h 8B08h 8B09h 8B0Ah 8B0Bh 8B0Ch 8B0Dh Description Job completed without errors Job active The amount of data to be sent exceeds the upper limit permitted for this service. Communication error The error can occur temporarily; it is usually best to repeat the job in the user program. Configuration error, the module you are using does not support this service. The CP rejects the requested record set number. System error or illegal parameter type. The value of the LEN parameter is larger than the CONF_DB less the reserved header (4bytes) or the length information is incorrect. Illegal parameter detected. The ANY pointer CONF_DB does not point to data block. Illegal status of the FB. Data in the header of CONF_DB was possibly overwritten. The status code in the record set is invalid (value is >=3). There is no job running on the CP; however the FB has expected an acknowledgment for a competed job. There is no job running on the CP and the CP is not ready; the FB triggered the first job to read a record set. There is no job running on the CP and the CP is not ready; the FB nevertheless expected an acknowledgment for a completed job. There is a job running, but there was no acknowledgment; the FB nevertheless triggered the first job for a read record set job. A job is complete but the FB nevertheless triggered the first job for a read record set job. Communication error, the DB could not be transferred. Parameter error, double parameter field Parameter error, the subfield in the parameter field is not permitted. Parameter error, the length specified in the FB does not match the length of the parameter fields/subfields. Parameter error, the length of the parameter field is invalid. Parameter error, the length of the subfield is invalid. Parameter error, the ID of the parameter field is invalid. Parameter error, the ID of the subfield is invalid. System error, the connection does not exist. Data error, the content of the subfield is not correct. Structure error, a subfield exists twice. Data error, the parameter does not contain all the necessary parameters. Data error, the CONF_DB does not contain a parameter field for system data. continued... HB00E - OPL_STD - Rev. 14/22 5-7 Chapter 5 VIPA specific blocks ...continue ERROR 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 5-8 STATUS 8B0Eh 8B0Fh 8B10 8B11 8B12 8B13 8F22h 8F23h 8F24h 8F25h 8F28h 8F29h 8F30h 8F31h 8F32h 8F33h 8F3Ah 8F42h 8F43h 8F44h 8F45h 8F7Fh Manual VIPA Operation List Standard Description Data error/structure error, the CONF_DB type is invalid. System error, the CP does not have enough resources to process CONF_DB completely. Data error, configuration by the user program is not set. Data error, the specified type of parameter field is invalid. Data error, too many connections were specified CP internal error Area length error reading a parameter. Area length error writing a parameter. Area error reading a parameter. Area error writing a parameter. Alignment error reading a parameter. Alignment error writing a parameter. The parameter is in the write-protected first current data block. The parameter is in the write-protected second current data block. The parameter contains a DB number that is too high. DB number error The target area was not loaded (DB). Timeout reading a parameter from the I/O area. Timeout writing a parameter from the I/O area. Address of the parameter to be read is disabled in the accessed rack. Address of the parameter to be written is disabled in the accessed rack. Internal error HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Chapter 5 VIPA specific blocks Configuration Data Block The configuration data block (CONF_DB) contains all the connection data and configuration data (IP address, subnet mask, default router, NTP time server and other parameters) for an Ethernet CP. The configuration data block is transferred to the CP with function block FB 55. Structure The CONF_DB can start at any point within a data block as specified by an offset range. The connections and specific system data are described by an identically structured parameter field. Configuration Data block Parameter field - System data Offset range 0..n CONF_DB DB identifier System data for CP Connection 1 Type ID (for system data=0) Number of subfields Subfield 1 ... Subfield n Parameter field - Connections Type ID (for system data=0) number of subfields Subfield 1 ... Connection 2 Connection n Subfield Single parameter Subfield n Parameter field for system data for CP Structure Below, there are the subfields that are relevant for networking the CP. These must be specified in the parameter field for system data. Some applications do not require all the subfield types. Type = 0 ID = 0 Number of subfields = n Subfield 1 Subfield 2 Subfield n Subfield ID Type 1 SUB_IP_V4 2 4 SUB_NETMASK SUB_DNS_SERV_ADDR 8 SUB_DEF_ROUTER 14 SUB_DHCP_ENABLE 15 SUB_CLIENT_ID Length (byte) 4+4 Description Parameter Special features IP address of the local station according to IPv4 4+4 Subnet mask of the local station 4+4 DNS Server Address This subfield can occur to 4 times. The first entry is the primary DNS server. 4+4 IP address of the default router 4+1 Obtain an IP address 0: no DHCP from a DHCP. 1: DHCP Length Client- ID + 4 HB00E - OPL_STD - Rev. 14/22 Use mandatory mandatory optional optional optional optional 5-9 Manual VIPA Operation List Standard Chapter 5 VIPA specific blocks 11x 21x 9 31x 51x FC 0 - SEND - Send to CP 240 Description Parameters Name ADR _DB ABD ANZ FRG GESE ANZ_INT ENDE_KOMM LETZTER_BLOCK SENDEN_LAEUFT FEHLER_KOM PAFE This FC serves the data output from the CPU to the CP 240. Here you define the send range via the identifiers _DB, ABD and ANZ. Via the bit FRG the send initialization is set and the data is send. After the data transfer the handling block sets the bit FRG back again. Declaration IN IN IN IN IN_OUT IN_OUT IN_OUT IN_OUT IN_OUT IN_OUT IN_OUT OUT Type INT BLOCK_DB WORD WORD BOOL WORD WORD BOOL BOOL BOOL BOOL BYTE Comment Logical Address DB No. of DB containing data to send Number of 1. data word to send No of bytes to send Start bit of the function internal use internal use internal use internal use Status of function internal use Parameterization error (0 = OK) ADR Periphery address with which you may call the CP 240. Via the hardware configuration you may set the periphery address. _DB Number of the data block, which contains the data to send. ABD Word variable that contains the number of the data word from where on the characters for output are stored. ANZ Number of the bytes that are to be transferred. FRG enable send At FRG = "1" the data defined via _DB, ADB and ANZ are transferred once to the CP addresses by ADR. After the transmission the FRG is set back again. When FRG = "0" at call of the block, it is left immediately! PAFE At proper function, all bits of this bit memory byte are "0". At errors an error code is entered. The error setting is self-acknowledging, i.e. after elimination of the error cause, the byte is set back to "0" again. The following errors may occur: 1 = Data block not present 2 = Data block too short 3 = Data block number outside valid range GESE, ANZ_INT ENDE_KOM LETZTER_BLOCK SENDEN_LAEUFT FEHLER_KOM These parameters are internally used. They serve the information exchange between the handling blocks. For the deployment of the SYNCHRON_RESET (FC9) the control bits ENDE_KOM, LETZTER _BLOCK, SENDEN_LAEUFT and FEHLER_KOM must always be stored in a bit memory byte. 5-10 HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Chapter 5 VIPA specific blocks 11x 21x 9 31x 51x FC 1 - RECEIVE - Receive from CP 240 Description Parameters Name ADR _DB ABD ANZ EMFR GEEM ANZ_INT EMPF_LAEUFT LETZTER_BLOCK FEHLER_EMPF PAFE OFFSET This FC serves the data reception of the CP 240. Here you set the reception range via the identifiers _DB and ABD. When the output EMFR is set, a new telegram has been read completely. The length of the telegram is stored in ANZ. After the evaluation of the telegram this bit has to be set back by the user, otherwise no further telegram may be taken over by the CPU. Declaration IN IN IN OUT OUT IN_OUT IN_OUT IN_OUT IN_OUT IN_OUT OUT IN_OUT Type INT BLOCK_DB WORD WORD BOOL WORD WORD BOOL BOOL BOOL BYTE WORD Comment Logical Address DB No. of DB containing received data No. of 1st data word received No of bytes received 1=data received, reset by user internal use internal use Status of function internal use internal use Parameterization error (0 = OK) internal use ADR Periphery address for calling the CP 240. You define the periphery address via the hardware configuration. _DB Number of the data block, which contains the data. ABD Word variable that contains the number of the data word from where on the received characters are stored. ANZ Word variable that contains the amount of received bytes. EMFR By setting of EMFR the handling block shows that data has been received. Not until setting back EMFR in the user application new data can be received. PAFE At proper function, all bits of this bit memory byte are "0". At errors an error code is entered. The error setting is self-acknowledging, i.e. after elimination of the error cause, the byte is set back to "0" again. The following errors may occur: 1 = Data block not present 2 = Data block too short 3 = Data block number outside valid range GEEM, ANZ_INT LETZTER_BLOCK EMPF_LAEUFT FEHLER_EMPF OFFSET These parameters are internally used. They serve the information exchange between the handling blocks. For the deployment of the SYNCHRON_RESET (FC9) the control bits LETZTER_BLOCK, EMPF_LAEUFT and FEHLER_EMPF must always be stored in a bit memory byte. HB00E - OPL_STD - Rev. 14/22 5-11 Chapter 5 VIPA specific blocks Manual VIPA Operation List Standard 11x 21x 9* 31x 51x FC 5 - AG_SEND / FC 6 - AG_RECV - CP 243 communication Overview These two blocks serve for the execution of connection commands at the PLC side of a CP 243. By including these blocks into the cycle block OB 1 you may send and receive data cyclically. Within these blocks the VIPA special blocks SFC 205 and SFC 206 stored in the CPU are called. Note! Please regard that you may only use the SEND/RECV-FCs from VIPA in your user application for the communication with VIPA-CPs. At a change to VIPA-CPs in an already existing project, the present AG_SEND/ AG_LSEND res. AG_RECV/AG_LRECV may be replaced by AG_SEND res. AG_RECV from VIPA without adjustment. Due to the fact that the CP automatically adjusts itself to the length of the data to transfer, the L variant of SEND res. RECV is not required for VIPA CPs. Communication blocks For the communication between CPU and CP, the following FCs are available: AG_SEND (FC 5) This block transfers the user data from the data area given in SEND to the CP specified via ID and LADDR. As data area you may set a PA, bit memory or data block area. When the data area has been transferred without errors, "order ready without error” is returned. AG_RECV (FC 6) The block transfers the user data from the CP into a data area defined via RECV. As data area you may set a PA, bit memory or data block area. When the data area has been transferred without errors, "order ready without error” is returned. Status displays The CP processes send and receive commands independently from the CPU cycle and needs for this transfer time. The interface with the FC blocks to the user application is here synchronized by means of acknowledgements/receipts. For status evaluation the communication blocks return parameters that may be evaluated directly in the user application. These status displays are updated at every block call. Deployment at high communication load Do not use cyclic calls of the communication blocks in OB1. This causes a permanent communication between CPU and CP. Program instead the communication blocks within a time OB where the cycle time is higher res. event controlled. *) only with CPU 21x-2BT1x available 5-12 HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Chapter 5 VIPA specific blocks FC call is faster than CP transfer time If a block is called a second time in the user application before the data of the last time is already completely send res. received, the FC block interface reacts like this: AG_SEND No command is accepted until the data transfer has been acknowledged from the partner via the connection. Until this you receive the message "Order running" before the CP is able to receive a new command for this connection. AG_RECV The order is acknowledged with the message "No data available yet" as long as the CP has not received the receive data completely. AG_SEND, AG_RECV in the user application The following illustration shows a possible sequence for the FC blocks together with the organizations and program blocks in the CPU cycle: CPU cycle PII read OB User program AG_RECV AG_RECV Communication connection AG_SEND AG_SEND Communication connection AG_RECV Communication connection AG_SEND PIO write The FC blocks with concerning communication connection are summed up by color. Here you may also see that your user application may consist of any number of blocks. This allows you to send or receive data (with AG_SEND res. AG_RECV) event or program driven at any wanted point within the CPU cycle. You may also call the blocks for one communication connection several times within one cycle. HB00E - OPL_STD - Rev. 14/22 5-13 Chapter 5 VIPA specific blocks AG_SEND (FC 5) By means of AG_SEND the data to send are transferred to the CP 243. Parameters Name Declaration ACT IN Type BOOL ID LADDR IN IN INT WORD SEND LEN DONE IN IN OUT ANY INT BOOL ERROR OUT BOOL STATUS OUT WORD AG_RECV (FC 6) Description Activation of the sender 0: Updates DONE, ERROR and STATUS 1: The data area defined in SEND with the length LEN is send Connection number 1 ... 16 (identical with ID of NetPro) Logical basic address of the CP (identical with LADDR of NetPro) Data area Number of bytes from data area to transfer Status parameter for the order 0: Order running 1: Order ready without error Error message 0: Order running (at DONE = 0) 0: Order ready without error (at DONE = 1) 1: Order ready with error Status message returned with DONE and ERROR. More details are to be found in the following table. By means of AG_RECV the data received from the Ethernet CP 243 are transferred to the CPU. Parameters Name Declaration ID Input LADDR Input Type INT WORD RECV NDR Input Output ANY BOOL ERROR Output BOOL STATUS Output WORD LEN Output INT 5-14 Manual VIPA Operation List Standard Description Connection number 1 ... 16 (identical with ID of NetPro) Logical basic address of the CP (identical with LADDR of NetPro) Data area for the received data Status parameter for the order 0: Order running 1: Order ready data received without error Error message 0: Order running (at NDR = 0) 0: Order ready without error (at NDR = 1) 1: Order ready with error Status message returned with NDR and ERROR. More details are to be found in the following table. Number of bytes that have been received HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard DONE, ERROR, STATUS DONE (SEND) 1 0 0 0 0 0 Chapter 5 VIPA specific blocks The following table shows all messages that may be returned by the Ethernet CP 243 after a SEND res. RECV command. A "-" means that this message is not available for the concerning SEND res. RECV command. 0 0 NDR (RECV) 1 0 0 0 0 0 0 - ERROR STATUS Description 0 - 1 8304h - 0 1 8304h 0 - 1 8311h 0 0 - 1 1 8312h 8F22h - 0 1 8F23h 0 0 - 0 0 0 1 1 1 1 1 8F24h 8F25h 8F28h 8F29h 8F30h - 0 1 8F31h 0 0 0 0 0 0 1 1 1 8F32h 8F33h 8F3Ah 0 0 0 0 0 1 1 1 1 1 1 1 0000h 0000h 0000h 8180h 8181h 8183h 8184h 8184h 8185h 8185h 8186h 8302h HB00E - OPL_STD - Rev. 14/22 Order ready without error New data received without error No order present No data available yet Order running No CP project engineering for this order System error System error (destination data area failure) Parameter LEN exceeds source area SEND Destination buffer (RECV) too small Parameter ID invalid (not within 1 ...16) No receive resources at destination station, receive station is not able to process received data fast enough res. has no receive resources reserved. The connection is not established. The send command shouldn’t be send again before a delay time of >100 ms. The connection is not established. The receive command shouldn’t be send again after a delay time of >100 ms. Destination station not available with the defined Ethernet address. Ethernet error in the CP Source area invalid, e.g. when area in DB not present, Parameter LEN < 0 Source area invalid, e.g. when area in DB not present, Parameter LEN < 0 Range error at reading a parameter. Range error at writing a parameter. Orientation error at reading a parameter. Orientation error at writing a parameter. Parameter is within write protected 1st recent data block Parameter is within write protected 2nd recent data block Parameter contains oversized DB number. DB number error Area not loaded (DB) continued ... 5-15 Chapter 5 VIPA specific blocks Manual VIPA Operation List Standard ... continue DONE, ERROR, STATUS DONE NDR ERROR STATUS Description (SEND) (RECV) 0 1 8F42h Acknowledgement delay at reading a parameter from peripheral area. 0 1 8F43h Acknowledgement delay at writing a parameter from peripheral area. 0 1 8F44h Address of the parameter to read locked in access track. 0 1 8F45h Address of the parameter to write locked in access track. 0 0 1 8F7Fh Internal error e.g. invalid ANY reference e.g. parameter LEN = 0. 0 0 1 8090h Module with this module start address not present or CPU in STOP. 0 0 1 8091h Module start address not within double word grid. 0 0 1 8092h ANY reference contains type setting unequal BYTE. 0 1 80A0h Negative acknowledgement at reading the module. 0 0 1 80A4h reserved 0 0 1 80B0h Module doesn’t recognize record set. 0 0 1 80B1h The length setting (in parameter LEN) is invalid. 0 0 1 80B2h reserved 0 0 1 80C0h Record set not readable. 0 0 1 80C1h The set record set is still in process. 0 0 1 80C2h Order accumulation. 0 0 1 80C3h The operating sources (memory) of the CPU are temporarily occupied. 0 0 1 80C4h Communication error (occurs temporarily; a repetition in the user application is reasonable.) 0 0 1 80D2h Module start address is wrong. Status parameter at reboot 5-16 At a reboot of the CP, the output parameter are set back as follows: • DONE = 0 • NDR = 0 • ERROR = 0 • STATUS = 8180h (at AG_RECV) • STATUS = 8181h (at AG_SEND) HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Chapter 5 VIPA specific blocks 11x 21x 9 31x 51x FC 8 - STEUERBIT - Modem functionality CP 240 Description Parameters Name ADR RTS DTR MASKE_RTS This block allows you the following access to the serial modem lines: Read: DTR, RTS, DSR, RI, CTS, CD Write: DTR, RTS Declaration IN IN IN IN Type INT BOOL BOOL BOOL MASKE_DTR IN BOOL STATUS DELTA_STATUS START AUFTRAG_LAEU RET_VAL OUT OUT IN_OUT IN_OUT OUT BYTE BYTE BOOL BOOL WORD Comment Logical Address New state RTS New state DTR 0: do nothing 1: set state RTS 0: do nothing 1: set state DTR Status flags Status flags of change between 2 accesses Start bit of the function Status of function Return value (0 = OK) Note! This block must not be called as long as a transmit command is running otherwise you risk a data loss. ADR Periphery address with which you may call the CP 240. Via the hardware configuration you may set the periphery address. RTS, DTR This parameter presets the status of RTS res. DTR, which you may activate via MASK_RTS res. MASK_DTR. MASK_RTS, MASK_DTR With 1, the status of the according parameter is taken over when you set START to 1. STATUS, DELTA_STATUS STATUS returns the actual status of the modem lines. DELTA_STATUS returns the state of the modem lines that have changed since the last access. The bytes have the following structure: 7 6 5 4 3 2 1 0 x x RTS DTR CD RI DSR CTS x x x x CD RI DSR CTS Bit no. STATUS DELTA_STATUS START By setting of START, the state, which has been activated via the mask, is taken over. AUFTRAG_LAEU As long as the function is executed, this bit remains set. RET_VAL At this time, this parameter always returns 00h and is reserved for future error messages. HB00E - OPL_STD - Rev. 14/22 5-17 Manual VIPA Operation List Standard Chapter 5 VIPA specific blocks 11x 21x 9 31x 51x FC 9 - SYNCHRON_RESET - Synchronization CPU and CP 240 Description The block must be called within the cyclic program section. This function is used to acknowledge the start-up ID of the CP 240 and thus the synchronization between CPU and CP. Furthermore it allows to set back the CP in case of a communication interruption to enable a synchronous start-up. Note! A communication with SEND and RECEIVE blocks is only possible when the parameter ANL of the SYNCHRON block has been set in the start-up OB before. Parameters Name ADR TIMER_NR ANL NULL RESET STEUERB_S STEUERB_R Declaration IN IN IN_OUT IN_OUT IN_OUT IN_OUT IN_OUT Type INT WORD BOOL BOOL BOOL BYTE BYTE Comment Logical address Timer number CPU restart progressed Internal use Reset the CP Internal use Internal use ADR Periphery address with which you may call the CP 240. Via the hardware configuration you may set the periphery address. TIMER_NR Number of the timer for the delay time. ANL With ANL = 1 the handling block is informed that a STOP/START res. NETZ-AUS/NETZ-EIN has been executed at the CPU and now a synchronization is required. After the synchronization, ANL is automatically set back. NULL Parameter is used internally. RESET RESET = 1 allows you to set back the CP out of your user application. STEUERB_S Here you have to set the bit memory byte where the control bits ENDE_KOM, LETZTER_BLOCK, SENDEN_LAEUFT and FEHLER_KOM for the SEND-FC are stored. STEUERB_R Here you have to set the bit memory byte where the control bits LETZTER_BLOCK, EMPF_LAEUFT and FEHLER_EMPF for the RECEIVE-FC are stored. 5-18 HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Chapter 5 VIPA specific blocks 11x 21x 9 31x 51x FC 11 - ASCII_FRAGMENT - Receive fragmented from CP 240 Description Parameters Name ADR _DB ABD ANZ EMFR GEEM ANZ_INT EMPF_LAEUFT LETZTER_BLOCK FEHLER_EMPF PAFE This FC serves the fragmented ASCII data reception. This allows you to handle on large telegrams in 12byte blocks to the CPU directly after the reception. Here the CP does not wait until the complete telegram has been received. The usage of the FC 11 presumes that you’ve parameterized "ASCII-fragmented" at the receiver. In the FC 11, you define the reception range via the identifiers _DB and ABD. When the output EMFR is set, a new telegram has been read completely. The length of the read telegram is stored in ANZ. After the evaluation of the telegram this bit has to be set back by the user, otherwise no further telegram may be taken over by the CPU. Declaration IN IN IN OUT IN_OUT IN_OUT IN_OUT IN_OUT IN_OUT IN_OUT OUT Type INT BLOCK_DB WORD WORD BOOL WORD WORD BOOL BOOL BOOL BYTE Comment Logical Address DB No. of DB containing received data No. of 1st data word received No of bytes received Receipt confirmation Internal use Internal use Internal use Internal use Internal use Parameterization error (0 = OK) ADR Periphery address with which you may call the CP 240. Via the hardware configuration you may set the periphery address. _DB Number of the data block, which contains the data to receive. ABD Word variable that contains the number of the data word from where on the received characters are stored. ANZ Word variable that contains the amount of bytes that have been received. EMFR By setting of EMFR, the handling block announces that data has been received. Only by setting back EMFR in the user application new data can be received. PAFE At proper function, all bits of this bit memory byte are "0". At errors an error code is entered. The error setting is self-acknowledging, i.e. after elimination of the error cause, the byte is set back to "0" again. The following errors may occur: 1 = Data block not present 2 = Data block too short 3 = Data block number outside valid range GEEM, ANZ_INT LETZTER_BLOCK EMPF_LAEUFT FEHLER_EMPF These parameters are internally used. They serve the information exchange between the handling blocks. For the deployment of the SYNCHRON_RESET (FC 9) the control bits LETZTER_BLOCK, EMPF_LAEUFT and FEHLER_EMPF must always be stored in a bit memory byte. HB00E - OPL_STD - Rev. 14/22 5-19 Manual VIPA Operation List Standard Chapter 5 VIPA specific blocks 11x 9 21x 9 31x 51x Serial communication - SFC 207 and SFC 216...218 General Some CPUs provide serial interfacing facilities between the processes of different source and destination systems. For the serial communication the CPUs have got a serial interface which may be controlled by these blocks. Protocols The protocols ASCII, STX/ETX, 3964R, USS and Modbus are supported. Parameterization The parameterization happens during runtime by means of the SFC 216 (SER_CFG). With exception of ASCII the parameters of every protocol is to be stored in a DB. Communication The communication is controlled by means of SFCs. Sending is executed with the SFC 217 (SER_SND) and the reception via SFC 218 (SER_RCV). Another call of the SFC 217 SER_SND, 3964R, USS and Modbus provides you via RetVal with a return value which contains among others recent information about the acknowledgement of the partner. The protocols USS and Modbus allows you to read the acknowledgement telegram by calling the SFC 218 SER_RCV after a SER_SND. Overview over the SFCs for the serial communication The following SFCs are deployed for the serial communication: SFC 207 SFC 216 SFC 217 SFC 218 5-20 SFC SER_CTRL SER_CFG SER_SND SER_RCV Description Modem functionality RS232/RS485 Parameterization RS232/RS485 Send RS232/RS485 Receive HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Chapter 5 VIPA specific blocks 11x 9 21x 9 31x 51x SFC 207 - SER_CTRL Using the RS232 interface by means of ASCII protocol the serial modem lines can be accessed with this SFC during operation. Depending on the parameter FLOWCONTROL, which is set by SFC 216 (SER_CFG), this SFC has the following functionality: FLOWCONTROL=0: Read: DTR, RTS, DSR, RI, CTS, CD Write: DTR, RTS FLOWCONTROL>0: Read: DTR, RTS, DSR, RI, CTS, CD Write: not possible Modem functionality Parameters Name WRITE Declaration Type IN BYTE MASKWRITE IN BYTE READ READDELTA RETVAL OUT OUT OUT BYTE BYTE WORD Description Bit 0: New state DTR Bit 1: New state RTS Bit 0: Set state DTR Bit 1: Set state RTS Status flags (CTS, DSR, RI, CD, DTR, RTS) Status flags of change between 2 accesses Return value (0 = OK) WRITE With this parameter the status of DTR and RTS is set and activated by MASKWRITE. The byte has the following allocation: Bit 0 = DTR Bit 1 = RTS Bit 7 ... Bit 2: reserved MASKWRITE Here with "1" the status of the appropriate parameter is activated. The byte has the following allocation: Bit 0 = DTR Bit 1 = RTS Bit 7 ... Bit 2: reserved READ You get the current status by READ. The current status changed since the last access is returned by READDELTA. The bytes have the following structure: 7 6 5 4 3 2 1 0 x x RTS DTR CD RI DSR CTS x x x x CD RI DSR CTS Bit No. Read ReadDelta RETVAL (Return value) Value 0000h 8x24h 809Ah 809Bh HB00E - OPL_STD - Rev. 14/22 Description no error Error SFC parameter x, with x: 1: Error at WRITE 2: Error at MASKWRITE 3: Error at READ 4: Error at READDELTA Interface missing Interface not configured (SFC 216) 5-21 Chapter 5 VIPA specific blocks Manual VIPA Operation List Standard 11x 9 21x 9 31x 51x SFC 216 - SER_CFG Description The parameterization happens during runtime deploying the SFC 216 SER_CFG. You have to store the parameters for STX/ETX, 3964R, USS and Modbus in a DB. Please regard that not all protocols support the complete value range of the parameters. More detailed information is to be found in the description of the according parameter. Note! Please regard that the SFC 216 is not called again during a communication because as a result of this all buffers are cleared. If you don’t want to alter the communication parameter any more, you should place the call of the SFC 216 in the start-up OB 100. Parameters Name PROTOCOL PARAMETER BAUDRATE CHARLEN PARITY STOPBITS FLOWCONTROL RETVAL PROTOCOL 5-22 Declaration IN IN IN IN IN IN IN OUT Type BYTE ANY BYTE BYTE BYTE BYTE BYTE WORD Description Number of the protocol Pointer to protocol-parameters No of baudrate Number of Data bits Parity Number of stop bits Flow control (1 fixed) Return value ( 0 = OK ) Here you fix the protocol to be used. You may choose between: 1: ASCII 2: STX/ETX 3: 3964R 4: USS Master 5: Modbus RTU Master 6: Modbus ASCII Master 7: Modbus RTU Slave 8: Modbus ASCII Slave HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard PARAMETER (as DB) Chapter 5 VIPA specific blocks At ASCII protocol, this parameter is ignored. At STX/ETX, 3964R, USS and Modbus you fix here a DB that contains the communication parameters and has the following structure for the according protocols: Data block at STX/ETX DBB0: STX1 DBB1: STX2 DBB2: ETX1 DBB3: ETX2 DBW4: TIMEOUT BYTE BYTE BYTE BYTE WORD (1. Start-ID in hexadecimal) (2. Start-ID in hexadecimal) (1. End-ID in hexadecimal) (2. End-ID in hexadecimal) (max. delay time between 2 telegrams in a time window of 10ms) Note! The start res. end sign should always be a value <20, otherwise the sign is ignored! With not used IDs please always enter FFh! Data block at 3964R DBB0: Prio BYTE Data block at USS DBW0: Timeout WORD (Delay time in 10ms time grid) (The priority of both partners must be different. Prio 0 and 1 are possible) DBB1: ConnAttmptNr BYTE (Number of connection trials) DBB2: SendAttmptNr BYTE (Number of telegram retries) DBW4: CharTimeout WORD (Char. delay time in 10ms time window) DBW6: ConfTimeout WORD (Ackn. delay time in 10ms time window) Data block at Modbus-Master DBW0: Timeout WORD (Respond delay time in 10ms time grid) Data block at Modbus-Slave DBB0: Address BYTE (Address 1...247 in the Modbus network) DBW2: Timeout WORD (Respond delay time in 10ms time grid) HB00E - OPL_STD - Rev. 14/22 5-23 Chapter 5 VIPA specific blocks Manual VIPA Operation List Standard BAUDRATE Velocity of data transfer in Bit/s (Baud). 01h: 150 Baud 05h: 1800 Baud 09h: 9600 Baud 0Dh: 57600 Baud 02h: 300 Baud 06h: 2400 Baud 0Ah: 14400 Baud 0Eh: 115200 Baud 03h: 600 Baud 07h: 4800 Baud 0Bh: 19200 Baud 04h: 1200 Baud 08h: 7200 Baud 0Ch: 38400 Baud CHARLEN Number of data bits where a character is mapped to. 0: 5Bit 1: 6Bit 2: 7Bit 3: 8Bit Supported values: Bit ASCII STX/ETX 3964R 5 x x 6 x x x 7 x x x 8 x x x USS Modbus RTU Modbus ASCII x x x x PARITY The parity is -depending on the value- even or odd. For parity control, the information bits are extended with the parity bit, that amends via its value ("0" or "1") the value of all bits to a defined status. If no parity is set, the parity bit is set to "1", but not evaluated. 0: NONE 1: ODD 2: EVEN STOPBITS The stop bits are set at the end of each transferred character and mark the end of a character. 1: 1Bit 2: 1.5Bit 3: 2Bit 1.5Bit can only be used with CHARLEN 5 at this number of data 2Bit is not allowed. FLOWCONTROL With this bit you affect the behavior from signal Request to send. 0: RTS off 1: RTS is "0" at Receive (AutoRTS) RTS is "1" at Send (AutoRTS) 2: HW flow (only at ASCII protocols) Note! Note: For RS485 FLOWCONTROL is not evaluated. It is set automatically to "1" (AutoRTS)! 5-24 HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard RETVAL (Return value) Value 0000h 809Ah 8x24h 809xh 8092h 828xh HB00E - OPL_STD - Rev. 14/22 Chapter 5 VIPA specific blocks Description no error interface not found Error at SFC-Parameter x, with x: 1: Error at PROTOCOL 2: Error at PARAMETER 3: Error at BAUDRATE 4: Error at CHARLENGTH 5: Error at PARITY 6: Error at STOPBITS 7: Error at FLOWCONTROL Error in SFC parameter value x, where x: 1: Error at PROTOCOL 3: Error at BAUDRATE 4: Error at CHARLENGTH 5: Error at PARITY 6: Error at STOPBITS 7: Error at FLOWCONTROL Access error in parameter DB (DB too short) Error in parameter x of DB parameter, where x: 1: Error 1. parameter 2: Error 2. parameter ... 5-25 Chapter 5 VIPA specific blocks Manual VIPA Operation List Standard 11x 9 21x 9 31x 51x SFC 217 - SER_SND Description Parameters Name DATAPTR DATALEN RETVAL This block allows to send data via the serial interface. Declaration IN OUT OUT Type ANY WORD WORD Description Pointer to Data Buffer for sending data Length of data to send Return value (0 = OK) DATAPTR Here you define a range of the type Pointer for the send buffer where the data that has to be sent is stored. You have to set type, start and length. Example: Data is stored in DB5 starting at 0.0 with a length of 124byte. DATAPTR:=P#DB5.DBX0.0 BYTE 124 DATALEN Word where the number of sent bytes is stored. At STX/ETX and 3964R, the length set in DATAPTR or 0 is entered. At ASCII, the value may be different from the sent length when the data is sent that fast that not all data can be stored in the send buffer of 256byte. RETVAL (Return value) Value 0000h 1000h 20xxh 7001h 7002h 80xxh 90xxh 8x24h 8122h 807Fh 809Ah 809Bh 5-26 Description Send data - ready Nothing sent (data length 0) Protocol executed error free with xx bit pattern for diagnosis. Data is stored in internal buffer - active (busy). Transfer - active Protocol executed with errors with xx bit pattern for diagnosis (no acknowledgement by partner). Protocol not executed with xx bit pattern for diagnosis (no acknowledgement by partner). Error in SFC parameter x, where x: 1: Error in DATAPTR 2: Error in DATALEN. Error in parameter DATA of SFC 216 (e.g. no DB). Internal error RS232 interface not found. RS232 interface not configured. HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Protocol specific RETVAL values Chapter 5 VIPA specific blocks ASCII Value 9000h 9002h Description Buffer overflow (no data sent) Data too short (0byte) STX/ETX Value 9000h 9001h 9002h 9004h Description Buffer overflow (no data sent) Data too long (>256byte) Data too short (0byte) Character not allowed 3964R Value 2000h 80FFh 80FEh 9000h 9001h 9002h USS Value 2000h 8080h 8090h 80F0h 80FEh 80FFh 9000h 9001h 9002h Description Send ready without error NAK received - error in communication Data transfer without acknowledgement of partner or error at acknowledgement Buffer overflow (no data send) Data too long (>256byte) Data too short (0byte) Description Send ready without error Receive buffer overflow (no space for receipt) Acknowledgement delay time exceeded Wrong checksum in respond Wrong start sign in respond Wrong slave address in respond Buffer overflow (no data send) Data too long (>256byte) Data too short (<2byte) Modbus RTU/ASCII Master Value Description 2000h Send ready without error 2001h Send ready with error 8080h Receive buffer overflow (no space for receipt) 8090h Acknowledgement delay time exceeded 80F0h Wrong checksum in respond 80FDh Length of respond too long 80FEh Wrong function code in respond 80FFh Wrong slave address in respond 9000h Buffer overflow (no data send) 9001h Data too long (>256byte) 9002h Data too short (<2byte) Modbus RTU/ASCII Slave Value Description 0000h Send data - ready 9001h Data too long (>256byte) HB00E - OPL_STD - Rev. 14/22 5-27 Manual VIPA Operation List Standard Chapter 5 VIPA specific blocks The following text shortly illustrates the structure of programming a send command for the different protocols. Principles of programming 3964R USS / Modbus master SFC 217 SER_SND SFC 217 SER_SND Busy ? RetVal 700xh ? Y N Y N RetVal 8xxxh / 90xxh ? RetVal 8xxxh / 90xxh ? Y Y Error evaluation End N N Error evaluation RetVal 2001h ? RetVal 2001h ? Y Y SFC 218 SER_RCV Error evaluation End SFC 218 SER_RCV Data evaluation End End N N RetVal 2000h ? Y RetVal 2000h ? Y N N Ende Data evaluation End ASCII / STX/ETX Modbus slave SFC 217 SER_SND Start SFC 217 SER_SND RetVal 900xh N Y Error evaluation RetVal 700xh ? J N End RetVal 9001h ? Error evaluation Y N RetVal 0000h ? Y SFC 218 SER_RCV N RetVal 0000h ? Y Data evaluation N RetVal 8xxxh ? Y Error evaluation N 5-28 HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Chapter 5 VIPA specific blocks 11x 9 21x 9 31x 51x SFC 218 - SER_RCV Description Parameters Name DATAPTR DATALEN ERROR RETVAL This block receives data via the serial interface. Declaration IN OUT OUT OUT Type ANY WORD WORD WORD Description Pointer to Data Buffer for received data Length of received data Error Number Return value ( 0 = OK ) DATAPTR Here you set a range of the type Pointer for the receive buffer where the reception data is stored. You have to set type, start and length. Example: Data is stored in DB5 starting at 0.0 with a length of 124byte. DATAPTR:=P#DB5.DBX0.0 BYTE 124 DATALEN Word where the number of received bytes is stored. At STX/ETX and 3964R, the length of the received user data or 0 is entered. At ASCII, the number of read characters is entered. This value may be different from the read telegram length. ERROR At ASCII, this word gets an entry in case of an error. The following error messages are possible: Bit Error Description 1 overrun Overrun when a character could not be read from the interface fast enough. 2 parity Parity error 3 framing Error that shows that a defined bit frame is not met, exceeds error the allowed length or contains an additional bit sequence (stop bit error). RETVAL (Return value) Value 0000h 1000h 8x24h 8122h 809Ah 809Bh HB00E - OPL_STD - Rev. 14/22 Description no error Receive buffer too small (data loss) Error at SFC-Parameter x, with x: 1: Error at DATAPTR 2: Error at DATALEN 3: Error at ERROR. Error in parameter DATA of SFC 216 (e.g. no DB). serial interface not found. serial interface not configured. 5-29 Manual VIPA Operation List Standard Chapter 5 VIPA specific blocks 11x 9 21x 9 31x 9 51x 9 SFC 219 - CAN_TLGR - Send CAN telegram SFC 219 CAN_TLGR SDO-demand on CAN-master Parameters Name REQUEST SLOT_MASTER NODEID TRANSFERTYP INDEX SUBINDEX CANOPENERROR RETVAL BUSY DATABUFFER This block is used by the PLC to cause the CANopen master to execute a SDO read or write access). Here you address the master via plug-in place number and the destination slave via his CAN address. The process data will be designated of INDEX and SUBINDEX. It is possible to transfer maximum one data word process data per access via SDO. Declaration IN IN IN IN IN IN OUT OUT OUT IN_OUT Type BOOL BYTE BYTE BYTE DWORD DWORD DWORD WORD BOOL ANY Description Start bit of the job Slot of the master CAN address Transfer type CANopen index CANopen subindex CANopen error Return value Busy flag Data area for communication REQUEST Control parameter: 1: Start order SLOT_MASTER System 100V: Slot number 0: 21x-2CM02 Slot number 1 … 4: 208-1CA00 System 200V: Slot number 0: 21x-2CM02 Slot number 1 … 32: 208-1CA00 NODEID Address of the CANopen Node (1...127) TRANSFERTYPE 40h: read SDO INDEX CANopen Index SUBINDEX CANopen Subindex 5-30 23h: write SDO (1 DWORD) 2Bh: write SDO (1 WORD) 2Fh: write SDO ( 1 BYTE) HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard CANOPENERROR Code 0x00000000 0x05030000 0x05040000 0x05040001 0x05040002 0x05040003 0x05040004 0x05040005 0x06010000 0x06010001 0x06010002 0x06020000 0x06040041 0x06040042 0x06040043 0x06040047 0x06060000 0x06070010 0x06070012 0x06070013 0x06090011 0x06090030 0x06090031 0x06090032 0x06090036 0x08000000 0x08000020 0x08000021 0x08000022 0x08000023 Chapter 5 VIPA specific blocks If no error occurs CANOPENERROR returns value 0. In case of error the CANOPENERROR contains one of the following error messages which are generated in the CAN master: Description Successfully service Toggle bit not alternated SDO protocol timed out Client/server command specification not valid or unknown Invalid block size (block mode only) Invalid sequence number (block mode only) CRC error (block mode only) Out of memory Unsupported access to an object Attempt to read a write only object Attempt to write a read only object Object does not exist in the object dictionary Object cannot be mapped to the PDO The number and length of the objects to be mapped would exceed PDO length General parameter incompatibility reason General internal incompatibility in the device Access failed due to an hardware error Data type does not match, length of service parameter does not match Data type does not match, length of service parameter too high Data type does not match, length of service parameter too low Sub-index does not exist Value range of parameter exceeded (only for write access) Value of parameter written too high Value of parameter written too low Maximum value is less than minimum value general error Data cannot be transferred or stored to the application Data cannot be transferred or stored to the application because of local control Data cannot be transferred or stored to the application because of the present device state Object dictionary dynamic generation fails or no object dictionary is present (e.g. object dictionary is generated from file and generation fails because of an file error) HB00E - OPL_STD - Rev. 14/22 5-31 Chapter 5 VIPA specific blocks RETVAL (return value) Value 0xF021 0xF022 0xF023 0xF024 0xF025 0xF026 0xF027 0xF028 Manual VIPA Operation List Standard When the function has been executed successfully, the return value contains the valid length of the respond data: 1: BYTE, 2: WORD, 4: DWORD. If an error occurs during function processing, the return value contains an error code. Description Invalid slave address (Call parameter equal 0 or above 127). Invalid Transfer type (Value unequal 60h, 61h). Invalid data length (data buffer to small, at SDO read access it should be at least 4byte, at SDO write access 1byte, 2byte or 4byte). The SFC is not supported. Write buffer in the CANopen master full, service cannot be processed at this time. Read buffer in the CANopen master full, service cannot be processed at this time. The SDO read or write access returned wrong answer, see CANopen Error Codes. SDO-Timeout (no CANopen participant with this Node-Id has been found). BUSY BUSY = 1: The read/write job is not yet completed. DATABUFFER Data area for SFC communication Read SDO: Destination area for the SDO data that were read. Write SDO: Source area for the SDO data that were written. Note Unless a SDO demand was processed error free, RETVAL contains the length of the valid response data in (1, 2 or 4byte) and the CANOPENERROR the value 0. 5-32 HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Chapter 5 VIPA specific blocks 11x 9 21x 9 31x 9 51x 9 MMC Access - SFC 220...222 Overview By means of these blocks there is the possibility to integrate MMC access to your application program. Here a new file may be created respectively an existing file may be opened for accessed when a MMC is plugged-in. As long as you do not open another file, you may access this file via read/write commands. Restrictions For deploying the SFCs 220, 221 and 222, you have to regard the following restrictions: • A read res. write access to the MMC is only possible after creation res. opening of the file via SFC 220. • The data on MMC must not be fragmentized, for only complete data blocks may be read res. written. • When transferring data to the MMC from an external reading device, they may be fragmentized, i.e. the data is divided into blocks. This may be avoided by formatting the MMC before the write access. • At a write access from the CPU to the MMC, the data is always stored not fragmentized. • When opening an already existing file, you have to use the same FILENAME and FILESIZE that you used at creation of this file. • A MMC is structured into sectors. Every sector has a size of 512byte. Sector overlapping writing or reading is not possible. Access to sector overlapping data is only possible by using a write res. read command for every sector. By giving the offset, you define the according sector. The following picture shows the usage of the single SFCs and their variables: CPU Memory SFC 220 MMC_CR_F PTR E MMC Sektor A SFC 221 MMC_RD_F D SFC 222 MMC_WR_F RET_VAL BUSY FILENAME 512 } FILESIZE OFFSET Note! For read and write accesses to the MMC, you firstly have to open the file with SFC 220! HB00E - OPL_STD - Rev. 14/22 5-33 Manual VIPA Operation List Standard Chapter 5 VIPA specific blocks 11x 9 21x 9 31x 9 51x 9 SFC 220 - MMC_CR_F Overview By means of this SFC a new file may be created respectively an existing file may be opened for accessed when a MMC is plugged-in. As long as you do not open another file, you may access this file via read/write commands. Note! Since calling the SFC from the OB 1 can result in a cycle time-out, instead of this you should call the SFC from the OB 100. Parameters Name FILENAME FILESIZE RET_VAL FILENAME Declaration IN IN OUT Type STRING[254] DWORD WORD Description Name of file Size of file Return value (0 = OK) Type in the file name used to store the data on the MMC. The name inclusive end ID may not exceed a maximum length of 13 characters: • 8 characters for name • 1 character for "." • 3 characters for file extension • 1 character 00h as end ID Note! For software technical reasons you have to enter 00h into the byte next to the file name (end ID of the file name). FILESIZE Structure 5-34 The FILESIZE defines the size of the user data in byte. When accessing an already existing file, it is mandatory to give not only the FILENAME but also the FILESIZE. The entry of a "Joker" length is not supported at this time. Byte 0 Max. length Byte 1 occupied length Byte 2 ASCII value 1 Byte 3 ASCII value 2 ... ... Byte 255 ASCII value 254 HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard RET_VAL (Return Value) Chapter 5 VIPA specific blocks Word that returns a diagnostic/error message. 0 means OK. See the table below for the concerning messages: Value Description Diagnostic messages 0000h No errors (appears if new file is generated). 0001h File already exists, is not fragmentized and the length value is identical or smaller. 8001h No or unknown type of MMC is plugged-in. Error messages 8002h No FAT on MMC found. A001h File name missing. This message appears if file name is inside a not loaded DB. A002h File name wrong (not 8.3 or empty) A003h File exists but FILESIZE too bigger than existing file. A004h File exists but is fragmentized and cannot be opened. A005h Not enough space on MMC. A006h No free entry in root directory. Depending on the used MMC there may be min. 16 up to max. 512 entries in the root directory. B000h An internal error occurred. HB00E - OPL_STD - Rev. 14/22 5-35 Chapter 5 VIPA specific blocks Manual VIPA Operation List Standard 11x 9 21x 9 31x 9 51x 9 SFC 221 - MMC_RD_F Via the SFC 221 you may read data from a MMC. For read and write accesses to the MMC, you firstly have to open the file with SFC 220 and it has to be not fragmentized. For more detailed information to this and to the restrictions see the description of the SFC 220. Description Parameters Name PTR OFFSET BUSY RET_VAL Declaration IN IN OUT OUT Type ANY DWORD BOOL WORD Description Pointer to area for reading data Offset of data within the file Job state Return value (0 = OK) PTR This variable of the type pointer points to a data area in the CPU where the content of the MMC has to be written to. OFFSET Here you define the start address inside the file on the MMC from where on the data has to be transferred to the CPU. BUSY During data transfer this Bit remains set. The Bit is reset as soon as the data transfer is complete. RET_VAL (Return Value) Word that returns a diagnostic/error message. 0 means OK. The following messages may be set: Value 0000h 8001h 8002h 9000h 9001h 9002h 9003h B000h 5-36 Description No errors (data was read) No or unknown type of MMC is plugged-in No FAT found on MMC Bit reading has been tried (Boolean variable). Bit reading is not possible. Pointer value is wrong (e.g. points outside DB) File length exceeded Sector limit of 512 has been tried to overrun. Sector overrun reading is not possible. An internal error occurred. HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Chapter 5 VIPA specific blocks 11x 9 21x 9 31x 9 51x 9 SFC 222 - MMC_WR_F Via the SFC 222, you may write to the MMC. For read and write accesses to the MMC, you firstly have to open the file with SFC 220 and it has to be not fragmentized. For more detailed information to this and to the restrictions see the description of the SFC 220. Description Parameters Name PTR OFFSET BUSY RET_VAL Declaration IN IN OUT OUT Type ANY DWORD BOOL WORD Description Pointer to area for writing data Offset of data within the file Job state Return value (0 = OK) PTR This variable of the type pointer points to a data area from where on the data starts that will be written to the MMC. OFFSET This defines the beginning of the data inside the file on the MMC where the data is written to. BUSY During data transfer this Bit remains set. The Bit is reset as soon as the data transfer is complete. RET_VAL (Return Value) Word that returns a diagnostic/error message. 0 means OK. The following messages may be set: Value 0000h 8001h 8002h 9000h 9001h 9002h 9003h B000h HB00E - OPL_STD - Rev. 14/22 Description No errors No or unknown type of MMC is plugged-in. No FAT found on MMC. Bit writing has been tried (Boolean variable). Bit writing is not possible. Pointer value is wrong (e.g. points outside DB). File length exceeded Sector limit of 512 has been tried to overrun. Sector overrun reading is not possible. An internal error occurred. 5-37 Manual VIPA Operation List Standard Chapter 5 VIPA specific blocks 11x 9 21x 31x 51x SFC 223 - PWM - Pulse duration modulation This block serves the parameterization of the pulse duration modulation for the last two output channels of X5. Description Parameters Name CHANNEL ENABLE TIMEBASE PERIOD DUTY MINLEN RET_VAL Declaration IN IN IN IN IN IN OUT DO 8xDC24V 1A L+ 1 .0 2 .1 3 .2 4 .3 5 .4 6 .5 7 .6 8 .7 9 F I0 Ch. 0 PWM Ch. 1 Type INT BOOL INT DINT DINT DINT WORD Description Number of the output channel for PWM Start bit of the job Time base Period of the PWM Output value per mille Minimum pulse duration Return value (0 = OK) You define a time base, a period, the pulse duty ratio and min. pulse length. The CPU determines a pulse series with an according pulse/break relation and issues this via the according output channel. The SFC returns a certain error code. You can see the concerning error messages in the table at the following page. The PWM parameters have the following relationship: Output DO Period length Pulse length Time Pulse break Pulse duty ratio 500 700 1000 Period length = time base x period Pulse length = (period length / 1000) x pulse duty ratio Pulse break = period length - pulse length The parameters have the following meaning: Channel 5-38 Define the output channel that you want to address. Value range: 0 ... 1 HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Chapter 5 VIPA specific blocks ENABLE Via this parameter you may activate the PWM function (true) res. deactivate it (false). Value range: true, false TIMEBASE TIMEBASE defines the resolution and the value range of the pulse, period and minimum pulse length per channel. You may choose the values 0 for 0.1ms and 1 for 1ms. Value range: 0 ... 1 PERIOD Through multiplication of the value defined at period with the TIMEBASE you get the period length. Value range: 0 ... 60000 DUTY This parameter shows the pulse duty ratio per mille. Here you define the relationship between pulse length and pulse break, concerned on one period. 1 per mille = 1 TIMEBASE If the calculated pulse duration is no multiplication of the TIMEBASE, it is rounded down to the next smaller TIMEBASE limit. Value range: 0 ... 1000 MINLEN Via MINLEN you define the minimal pulse length. Switches are only made, if the pulse exceeds the here fixed minimum length. Value range: 0 ... 60000 RET_VAL (Return Value) Via the parameter RET_VAL you get an error number in return. See the table below for the concerning error messages: Value 0000h 8005h 8006h 8007h 8008h 8009h 9001h Description no error Parameter MINLEN outside the permissible range Parameter DUTY outside the permissible range Parameter PERIOD outside the permissible range Parameter TIMEBASE outside the permissible range Parameter CHANNEL outside the permissible range Internal error: There was no valid address for a parameter. 9002h Internal hardware error: Please call the VIPA-Service. 9003h Output is not configured as PWM output respectively there is an error in hardware configuration. 9004h HF-PWM was configured but SFC 223 was called (please use SFC 225 HF_PWM!). HB00E - OPL_STD - Rev. 14/22 5-39 Manual VIPA Operation List Standard Chapter 5 VIPA specific blocks 11x 9 21x 31x 51x SFC 224 - HSC - High-speed counter Description Parameters Name CHANNEL ENABLE DIRECTION PRESETVALUE LIMIT RET_VAL SETCOUNTER This SFC serves for parameterization of the counter functions (high speed counter) for the first 4 inputs. Declaration IN IN IN IN IN OUT IN_OUT Type INT BOOL INT DINT DINT WORD BOOL Description Number of the input channel for HSC Start bit of the job Direction of counting Preset value Limit for counting Return value (0 = OK) Load preset value CHANNEL Type the input channel that you want to activate as counter. Value range: 0 ... 3 ENABLE Via this parameter you may activate the counter (true) res. deactivate it (false). Value range: true, false DIRECTION Fix the counting direction. Hereby is: 0: Counter is deactivated, means ENABLE = false 1: count up 2: count down PRESETVALUE Here you may preset a counter content, that is transferred to the according counter via SETCOUNTER = true. Value range: 0 ... FFFFFFFFh LIMIT Via Limit you fix an upper res. lower limit for the counting direction (up res. down). When the limit has been reached, the according counter is set zero and started new. If necessary an alarm occurs. Value range: 0 ... FFFFFFFFh 5-40 HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard RET_VAL (Return Value) Chapter 5 VIPA specific blocks Via the parameter RET_VAL you get an error number in return. See the table below for the concerning error messages: Value Description 0000h No error 8002h The chosen channel is not configured as counter . (Error in the hardware configuration) 8008h Parameter DIRECTION outside the permissible range 8009h Parameter CHANNEL outside the permissible range 9001h Internal error There was no valid address for a parameter. 9002h Internal hardware error Please call the VIPA-Service. SETCOUNTER Per SETCOUNTER = true the value given by PRESETVALUE is transferred into the according counter. The bit is set back from the SFC. Value range: true, false HB00E - OPL_STD - Rev. 14/22 5-41 Manual VIPA Operation List Standard Chapter 5 VIPA specific blocks 11x 9 21x 31x 51x SFC 225 - HF_PWM - HF pulse duration modulation This block serves the parameterization of the pulse duration modulation for the last two output channels. This block is function identical to SFC 223. Instead of TIMEBASE and PERIOD, the SFC 225 works with a predefined frequency (up to 50kHz). Description Parameters Name CHANNEL ENABLE FREQUENCE DUTY MINLEN RET_VAL Declaration IN IN IN IN IN OUT DO 8xDC24V 1A L+ 1 .0 2 .1 3 .2 4 .3 5 .4 6 .5 7 .6 8 .7 9 F I0 Ch. 0 PWM Type INT BOOL WORD DINT DINT WORD Description Number of the output channel for HF-PWM Start bit of the job Frequency of the HF-PWM Pulse duty ratio per mille Minimum pulse duration Return value (0 = OK) You define a frequency, the pulse duty ratio and min. pulse length. The CPU determines a pulse series with an according pulse/break relation and issues this via the according output channel. The SFC returns a certain error code. You can see the concerning error messages in the table at the following page. The PWM parameters have the following relationship: Ch. 1 Output DO Period length Pulse length Time Pulse break Pulse duty ratio 500 700 1000 Period length = 1 / frequency Pulse length = (period length / 1000) x pulse duty ratio Pulse break = period length - pulse length 5-42 HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Chapter 5 VIPA specific blocks CHANNEL Define the output channel that you want to address. Value range: 0 ... 1 ENABLE Via this parameter you may activate the PWM function (true) res. deactivate it (false). Value range: true, false FREQUENCE Type in the frequency in Hz as hexadecimal value. Value range: 09C4h ... C350h (2.5kHz ... 50kHz) DUTY This parameter shows the pulse duty ratio per mille. Here you define the relationship between pulse length and pulse break, concerned on one period. 1 per mille = 1 Time base If the calculated pulse duration is no multiplication of the time base, it is rounded down to the next smaller time base limit. Value range: 0 ... 1000 MINLEN Via MINLEN you define the minimal pulse length in µs. Switches are only made, if the pulse exceeds the here fixed minimum length. Value range: 0 ... 60000 RET_VAL (Return Value) Via the parameter RET_VAL you get an error number in return. See the table below for the concerning error messages: Value 0000h 8005h 8006h 8007h 8008h 8009h 9001h Description no error Parameter MINLEN outside the permissible range Parameter DUTY outside the permissible range Parameter FREQUENCE outside the permissible range Parameter TIMEBASE outside the permissible range Parameter CHANNEL outside the permissible range Internal error: There was no valid address for a parameter 9002h Internal hardware error: Please call the VIPA-Service. 9003h Output is not configured as PWM output respectively there is an error in hardware configuration. 9004h PWM was configured but SFC 225 was called (please use SFC 223 PWM!) HB00E - OPL_STD - Rev. 14/22 5-43 Manual VIPA Operation List Standard Chapter 5 VIPA specific blocks 11x 9 21x 9 31x 9 51x 9 SFC 227 - TD_PRM - TD200 communication Description The SFC 227 supports the connection of the TD200 terminal from Siemens to the VIPA CPUs. Please regard that you have to include a data block with the TD200 configuration data before calling the SFC 227. This data block may be created with the TDWizard from VIPA. This data block contains the general settings like language and display mode and the messages that are comfortably creatable with the TDWizard from VIPA. TDWizard is a part of WinPLC7 and is available from VIPA. Parameters The call of the SFC 227 specifies the terminal to communicate with. To call the SFC you have to transfer the following parameters: Name MPI_ADDR TD_STRUCT_PTR FUNC_KEY_PTR OFFSET_INPUT OFFSET_OUTPUT RET_VAL Declaration IN IN IN IN IN OUT Type BYTE ANY ANY BYTE BYTE BYTE Description MPI address of TD Pointer to beginning of TD's data (must be in DB) Pointer to area for keys Forced values offset in input area Forced values offset in output area Return value (0 = OK) MPI_ADR MPI address Enter the MPI address of the connected TD200 terminal. Parameter type: Byte TD_STRUCT_PTR Terminal Structure Pointer Points to the start of the data block containing the parameterization and the text blocks of the terminal. You may create the data block with TDWizard. This tool is a part of WinPLC7, the programming, test, diagnostic and simulation software from VIPA. Parameter type: Pointer Convenient range: DB FUNC_KEY_PTR Function Key Pointer Points to the area where the status byte for hidden keys is stored. Parameter type: Pointer Convenient range: DB, M 5-44 HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard OFFSET_INPUT OFFSET_OUTPUT Chapter 5 VIPA specific blocks Offset Input, Offset Output The terminal allows you to set in- and output byte. The TD200 from Siemens supports only a size of 16byte for in- and outputs. The CPUs from VIPA enables the access to the complete process image (each 128byte for in- and outputs). By setting an offset, you may overlay the periphery range of 128byte with a window of 16byte for in- and output. The following picture illustrates this: Periphery 128 byte Input 16 byte OFFSET_INPUT TD200 Periphery 128 byte Output 16 byte OFFSET_OUTPUT RET_VAL (Return Value) Messages TD200 Type the bit memory byte (marker byte) where the resulting message should be stored. For specification of the (error) messages see the table below. Value 00h 10h 11h 12h 20h 21h 30h 31h 40h 41h 50h 51h 52h 60h HB00E - OPL_STD - Rev. 14/22 Description no error Error at MPI_ADDR MPI_ADDR contains MPI address of the CPU Value in MPI_ADDR exceeds max. MPI address Error in OFFSET_INPUT Value in OFFSET_INPUT is too high Error in OFFSET_OUTPUT Value in OFFSET_OUTPUT is too high Error in TD_STRUCT_PTR TD_STRUCT_PTR points not to a DB Error in FUNC_KEY_PTR Error in FUNC_KEY_PTR FUNC_KEY_PTR points not to an I, Q or M area An internal error occurred 5-45 Manual VIPA Operation List Standard Chapter 5 VIPA specific blocks 11x 21x 9 31x 9 51x 9 SFC 228 - RW_KACHEL - Page frame direct access Description This SFC allows you the direct access to the page frame area of the CPU with a size of 4kbyte. The page frame area is divided into four page frames, each with a size of 1kbyte. Setting the parameters page frame number, -offset and data width, the SFC 228 enables read and write access to an eligible page frame area. Note! This SFC has been developed for test purposes and for building-up proprietary communication systems and is completely at the user's disposal. Please regard that a write access to the page frame area influences a communication directly! Parameters Name K_NR OFFSET R_W SIZE RET_VAL VALUE Declaration IN IN IN IN OUT IN_ OUT Type INT INT INT INT BYTE ANY Description Page frame number Page frame offset Access Data width Return value (0 = OK) Pointer to area of data transfer K_NR Page frame number Type the page frame no. that you want to access. Value range: 0 ... 3 OFFSET Page frame offset Fix here an offset within the specified page frame. Value range: 0 ... 1023 R_W Read/Write This parameter specifies a read res. write access. 0 = read access, 1 = write access SIZE Size The size defines the width of the data area fixed via K_NR and OFFSET. You may choose between the values 1, 2 and 4byte. RET_VAL (Return Value) Byte where an error message is returned to. 5-46 HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Chapter 5 VIPA specific blocks VALUE In-/output area This parameter fixes the in- res. output area for the data transfer. At a read access, this area up to 4byte width contains the data read from the page frame area. At a write access, the data up to 4byte width is transferred to the page frame area. Parameter type: Pointer Example The following example shows the read access to 4byte starting with byte 712 in page frame 2. The read 4byte are stored in DB10 starting with byte 2. For this the following call is required: CALL SFC K_NR OFFSET R_W SIZE RET_VAL VALUE 228 :=2 :=712 :=0 :=4 :=MB10 :=P#DB10.DBX 2.0 Byte 4 Page frame 0 ... K0 ... 1023 0 ... K1 ... 1023 K_NR=2 OFFSET=712 SIZE=4 VALUE 0 ... 712...715 K2 CPU R_W=1 R_W=0 ... 1023 SIZE=4 0 ... K3 ... 1023 Error messages Value 00h 01h ... 05h 06h 07h 08h 09h HB00E - OPL_STD - Rev. 14/22 Description no error Internal error: No valid address found for a parameter defined page frame does not exist parameter SIZE ≠ 1, 2 or 4 at read access parameter SIZE ≠ 1, 2 or 4 at write access parameter R_W ≠ 0 or 1 5-47 Manual VIPA Operation List Standard Chapter 5 VIPA specific blocks 11x 21x 9 31x 9 51x 9 Page frame communication - SFC 230 ... 238 Overview The delivered handling blocks allow the deployment of communication processors in the CPUs from VIPA. The handling blocks control the complete data transfer between CPU and the CPs. Advantages of the handling blocks: • you loose only few memory space for user application • short runtimes of the blocks The handling blocks don't need: • bit memory area • time areas • counter areas Parameter description All handling blocks described in the following use an identical interface to the user application with these parameters: SSNR: ANR: ANZW: IND: QANF/ZANF: PAFE: BLGR: Interface number Order number Indicator word (double word) Indirect fixing of the relative start address of the data source res. destination Relative start address within the type Parameterization error Block size A description of these parameters follows on the next pages. 5-48 HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Chapter 5 VIPA specific blocks SSNR Interface number Number of the logical interface (page frame address) to which the according order refers to. Parameter type : Integer Convenient range : 0 ... 255 ANR Job number The called job number for the logical interface. Parameter type : Integer Convenient range : 1 ... 223 ANZW Indicator word (double word) Address of the indicator double word in the user memory where the processing of the order specified under ANR is shown. Parameter type : Double word Convenient range : DW or MW; use either DW and DW+1 or MW and MW+2 The value DW refers to the data block opened before the incoming call or to the directly specified DB. IND Kind of parameterization (direct, indirect) This parameter defines the kind of data on which the pointer QANF points. 0: QANF points directly to the initial data of the source res. destination data. 1: the pointer QANF/ZANF points to a memory cell, from where on the source res. destination data are defined (indirect). 2: the pointer QANF/ZANF points to a memory area where the source res. destination information lies (indirect). 5: the pointer QANF/ZANF points to a memory cell, from where on the source res. destination data and parameters of the indicator word are defined (indirect). 6: the pointer QANF/ZANF points to a memory area where the source res. destination data and parameters of the indicator word are laying (indirect). Parameter type : Integer Convenient entries : 0, 1, 2, 5, 6 Note! Please regard, that at IND = 5 res. IND = 6, the parameter ANZW is ignored! HB00E - OPL_STD - Rev. 14/22 5-49 Chapter 5 VIPA specific blocks QANF/ZANF Manual VIPA Operation List Standard Relative start address of the data source res. destination and at IND = 5 res. IND = 6 of the indicator word. This parameter of the type "pointer" (Any-Pointer) allows you fix the relative starting address and the type of the data source (at SEND) res. the data destination (at RECEIVE). At IND = 5 res. IND = 6 the parameters of the indicator word are also in the data source. Parameter type : Pointer Convenient range : DB, M, Q, I Example: P#DB10.DBX0.0 BYTE 16 P#M0.0 BYTE 10 P#E 0.0 BYTE 8 P#A 0.0 BYTE 10 BLGR Block size During the boot process the stations agree about the block size (size of the data blocks) by means of SYNCHRON. A high block size = high data throughput but longer run-times and higher cycle load. A small block size = lower data throughput but shorter run-times of the blocks. These block sizes are available: Value Block size Value Block size 0 Default (64byte) 4 128byte 1 16byte 5 256byte 2 32byte 6 512byte 3 64byte 255 512byte Parameter type : Integer Convenient range : 0 ... 255 PAFE Error indication at parameterization defects This "BYTE" (output, marker) is set if the block detects a parameterization error, e.g. interface (plug-in) not detected or a non-valid parameterization of QUANF/ZANF. Parameter type : Byte Convenient range : OB 0 ... OB127, MB 0...MB 255 5-50 HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Chapter 5 VIPA specific blocks Page frame communication - Parameter transfer Direct/indirect parameterization A handling block may be parameterized directly or indirectly. Only the "PAFE" parameter must always been set directly. When using the direct parameterization, the handling block works off the parameters given immediately with the block call. When using the indirect parameterization, the handling block gets only pointers per block parameters. These are pointing to other parameter fields (data blocks or data words). The parameters SSNR, ANR, IND and BLGR are of the type "integer", so you may parameterize them indirectly. Example for direct and indirect parameter transfer Direct parameter transfer CALL SFC 230 SSNR:=0 ANR :=3 IND :=0 QANF:=P#A 0.0 BYTE 16 PAFE:=MB79 ANZW:=MD44 Indirect parameter transfer Please note that you have to load the bit memory words with the corresponding values before. CALL SFC 230 SSNR:=MW10 ANR :=MW12 IND :=MW14 QANF:=P#DB10.DBX0.0 BYTE 16 PAFE:=MB80 ANZW:=MD48 The direct res. indirect transfer of the source and destination parameters is described in the following section. HB00E - OPL_STD - Rev. 14/22 5-51 Manual VIPA Operation List Standard Chapter 5 VIPA specific blocks Page frame communication - Source res. destination definition Outline You have the possibility to set the entries for source, destination and ANZW directly or store it indirectly in a block to which the QANF / ZANF res. ANZW pointer points. The parameter IND is the switch criterion between direct and indirect parameterization. Direct parameterization of source and destination details (IND = 0) With IND = 0 you fix that the pointer QANF / ZANF shows directly to the source res. destination data. The following table shows the possible QANF / ZANF parameters at the direct parameterization: QTYP/ZTYP Description Data in DB Data in MB Data in OB Process image of the outputs Data in IB Process image of the inputs Pointer: Example: DB, MB, OB, IB Definition P#DBa.DBX b.0 BYTE C P#DB10.DBX 0.0 BYTE 8 P#M b.0 BYTE c P#M 5.0 BYTE 10 P#O b.0 BYTE c P#O 0.0 BYTE 2 P#I b.0 BYTE c P#I 20.0 BYTE 1 P#M P#DBa The data is stored "a" means the DB-No., from where the source data in a MB. is fetched or where to the destination data is transferred. P#O The data is stored in the output byte. P#I The data is stored in the input byte. Valid range for "a" Data / Marker Byte, OB, IB Definition 0 ... 32767 irrelevant irrelevant irrelevant DB-No., where data fetch or write starts. Bit memory byte no., where data fetch or write starts. Output byte no., where data fetch or write starts. Input byte no., where data fetch or write starts. Valid range for "b" 0.0 ... 2047.0 0 ... 255 0 ... 127 0 ... 127 BYTE c Definition Length of the Source/ Destination data blocks in Words. Length of the Source/ Destination data blocks in bytes. Length of the Source/ Destination data blocks in bytes. Length of the Source/ Destination data blocks in bytes. Valid range for "c" 1 ... 2048 1 ... 255 1 ... 128 1 ... 128 5-52 HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Indirect parameterization of source and destination details (IND = 1 or IND = 2) QTYP/ZTYP Description Definition Chapter 5 VIPA specific blocks Indirect addressing means that QANF / ZANF points to a memory area where the addresses of the source res. destination areas and the indicator word are stored. In this context you may either define one area for data source, destination and indicator word (IND = 1) or each, data source, data destination and the indicator word, get an area of their own (IND = 2). The following table shows the possible QANF / ZANF parameters for indirect parameterization: IND = 1 IND = 2 Indirect addressing for source or destination parameters. The source or destination parameters are stored in a DB. Indirect addressing for source and destination parameters. The source and destination parameters are stored in a DB in a sequential order. QANF/ZANF QANF/ZANF DW +0 Data type source DW +0 Data type source +2 DB-Nr. at type "DB", otherwise irrelevant +2 DB-Nr. at type "DB", otherwise irrelevant +4 Start address +4 Start address +6 Length in Byte +6 Length in Byte Description data source +8 Data type destin. +10 DB-Nr. at type "DB", otherwise irrelevant Description data destination +12 Start address +14 Length in Byte valid DB-No. 0 ... 32767 0 ... 32767 Data word Definition DW-No., where the stored data starts DW-No., where the stored data starts Valid range 0.0 ... 2047.0 0.0 ... 2047.0 Length Definition Length of the DBs in byte Length of the DBs in byte Valid range 8 fix 16 fix HB00E - OPL_STD - Rev. 14/22 5-53 Manual VIPA Operation List Standard Chapter 5 VIPA specific blocks Indirect parameterization of source and destination details and ANZW (IND = 5 or IND = 6) QTYP/ZTYP Description Definition Indirect addressing means that QANF / ZANF points to a memory area where the addresses of the source res. destination areas and the indicator word are stored. In this context you may either define one area for data source, destination and indicator word (IND = 5) or each, data source, data destination and the indicator word, get an area of their own (IND = 6). The following table shows the possible QANF / ZANF parameters for indirect parameterization: IND=5 IND=6 Indirect addressing for source or destination parameters and indicator word (ANZW). The source or destination parameters and ANZW are stored in a DB in a sequential order. Indirect addressing for source and destination parameters and indicator word (ANZW). The source and destination parameters and ANZW are stored in a DB in a sequential order. QANF/ZANF QANF/ZANF DW +0 Data type source +2 DB-Nr. at type "DB", otherwise irrelevant DW +0 Data type source +2 DB-Nr. at type "DB", otherwise irrelevant Description data source/ destination +4 Start address +4 Start address +6 Length in Byte +6 Length in Byte +8 Data type destin. +8 Data type destin. +10 DB-Nr. at type "DB", otherwise irrelevant Description data source Description indicator word +12 Start address +10 DB-Nr. at type "DB", otherwise irrelevant Description data destination +12 Start address +14 Length in Byte +16 Data type source +18 DB-Nr. at type "DB", otherwise irrelevant Description indicator word +20 Start address valid DB-No. Data word Definition 0 ... 32767 DW-No., where the stored data starts 0 ... 32767 DW-No., where the stored data starts Valid range 0.0 ... 2047.0 0.0 ... 2047.0 Length Definition Length of the DBs in byte Length of the DBs in byte Valid range 14 fix 22 fix 5-54 HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Chapter 5 VIPA specific blocks Page frame communication - Indicator word ANZW Status and error reports Status and error reports are created by the handling blocks: • by the indicator word ANZW (information at order commissioning). • by the parameter error byte PAFE (indication of a wrong order parameterization). Content and structure of the indicator word ANZW The "Indicator word" shows the status of a certain order on a CP. In your PLC program you should keep one indicator word for each defined order at hand. The indicator word has the following structure: Byte 0 1 2 ... 3 Bit 7 ... Bit 0 Bit 3 ... Bit 0: Error management CPU 0: no error 1 ... 5: CPU-Error 6 ... 15: CP-Error Bit 7 ... Bit 4: reserved State management CPU Bit 0: Handshake convenient (data exists) 0: RECEIVE blocked 1: RECEIVE released Bit 1: order commissioning is running 0: SEND/FETCH released 1: SEND/FETCH blocked Bit 2: Order ready without errors Bit 3: Order ready with errors Data management handling block Bit 4: Data receive/send is running Bit 5: Data transmission active Bit 6: Data fetch active Bit 7: Disable/Enable data block 0: released 1: blocked Length word handling block In the "length word" the handling blocks (SEND, RECEIVE) store the data that has already been transferred, i.e. received data in case of a Receive order, send data when there is a Send order. The announcement in the "length word" is always in byte and absolute. HB00E - OPL_STD - Rev. 14/22 5-55 Chapter 5 VIPA specific blocks Error management Byte 0, Bit 0 ... Bit 3 Manual VIPA Operation List Standard Those bits announce the error messages of the order. The error messages are only valid if the bit "Order ready with error" in the status bit is set simultaneously. The following error messages may occur: 0 no error If the bit "Order ready with error" is set, the CP had to reinitialize the connection, e.g. after a reboot or RESET. 1 wrong Q/ZTYP at HTB The order has been parameterized with the wrong type label. 2 AG area not found The order impulse had a wrong parameterized DB-No. 3 AG area too small Q/ZANF and Q/ZLAE overwrite the range boundaries. Handling with data blocks the range boundary is defined by the block size. With flags, timers, counters etc. the range size depends on the AG. 4 QVZ-Error in the AG This error message means, that you chose a source res. destination parameter of the AG area, where there is either no block plugged in or the memory has a defect. The QVZ error message can only occur with the type Q/ZTYP AS, PB, QB or memory defects. 5 Error at indicator word The parameterized indicator word cannot be handled. This error occurs, if ANZW declared a data word res. double word, that is not (any more) in the specified data block, i.e. DB is too small or doesn’t exist. 6 no valid ORG-Format The data destination res. source isn’t declared, neither at the handling block (Q/TYP="NN") nor at the coupler block. 7 Reserved 8 no available transfer connections The capacity for transfer connections is at limit. Delete unnecessary connections. 9 Remote error There was an error at the communication partner during a READ/WRITE-order. A Connection error The connection is not (yet) established. The message disappears as soon as the connection is stable. If all connections are interrupted, please check the block itself and the bus cable. Another possibility for the occurrence of this error is a wrong parameterization, like e.g. inconsistent addressing. B Handshake error This could be a system error or the size of the data blocks has been defined out of range. 5-56 HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Chapter 5 VIPA specific blocks C Initial error The wrong handling block tried to initialize the order or the size of the given data block was too large. D Cancel after RESET This is a normal system message. With PRIO 1 and 2 the connection is interrupted but will be established again, as soon as the communication partner is online. PRIO 3 connections are deleted, but can be initialized again. E Order with basic load function This is a normal system message. This order is a READ/WRITEPASSIV and can not be started from the AG. F Order not found The called order is not parameterized on the CP. This error may occur when the SSNR/A-No. combination in the handling block is wrong or no connection block is entered. The bits 4 to 7 of byte 2 are reserved for extensions. Status management Byte 1, Bit 0 ... Bit 3 Here you may see if an order has already been started, if an error occurred or if this order is blocked, e.g. a virtual connection doesn’t exist any longer. Bit 0 Handshake convenient Set: Per plug-in according to the "delete"-announcement in the order status bit: Handshake convenient (=1) is used at the RECEIVE block (telegram exists at PRIO 1 or RECEIVE impulse is possible at PRIO 2/3) Analyze: Per RECEIVE block: The RECEIVE initializes the handshake with the CP only if this bit is set. Per application: for RECEIVE request (request a telegram at PRIO 1). Bit 1 Order is running Set: Per plug-in: when the CP received the order. Delete: Per plug-in: when an order has been commissioned (e.g. receipt received). Analyze: Per handling blocks: A new order is only send, when the order before is completely commissioned. Per user: when you want to know, if triggering a new order is convenient. HB00E - OPL_STD - Rev. 14/22 5-57 Chapter 5 VIPA specific blocks Manual VIPA Operation List Standard Bit 2 Order ready without errors Set: Per plug-in: when the according order has been commissioned without errors. Delete: Per plug-in: when the according order is triggered for a second time. Analyze: Per user: to proof that the order has been commissioned without errors. Bit 3 Order ready with errors Set: Per plug-in: when the according order has been commissioned with errors. Error causes are to find encrypted in the high-part of the indicator word. Delete: Per plug-in: when the according order is triggered for a second time. Analyze: Per user: to proof that the order has been commissioned with errors. If set, the error causes are to find in the highbyte of the indicator word. Data management Byte 1, Bit 4 ... Bit 7 Here you may check if the data transfer is still running or if the data fetch res. transmission is already finished. By means of the bit "Enable/Disable" you may block the data transfer for this order (Disable = 1; Enable = 0). Bit 4 Data fetch / Data transmission is active Set: Per handling block SEND or RECEIVE, if the fetch/transmission has been started, e.g. when data is transferred with the ALL-function (DMA-replacement), but the impulse came per SEND-DIRECT. Delete: Per handling blocks SEND or RECEIVE, if the data transfer of an order is finished (last data block has been transferred). Analyze: Per user: During the data transfer CP <<->>AG the user must not change the record set of an order. This is uncritical with PRIO 0/1 orders, because here the data transfer is realizable in one block cycle. Larger data amounts however are transferred in blocks during more AG cycles. To ensure data consistency you should proof that the data block isn’t in transfer any more before you change the content! 5-58 HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Chapter 5 VIPA specific blocks BIT 5 Data transmission is active Set: Per handling block SEND, when the data transition for an order is ready. Delete: Per handling block SEND, when the data transfer for a new order has been started (new trigger). Per user: When analysis is ready (flank creation). Analyze: Per user: Here you may ascertain, if the record set of an order has already been transferred to the CP res. at which time a new record set concerning a running order (e.g. cyclic transition) may be started. Bit 6 Data fetch active Set: Per RECEIVE, when data fetch for a new order has been finished. Delete: Per RECEIVE, when data transfer to AG for a new order (new trigger) has been started. Per user, when analyzing (edge creation). Analyze: Per user: Here you may ascertain, if the record set of an order has already been transferred to the CP res. at what time a new record set for the current order has been transferred to the AG. Bit 7 Disable/Enable data block Set: Per user: to avoid overwriting an area by the RECEIVE block res. data transition of an area by the SEND block (only for the first data block). Delete: Per user: to release the according data area. Analyze: Per handling blocks SEND and RECEIVE: if Bit 7 is set, there is no data transfer anymore, but the blocks announce an error to the CP. HB00E - OPL_STD - Rev. 14/22 5-59 Chapter 5 VIPA specific blocks Length word Byte 2 and Byte 3 Manual VIPA Operation List Standard In the length word the handling blocks (SEND, RECEIVE) store the already transferred data of the current order, i.e. the received data amount for receiving orders, the sent data amount for sending orders. Describe: Per SEND, RECEIVE during the data transfer. The length word is calculated from: current transfer amount + amount of already transferred data Delete: Per overwrite res. with every new SEND, RECEIVE, FETCH. If the bit "order ready without error" res. "Data fetch/data transition ready" is set, the "Length word" contains the current source res. destination length. If the bit "order ready with error" is set, the length word contains the data amount transferred before the failure occurred. Status and error reports Important status and error reports of the CPU The following section lists important status and error messages that can appear in the "Indicator word". The representation is in "HEX" patterns. The literal X means "not declared" res. "irrelevant"; No. is the error number. Possible indicator words Indicator word: X F X A The error index "F" shows, that the according order is not defined on the CP. The state index "A" causes a block of this order (for SEND/FETCH and RECEIVE). Indicator word: X A X A The error index "A" shows that the connection of the communication order is not (yet) established. Together with the state index "A" SEND, RECEIVE and FETCH are blocked. Indicator word: X 0 X 8 The connection has been established again (e.g. after a CP reboot), the SEND order is released (SEND-communication order). Indicator word: X 0 X 9 The connection has been established again, the RECEIVE order is released (RECEIVE-communication order). Indicator word: X 0 2 4 SEND has been worked off without errors, the data was transferred. 5-60 HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Chapter 5 VIPA specific blocks Indicator word: X 0 4 5 RECEIVE was successful, the data arrived at the AG. Indicator word: X 0 X 2 The SEND-, RECEIVE-, READ- res. WRITE order is still running. At SEND the partner is not yet ready for RECEIVE or vice versa. Important indicator word states The following table shows the most important indicator word states: Messages at SEND State at H1 State at TCP/IP after reboot after connection start after initial impulse ready without error ready with error after RESET Prio 0/1 Prio 1 0A0A X0X8 X0X2 X024 X No X 8 XDXA Prio 2 Prio 2 0A0A X0X8 X0X2 X024 X No X 8 XDXA Prio 3/4 Prio 3 0008 ..... X0X2 X024 X No X 8 XDX8 Messages at RECEIVE State at H1 State at TCP/IP after reboot after connection start after initial impulse Telegram received ready without error ready with error after RESET Prio 0/1 Prio 1 0A0A X0X4 X0X2 X0X1 X041 X No X 8 XDXA Prio 2 Prio 2 0A0A X009 X0X2 ..... X045 X No X 9 XDXA Prio 3/4 Prio 3 0001 ..... X0X2 ..... X045 X No X 9 XDX9 Prio 2 Prio 2 0A0A X008 X0X2 X044 X024 X No X 8 XDXA Prio 3/4 Prio 3 Messages at READ/WRITE-ACTIVE State at H1 Prio 0/1 State at TCP/IP Prio 1 after reboot after connection start after initial impulse READ ready WRITE ready ready with error after RESET HB00E - OPL_STD - Rev. 14/22 5-61 Chapter 5 VIPA specific blocks Manual VIPA Operation List Standard Page frame communication - Parameterization error PAFE PAFE The parameterization error byte PAFE is set (output or bit memory), when the block detects a "parameterization error", e.g. there is no interface or there is an invalid parameterization of QANF / ZANF. PAFE has the following structure: Byte 0 5-62 Bit 7 ... Bit 0 Bit 0: error 0: no error 1: error, error-No. in Bit 4 to Bit 7 Bit 3 ... Bit 1: reserved Bit 7 ... Bit 4: error number 0: no error 1: wrong ORG-Format 2: area not found (DB not found) 3: area too small 4: QVZ-error 5: wrong indicator word 6: no Source-/Destination parameters at SEND/RECEIVE ALL 7: interface not found 8: interface not specified 9: interface overflow A: reserved B: invalid order-No. C: interface of CP doesn’t quit or is negative D: Parameter BLGR not allowed E: reserved F: reserved HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Chapter 5 VIPA specific blocks 11x 21x 9 31x 9 51x 9 SFC 230 - SEND The SEND block initializes a send order to a CP. Normally SEND is called in the cyclic part of the user application program. Although the insertion of this block into the interrupt or the time-alarm program part is possible, the indicator word (ANZW), however, may not be updated cyclically. This should be taken over by a CONTROL block. The connection initialization with the CP for data transmission and for activating a SEND impulse is only started, if: • the FB RLO (result of operation) received "1". • the CP released the order. (Bit "order active" in ANZW = 0). Description During block stand-by, only the indicator word is updated. Parameters Name SSNR ANR IND QANF PAFE ANZW Declaration IN IN IN IN OUT IN_OUT SEND_ALL for data transmission Type INT INT INT ANY BYTE DWORD Description Interface number Job number Mode of addressing Pointer to data source Parameterization error Indicator word If the CP is able to take over the data directly, the SEND block transfers the requested data in one session. If the CP requests only the order parameters or the amount of the depending data is too large, the CP only gets the sending parameters res. the parameter with the first data block. The according data res. the assigned serial blocks for this order are requested from the CP by SEND_ALL to the CPU. For this it is necessary that the block SEND_ALL is called minimum one time per cycle. The user interface is for all initialization types equal, only the transfer time of the data is postponed for minimum one CPU cycle. HB00E - OPL_STD - Rev. 14/22 5-63 Chapter 5 VIPA specific blocks Manual VIPA Operation List Standard 11x 21x 9 31x 9 51x 9 SFC 231 - RECEIVE Description Parameters Name SSNR ANR IND ZANF PAFE ANZW The RECEIVE block receives data from a CP. Normally the RECEIVE block is called in the cyclic part of the user application program. Although the insertion of this block into the interrupt or the waking program part is possible, the indicator word cannot be updated cyclically. This should be taken over by a CONTROL block. The handshake with the CP (order initialization) and for activating a RECEIVE block is only started, if • the FB RLO received "1". • the CP released the order (Bit "Handshake convenient" = 1). Declaration IN IN IN IN OUT IN_OUT Type INT INT INT ANY BYTE DWORD Description Interface number Job number Mode of addressing Pointer to data destination Parameterization error Indicator word If the block runs in stand-by only the indicator word is updated. The RECEIVE block reacts different depending from the kind of supply and the CP reaction: • If the CP transmits a set of parameters although the RECEIVE block itself got destination parameters, the parameter set of the block has the priority above those of the CP. • Large amounts of data can only be transmitted in blocks. Therefore you have to transmit the assigned serial blocks by means of RECEIVE_ALL to the CPU. It is necessary that the block RECEIVE_ALL is called minimum one time per application cycle and CP interface, if you want to transmit larger data amounts. You also have to integrate the RECEIVE_ALL cyclically, if the CP only uses the RECEIVE for releasing a receipt telegram and the data is transmitted via the background communication of the CPU. 5-64 HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Chapter 5 VIPA specific blocks 11x 21x 9 31x 9 51x 9 SFC 232 - FETCH Description Parameters Name SSNR ANR IND ZANF PAFE ANZW The FETCH block initializes a FETCH order in the partner station. The FETCH order defines data source and destination and the data source is transmitted to the partner station. The CPU from VIPA realizes the definition of source and destination via a pointer parameter. The partner station provides the Source data and transmits them via SEND_ALL back to the requesting station. Via RECEIVE_ALL the data is received and is stored in Destination. The update of the indicator word takes place via FETCH res. CONTROL. The handshake for initializing FETCH is only started, if • the FB RLO receives "1". • the function has been released in the according CP indicator word (order active = 0). Declaration IN IN IN IN OUT IN_OUT Type INT INT INT ANY BYTE DWORD Description Interface number Job number Mode of addressing Pointer to data destination Parameterization error Indicator word Note! More information for indirect parameterization you will find in this chapter in "Page frame communication - Source res. ". HB00E - OPL_STD - Rev. 14/22 5-65 Chapter 5 VIPA specific blocks Manual VIPA Operation List Standard 11x 21x 9 31x 9 51x 9 SFC 233 - CONTROL Description Parameters Name SSNR ANR PAFE ANZW The purpose of the CONTROL block is the following: • Update of the indicator word • Query if a certain order of the CP is currently "active", e.g. request for a receipt telegram • Query the CP which order is recently in commission The CONTROL block is not responsible for the handshake with the CP, it just transfers the announcements in the order status to the parameterized indicator word. The block is independent from the RLO and should be called from the cyclic part of the application. Declaration IN IN OUT IN_OUT Type INT INT BYTE DWORD Description Interface number Job number Parameterization error Indicator word ANR If ANR ≠ 0, the indicator word is built up and handled equal to all other handling blocks. If the parameter ANR gets 0, the CONTROL command transmits the content of the order state cell 0 to the LOW part of the indicator words. The order state cell 0 contains the number of the order that is in commission, e.g. the order number of a telegram (set by the CP). 5-66 HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Chapter 5 VIPA specific blocks 11x 21x 9 31x 9 51x 9 SFC 234 - RESET The RESET ALL function is called via the order number 0. This resets all orders of this logical interface, e.g. deletes all order data and interrupts all active orders. With a direct function (ANR ≠ 0) only the specified order will be reset on the logical interface. The block depends on the RLO and may be called from cyclic, time or alarm controlled program parts. Description Parameters Name SSNR ANR PAFE Declaration IN IN OUT Operating modes Type INT INT BYTE Description Interface number Job number Parameterization error The block has two different operating modes: • RESET ALL • RESET DIRECT HB00E - OPL_STD - Rev. 14/22 5-67 Manual VIPA Operation List Standard Chapter 5 VIPA specific blocks 11x 21x 9 31x 9 51x 9 SFC 235 - SYNCHRON Description Parameters Name SSNR BLGR PAFE Block size The SYNCHRON block initializes the synchronization between CPU and CP during the boot process. For this it has to be called from the starting OBs. Simultaneously the transition area of the interface is deleted and predefined and the CP and the CPU agree about the block size. Declaration IN IN OUT Type INT INT BYTE To avoid long cycle run-times it is convenient to split large data amounts into smaller blocks for transmitting them between CP and CPU. You declare the size of these blocks by means of "block size". A large block size = high data throughput, but also longer run-times and therefore a high cycle time strain. A small block size = smaller data throughput, but also shorter run-times of the blocks. Following block sizes are available: Value Block size Value Block size 0 Default (64byte) 4 128byte 1 16byte 5 256byte 2 32byte 6 512byte 3 64byte 255 512byte Parameter type: Valid range: 5-68 Description Interface number Block size Parameterization error Integer 0 ... 255 HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Chapter 5 VIPA specific blocks 11x 21x 9 31x 9 51x 9 SFC 236 - SEND_ALL Description Parameters Name SSNR PAFE ANZW ANZW Via the SEND_ALL block, the data is transmitted from the CPU to the CP by using the declared block size. Location and size of the data area that is to transmit with SEND_ALL, must be declared before by calling SEND res. FETCH. In the indicator word that is assigned to the concerned order, the bit "Enable / Disable" is set, "Data transmission starts" and "Data transmission running" is calculated or altered. Declaration IN OUT IN_OUT Type INT BYTE DWORD Description Interface number Parameterization error Indicator word In the indicator word of the block, the indicator word, that is parameterized in the SEND_ALL block, the current order number is stored (0 means stand-by). The amount of the transmitted data for one order is shown in the data word of SEND_ALL which follows the indicator word. Note! In the following cases, the SEND_ALL command has to be called for minimum one time per cycle of the block OB 1: • if the CP is able to request data from the CPU independently. • if a CP order is initialized via SEND, but the CP still has to request the background communication data of the CPU for this order. • if the amount of data, that should be transmitted by this SEND to the CP, is higher than the declared block size. HB00E - OPL_STD - Rev. 14/22 5-69 Chapter 5 VIPA specific blocks Manual VIPA Operation List Standard 11x 21x 9 31x 9 51x 9 SFC 237 - RECEIVE_ALL Description Parameters Name SSNR PAFE ANZW ANZW Via the RECEIVE_ALL block, the data received from the CP is transmitted from the CP to the CPU by using the declared block size. Location and size of the data area that is to transmit with RECEIVE_ALL, must be declared before by calling RECEIVE. In the indicator word that is assigned to the concerned order, the bit "ENABLE/DISABLE" is set, "Data transition starts" and "Data transition/fetch running" is analyzed or altered. The receiving amount is shown in the following word. Declaration IN OUT IN_OUT Type INT BYTE DWORD Description Interface number Parameterization error Indicator word In the indicator word of the block, the indicator word that is parameterized in the RECEIVE_ALL block, the current order number is stored. In the stand-by running mode of RECEIVE_ALL the block indicator word is deleted. Note! In the following cases, the RECEIVE_ALL command has to be called for minimum one time per cycle of the block OB 1: • if the CP should send data to the CPU independently. • if a CP order is initialized via RECEIVE, but the CP still has to request the "background communication" data of the CPU for this order. • if the amount of data that should be transmitted to the CPU by this RECEIVE, is higher than the declared block size. 5-70 HB00E - OPL_STD - Rev. 14/22 Manual VIPA Operation List Standard Chapter 5 VIPA specific blocks 11x 21x 9 31x 9 51x 9 SFC 238 - CTRL1 Description This block is identical to the CONTROL block SFC 233 except that the indicator word is of the type Pointer and that it additionally includes the parameter IND, reserved for further extensions. The purpose of the CONTROL block is the following: • Update of the indicator word. • Query if a certain order of the CP is currently active, e.g. request for a receipt telegram • Query the CP which order is recently in commission The CONTROL block is not responsible for the handshake with the CP; it just transfers the announcements in the order status to the parameterized indicator word. The block is independent from the RLO and should be called from the cyclic part of the application. Parameters Name SSNR ANR IND PAFE ANZW Declaration IN IN IN OUT IN_OUT Type INT INT INT BYTE DWORD Description Interface number Job number Reserved Parameterization error Indicator word ANR If ANR ≠ 0, the indicator word is built up and handled equal to all other handling blocks. If the parameter ANR gets 0, the CONTROL command transmits the content of the order state cell 0 to the LOW part of the indicator words. The order state cell 0 contains the number of the order that is in commission, e.g. the order number of a telegram (set by the CP). IND The parameter IND has no functionality at this time and is reserved for further extensions. ANZW The indicator word ANZW is of the type Pointer. This allows you to store the indicator word in a data block. HB00E - OPL_STD - Rev. 14/22 5-71 Chapter 5 VIPA specific blocks 5-72 Manual VIPA Operation List Standard HB00E - OPL_STD - Rev. 14/22