Digital input module for siemens simatic s7-1500; siemens simatic et 200mp (52 pages)
Summary of Contents for Siemens SIMATIC S5 CP 523
Page 1
SIMATIC S5 CP 523 Serial I/O Module Manual Order No. 6ES5 998-0DD21 EWA 4NEB 811 6044-02a...
Page 2
Siemens has developed this document for its licensees and customers. The information contained herein is the property of Siemens and may not be copied, used, or disclosed to others without prior written approval from Siemens. Users are cautioned that the material contained herein is subject to change by Siemens at any time and without prior notice.
Page 3
Preface Introduction System Overview Technical Description Hardware Installation Notes on Operation Address Assignment Print Mode Communications Mode Using the Function Blocks Appendices Index EWA 4NEB 811 6044-02a...
Page 4
CP 523. However, the applications are so numerous that not all the problems that might occur can be dealt with in one manual. For other problems, please ask your Siemens representative for advice. EWA 4NEB 811 6044-02a...
Page 5
CP 523 Introduction Introduction It is important to study the introduction carefully before reading the rest of the manual. This will help you to use the manual and will save you time. Description of Contents This manual is a comprehensive description of the CP 523. The manual can be divided into blocks according to topics.
Page 6
Introduction CP 523 Conventions In order to improve the readability of the manual, a menu-style breakdown has been used, i.e.: • The individual chapters can be quickly located by means of a thumb register. • There is an overview containing the headings of the individual chapters at the beginning of the manual.
Page 7
CP 523 Introduction Courses Siemens provide SIMATIC S5 users with extensive opportunities for training. For more information, please contact your Siemens representatives. Reference Literature This manual is a comprehensive description of the CP 523 serial I/O module. Topics not specific to the CP 523, however, are only briefly dealt with.
Page 8
CP 523 Introduction Conventions The following conventions are used in this book and are listed for your reference: Convention Definition Example A box that indicates a type of hazard, describes its implications, and tells you how to avoid the hazard is a cautionary statement.
System Overview Technical Description Hardware Installation Notes on Operation Address Assignment Print Mode Communications Mode Using the ”SEND” and ”RECEIVE” Function blocks EWA 4NEB 811 6044-02a...
Page 10
Figures 1-1. S5-115U Programmable Controller with CP 523 and Printer ... . . 1 - 1 1-2. S5-115U Programmable Controller with CP 523 and Terminal ... . 1 - 2 EWA 4NEB 811 6044-02a...
Page 11
System Overview CP 523 System Overview Intelligent inputioutput modules (1/0s) expand the application area of 51 MATIC 55 programmable They are technology-oriented and offload the central processing unit by preprocessing controllers. input signals. The CP 523 serial 1/0 module is an intelligent !/0 module, which can be used in the S5-1 15U, special COM software and offers applications which until now could only be implemented with expensive and functional y complex modules.
Page 12
System Overview Communications Mode In “Communications mode”, the CP 523 can communicate over the 1/0 interface with an 1/0 unit (terminal, CP 523, CPU 944, etc.) equipped with a V.24 (RS 232C) or TTY interface. This mode enables the transfer of data frames between the CPU and an 1/0 device connected to the CP 523. The CP 523 provides a total of three communication control procedures, i.e.
CP 523 Technical Description Technical Description Principle of the CP 523 The CP 523 handles data transfer with a peripheral device autonomously. Data transfer between the CPU and the CP 523 must always be started by the CPU by sending a job request to the CP 523. Typical jobs would be, for example, ”Print message text number 20”...
Technical Description CP 523 Communications mode In Communications mode, message frames of up to 256 bytes in length can be transferred bet- ween the CPU and a peripheral device connected to the CP 523. When it receives a "SEND" request from the CPU, the CP 523 transfers the data from the transfer memory to a Send mailbox.
Page 17
CP 523 Technical Description EPROM/EEPROM You can use EPROM and EEPROM memory submodules of up to 32K bytes. The EPROM/EEPROM is configured with the programmer. • Print mode In Print mode, the parameter setting data for the serial interface and for the format of the printout is defined in data block 1 (DB 1) on the memory submodule.
Page 18
Technical Description Technical Specifications For environmental, mechanical and electromagnetic conditions see the relevant programmable control Ier manual. TTY signals are floarlng Memory submodule EPROM/E EPROM Serial Interface Asynchronous 11 -bit cha racter frame 110 to 9600 baud TTY active 10 m/33 ft. - TTY passive 1000 m/3280 ft Voltage drop...
Page 19
CP 523 Technical Description Serial Interface CP - Peripheral Device The CP 523 is equipped with an RS-232-C (V.24) interface and a TTY interface. You can set the serial interface parameters in two ways: • In the user program with job number 90 "Set interface parameters"...
Technical Description CP 523 2nd example: Character frame: 11-bit Data format: 8 data bits (1 start bit, 8 data bits, 2 stop bits) 10 11 Bit no 1 start 2 stop bits 8 data bits Figure 2-4. 11-Bit Character Frame with 8 Data Bits and 2 Stop Bits Note: When using the RS-232-C (V.24) interface, the readiness of the sending or receiving device can only be recognized via the control signals.
CP 523 Technical Description 2.3.2 Communications Mode The possible methods of transmission depend on the following: • Type of interface (TTY or RS-232-C (V.24) • Whether handshaking has been configured when the RS-232-C (V.24) interface is used (Handshaking OFF or ON). •...
Technical Description CP 523 RS-232-C (V.24) interface with handshake ON The RS-232-C (V.24) interface of the CP 523 can handle the following signals in handshake ON mode: Table 2-2. Valid Control Signals of the RS-232-C (V.24) Interface in Handshake ON Mode Control signal State Meaning...
CP 523 Technical Description Data transfer between the CP and peripheral device takes place as follows: The CP 523 sets the "DTR" output after startup. This indicates that the CP is operable and ready to receive. Example: The CP wants to send data 1.
Technical Description CP 523 Memory Submodule In Print mode, you require a user submodule, which you must configure with the following data in off-line mode using a programmer: • Message texts in DB 2 to 255 These DBs are independent of the DBs stored in the CPU. The DBs in the memory submodule and the DBs in the CPU may have the same numbers.
CP 523 Technical Description Integral Hardware Clock The CP incorporates a hardware clock which is backed up by the battery of the PLC power supply module. Using the clock data You can use the clock data in two ways: • The current clock data can be inserted in a message text.
Page 27
System Overview Technical Description Hardware Installation Mechanical Assembly ........3 - 1 3.1.1 Compatible Programmable Controllers and Expansion Units .
Page 28
Figures 3-1. Installing the CP 523 in the Adapter Casing (6ES5 491-0LB11) ... . 3 - 3 3-2. Installing the CP 523 in the S5-135U Central Controller ....3 - 4 3-3.
CP 523 Hardware Installation Hardware Installation Mechanical Assembly 3.1.1 Compatible Programmable Controllers and Expansion Units The CP 523 can be used in the S5-115U, S5-115F (in both cases with adapter casings), S5-135U, S5-150U and S5-155U programmable controllers - central controllers (CCs) or expansion units (EUs) - without fans.
Page 30
Hardware Installation CP 523 Note: The 304 and 314 or 307/317 or 301/310 interface modules are required when using the CP 523 in an expansion unit. Use in the S5-135U, S5-150U and S5-155U • S5-135U central controller (Only in the normal I/O i.e. P area) •...
Hardware Installation 3.1.2 installing the CP 523 You must note the following when installing and unplugging the CP 523: . The module may only be plugged in or unplugged when the PLC is in the POWER OFF state. The memory submodule may only be plugged in or unplugged when the PLC is at POWER OFF. The connecting cable to the peripheral device (Cannon subminiature D male connector) may only be plugged in and unplugged when the CPU is at STOP and data transfer between the CP and the peripheral device has been term i nated.
Hardware Installation Use in the S5-135U/S5-150U and S5-155U The CP 523 is mounted direct onto the module rack. Figure 3-2. Installing the CP 523 in the S5-135U Central Controller 3.1.3 Settings on the Module 5 ) : must set the address of the module on switch bank S 1 ( + Section .
Hardware Installation Wiring The module has a serial interface port. You can configure either the TTY interface or the RS-232-C subminiature D female connector. 3.2.1 Connections Backplane connector Xl Cannon subminiature D female connector (25-pin) Shield Fastening screw, 4-40 VNC-2B thread Figure 3-3.
Hardware Installation CP 523 3.4.2 Terminal Diagrams Communications Mode The CP 523 assumes the following as peripheral device: • Data terminal equipment, e.g. CP 521, CP 523, CPU 944 • Data communications equipment, e.g. a MODEM CP 523 to CP 523 (TTY interface) CP 523 (TTY passive) CP 523 (TTY active) TTY IN+...
Page 39
CP 523 Hardware Installation CPU 944 (TTY active) - CP 523 (TTY passive) CPU 944 CP 523 20 mA (11) (6) TTY IN+ TTY OUT+ (8) TTY IN - TTY OUT - Ground 20 mA (13) (10) TTY OUT+ TTY IN+ (12) TTY OUT - TTY IN - (12)
(24/25) Shield Figure 3-12. Zero Modem Operation Taking the CP 523 to CP 523 as Example Connecting a DTE to a DCE taking the CP 523 to modem (SIEMENS 2425 B DX) as example CP 523 Modem V.24 -RXD (5) Modem RXD V.24 -TXD (11)
Page 41
System Overview Technical Description Hardware Installation Notes on Operation Restart Characteristics ........4 - 1 4.1.1 Checking the Module .
Page 43
CP 523 Notes on Operation Notes on Operation Restart Characteristics The CP 523 executes a restart routine when the power supply is restored (POWER ON). The restart procedure consists of the following: • Clearing the Send and Receive mailboxes • Checking the module ( 4.1.1) •...
Page 44
Notes on Operation CP 523 During the restart procedure, the CP signals "Module busy" (XF ) in the status byte. The CP cannot accept any jobs during this time. For this reason, you must scan the module's status byte (byte 0) for the XF before issuing the first job request.
Page 45
CP 523 Notes on Operation 4.1.3 Clock Test The module's real-time clock is tested. The clock is set when the battery back-up fails during PLC POWER OFF. The clock has the default setting 12:00:00 01.01.90. Errors and the default setting are provided an appropriate number in byte 0 "Module status" and can be evaluated in the control program.
Page 46
Notes on Operation CP 523 4.2.1 Print Mode Operation in Print mode may be interrupted for various reasons. The following table lists the effects of faults. Table 4-4. Faults in Operation (Print Mode) Fault Comment Effect CPU goes to Activated print jobs are completed.
Page 47
CP 523 Notes on Operation 4.2.2 Communications Mode Operation may be interrupted for various reasons in Communications mode. The following table lists the effects of faults. Table 4-5. Faults in Operation (Communications Mode) Fault Comment Effect CPU goes to Data traffic continues between CP and peripheral STOP device.
System Overview Technical Description Hardware Installation Notes on Operation Address Assignment Setting the Start Address and the I/O Area ..... 5 - 1 Access to the Transfer Memory .
Page 50
CP 523 Address Assignment Address Assignment This section describes • how to set the module address ( 5.1) • when the CP accepts data from the CPU ( 5.2) • when the CP supplies current data for the CPU ( 5.2) Setting the Start Address and the I/O Area The CP incorporates an eight-byte transfer memory.
Page 51
Address Assignment CP 523 Table 5-1. Switch Settings on Switch Bank S1 for Defining the Start Address Start Address Switch setting Switch Setting (not in the P Area) Switch bank S1 Start Address Switch Bank S1 Table 5-2. Settings on Switch Bank S1 for Defining the I/O Area Switch Setting I/O Area Absolute Address...
Page 52
CP 523 Address Assignment Access to the Transfer Memory The CPU can write data to the transfer memory at any time. After the CPU has written the relevant data into word 0, • the CP 523 fetches data from the transfer memory •...
Page 53
Address Assignment CP 523 Example: Writing to word 0 of the transfer memory with the CPU 944 in the user program Initial address 128 is set in the P area on the CP. The job number for "Print message text No. 20" is to be written to word 0.
Page 54
System Overview Technical Description Hardware Installation Notes on Operation Address Assignment Print Mode General ........... . . 6 - 1 Prerequisites for Operation in Print Mode .
Page 55
Figures 6-1. Schematic for Entering Parameter Blocks in DB 1 ..... . . 6 - 4 6-2. Schematic for Entering Headers and Footers .
CP 523 Print Mode Print Mode General The CP 523 enables the output of message texts to a printer in Print mode: • Output of message texts defined by you in data blocks (DB) 2 to 255 on the memory sub- module.
Page 57
Print Mode CP 523 3. Configuring message texts You must configure at least one message text in one of the DBs 2 to 255 on the memory sub- module. Note: If you have configured a message text in a DB, you can configure further message texts later in other DBs and store them on the memory submodule.
CP 523 Print Mode Setting the CP 523 Parameters in Print Mode The CP 523 can only be operated in Print mode if an initialized memory submodule has been plugged in. Store the following in the memory submodule: • Parameter setting data for the CP 523 in data block (DB) 1 •...
Page 59
Print Mode CP 523 Dividing the parameters into ten parameter blocks enables you to initialize only the parameter block you want to modify. However, this parameter block must be entered in its entirety even if individual parameters within the block are to retain their default values. Entering the parameter blocks You must first enter all the parameter blocks you want to change in DB 1 using the programmer.
CP 523 Print Mode 6.3.1 Setting the Serial Interface Parameters (Parameter Blocks 0, 1 and 2) Store the data for the serial interface in parameter blocks 0, 1 and 2. If you enter an illegal value, it will be replaced by the default value. Table 6-2.
Print Mode CP 523 Baud rate You have a choice of eight baud rates. The default is 600 baud. If you use the RS-232-C (V.24) interface, you must take the load capacitance of cables longer than 15 m into account. If you operate the CP 523 with an active TTY interface, a cable length of up to 10 m/33 ft.
CP 523 Print Mode Parameters for waiting times These parameters are only significant if you are not using an XON/XOFF protocol in Print mode and if you are not evaluating the BUSY signal. You can set waiting times for Carriage Return (CR), Line Feed (LF) and Form Feed (FF) in multiplex of 0.25 s.
Print Mode CP 523 6.3.3 Configuration Data for Message Text Printout (Parameter Blocks 4 to 6) If you enter an illegal value, the CP will replace it with the relevant default value. • If the lower limit is exceeded, the lower limit value is set. •...
Page 64
CP 523 Print Mode Page format The page format is defined by the information given in parameter blocks 5 and 6. Table 6-5. Page Format Line Page Format Blank line (if page number, header or footer has been configured) Blank line (if page number, header or footer has been configured) Page No.
Page 65
Print Mode CP 523 Configuring headers and footers You can configure up to two headers and two footers. The headers and footers may contain spaceholders for the date and time of day as well as for control characters. Spaceholders for variables and message texts are not evaluated, and appear in the printout as configured.
CP 523 Print Mode 6.3.4 Configuring the Character Conversion Table (Parameter Block 8) Up to sixteen ASCII characters from the printer character set can be converted to another character set for the purpose of adapting to special national characters. Block 8 must be configured according to the following schematic: When converting several ASCII characters Point Block...
Page 67
Print Mode CP 523 Example: Configuring the character conversion table for the PT 88/89 The printer is initialized for the international character set. It also contains the character sets of other languages, among them German. You want to print the following: 1.
CP 523 Print Mode 6.3.5 Configuring the Correction Value for the Integral Clock (Parameter Block 9) You can configure a correction value to increase the accuracy of the clock. The correction value is printed in s/month. A month is defined as 30 days. Table 6-6.
Print Mode CP 523 6.3.6 Example for Configuring the CP 523 in Print Mode Start address 128 is set on the CP 523. Configure the CP as follows: • Parameters for the serial interface ......(parameter block 0) - 2400 baud - Even parity - No BUSY signal...
CP 523 Print Mode Configuring Message Texts Store the message texts on the memory submodule in data blocks 2 to 255 under a message text number in the range 1 to 4095. Each message text may comprise up to 136 characters, including variables.
Page 71
Print Mode CP 523 Message text number The message text is stored in the DB under a message text number (1 to 4095).If you want to print a message text, transfer the message text number and a "Print message text" request to the CP 523 in the user program ( 6.7.1).
CP 523 Print Mode Example: Configuring message texts without spaceholders You want to store the following message texts in DB2: Message text 4: Excess temperature Message text 5: Coolant loss Entry on the PG 685 for DB 2 Explanation Message text number 4, Separator ”:”, KS = '4:Excess temperature$';...
Page 73
Print Mode CP 523 Table 6-7. Overview of Spaceholders Configurable in Message Texts Space- Max. Number in Configurable in Meaning Comment holder One Message Text Header and Footer Insert date Insert time of day Sa,b, . . . Transfer max. 50 printer control parameters Insert message...
CP 523 Print Mode 6.4.3 Spaceholders for Date and Time of Day When printing out a message text the following takes place: • The spaceholder "D" for the date is replaced by the current date. • The spaceholder "T" for the time of day is replaced by the current time. The output format of the date and the time of day can be configured.
Print Mode CP 523 6.4.4 Spaceholders for Control Parameters You can configure printer control parameters in three ways in the message text: • Entry with the ^ character (CTRL key) • Entry with the spaceholder Sa, b • Direct entry with data format KH Entry with the "^"...
Page 76
CP 523 Print Mode Entry with the spaceholders "Sa, b, ..." If you use the spaceholders "Sa, b", you must enter the control character in ASCII code in decimal form. If you want to enter several control characters consecutively, you must separate them with commas.
Page 77
Print Mode CP 523 Direct entry with the "KH" format The control parameters are entered direct with the "KH" format during configuration of a message text. You must use the table to find the ASCII codes of the control parameters. Switch from the "KS" or "C"...
CP 523 Print Mode 6.4.5 Spaceholders for Message Text The spaceholder is replaced by a message text on printout. The number of the message text to be replaced can be specified in two ways: • The number is specified when the message is configured •...
Page 79
Print Mode CP 523 Message text number as "KV" variable If you have configured the "KV" variable in a message text, you must specify the numbers of the message texts to be inserted in bytes 2 to 7 in the case of the "Print message text" job: •...
Page 80
CP 523 Print Mode Maximum length of message texts Messages may not exceed 136 characters in length. If you use space- holders, the printout may be longer than 136 characters. The maximum length of the printout is 250 characters. Example: Configuring a message text with spaceholders for inserting message text.
Print Mode CP 523 6.4.6 Spaceholders for Variables The spaceholder is replaced by the variable at printout. You must specify the variables in bytes 2 to 7 in the "Print message text" request: • Byte 2 and 3 Value of the 1st variable (data format as configured) •...
Page 82
CP 523 Print Mode "KB" data format The CP evaluates the low-order byte of a 16-bit variable as the value for the variable in the "Constant byte" KB format: • Byte 3 Value of the 1st variable • Byte 5 Value of the 2nd variable •...
Page 83
Print Mode CP 523 Errors occurring when setting the "KFa,b" or "KFa.b" format parameters have the following effects: • If you specify values outside the value range for "a" and "b", the spaceholder is treated as text and printed as configured. •...
Page 84
CP 523 Print Mode "KG", "KG." and "KG,", data format If you configure the "KG" or "KG." data format, 13 characters are printed out. In the case of "KG" and "KG,", a comma is printed out and in the case of "KG." a decimal point. "KGa.b"...
Print Mode CP 523 Processing Job Requests in Print Mode The CP 523 handles data transfer with the printer autonomously. Data transfer between the CPU and the CP 523 must always be initiated by the CPU. The CP 523 has an eight-byte transfer memory, which can be used by the CPU and the CP 523.
Page 86
CP 523 Print Mode Access to the CP 523 transfer memory The CPU can read the transfer memory at any time with L PW statements and write to it with T PW statements. The CP 523 must be able to detect the instant at which the data transferred by the CPU is valid. Data in the transfer memory is recognized as valid by the CP 523 whenever the CPU transfers a (print) request in word 0 of the transfer memory.
Page 87
Print Mode CP 523 Function of the message buffer The CP 523 is equipped with a message buffer. Job requests to the printer (print requests) are stored in this message buffer. The CP forwards the print requests to the printer from the message buffer.
Page 88
CP 523 Print Mode The following is a schematic of job request processing. Entry of the print request in the message buffer is not shown in the figure. It is only important for the user to know if a job request has been accepted by the CP 523 and will be serviced.
Page 89
Print Mode CP 523 Status of the CP 523 and the Printer, and Reading the Current Clock Data When you have written to word 0 of the transfer memory, the module makes the following current data available in the transfer memory which you can read with direct peripheral access: •...
Page 90
CP 523 Print Mode Example: Scanning the status of the module The module is set to start address 128. An unconfigured memory submodule is plugged into the module. When the error is detected, output 4.0 is to be set. STL FB 100 Explanation NAME :ERROR1...
Page 91
Print Mode CP 523 Example: Evaluating the status of the printer The module is set to start address 128. If the printer is not ready, output 4.1 is to be set. STL FB 101 Explanation NAME :ERROR2 Transfer nonrelevant data to the CP. The CP then updates the KH 0000 transfer memory with current data.
Page 92
CP 523 Print Mode Example: Reading the current clock data The module is set with to start address 128. The clock data is to be output on digital output modules beginning address 8. STL FB 102 Explanation NAME :CLOCKDAT Load nonrelevant data into accumulator 1 and transfer it to word KH 0000 0 of the CP so that the CP transfers current data to the transfer PW 128*...
Print Mode CP 523 Overview of Permissible Jobs in Print Mode The CPU transfers the job request to the CP 523 in word 0. The job number is stored in byte 0. Table 6-18. Permissible Job Request to the CP 523 in Print Mode Byte 0 Byte 1 Job Request...
Page 94
CP 523 Print Mode Additional information for "Print message text" (job numbers 0, 3 and 4) The following can be additionally transferred to the CP 523 in words 2, 4 and 6 for "Print message text" (job numbers 0, 3 and 4): •...
Print Mode CP 523 Setting the page number (job number 20 Specify the page number in binary code in byte 1. Execute form feed (job number 5000 If the "Output line feed" request 6000 has not yet been serviced, it is cancelled by this request. Execute line feed (job number 6000 This job request generates a blank line.
Page 96
CP 523 Print Mode 6.7.1 Print Message Text (Job Numbers 0, 3 and 4) The CP 523 forwards message text XY to the printer when it receives a "Print out message text XY" request. You can specify whether the printer is to execute a line feed (LF) or carriage return (CR) after printing message text XY.
Page 97
Print Mode CP 523 Permissible insertions when printing the message text You can enter spaceholders in the message text when configuring message texts on the memory submodule. These spaceholders are replaced accordingly on printout. You can enter spaceholders for the following: •...
Page 98
CP 523 Print Mode Example: Initiation of one-off message text printout Start address 128 is set on the CP 523. A memory submodule configured with message text 9 is plugged into the CP ( 6.4.3). Message text 9 is to be printed if flag 20.0 is set. The following program prints message text 9 once.
Page 99
Print Mode CP 523 Example: Simultaneous use of the "KV" spaceholder, the "KH" spaceholder for variables and the spaceholder for the time of day. You have configured the following message texts on the memory submodule ( 6.4.5): Message text 84: The motor went down as a result of "KV"...
Page 100
CP 523 Print Mode 6.7.2 Setting the Time and Date (Job Number 10 Specify: • The new settings in bytes 1 to 7 • Job number 10 in byte 0 In each case, you must transfer the settings first and the "Set clock" request last to the CP 523. Settings You must note the following as regards the settings: •...
Print Mode CP 523 6.7.4 Form Feed (Job Number "5000 ") When prompted by the CPU, the CP 523 instructs the printer to execute a form feed. A form feed is implemented by executing the number of line feeds configured (parameter block 5 "Page format": lines per page).
CP 523 Print Mode 6.7.6 Clearing the Message Buffer (Job Number "7000 ") When prompted by the CPU, the CP 523 cancels all CPU requests stored in the message buffer. Specify Job number "7000 " in word 0. Example: Clearing the message buffer with the Programmer's "FORCE VAR" function You can force a peripheral (I/O) word (PW) using the programmer "FORCE VAR"...
Print Mode CP 523 STL FB 10 Explanation Load old value FW 228 Load new value FW 128 Compare for equal :! = F Block End if equal :BEC Update old value if not equal FW 128 FW 228 FY 128 transfer flag word byte by byte PY 128 to the peripheral word...
System Overview Technical Description Hardware Installation Notes on Operation Address Assignment Print Mode Communications Mode General ........... . . 7 - 1 7.1.1 3964 and 3964R Protocols (relevant in 3964(R) mode only .
Page 105
Figures 7-1. Example of an 11-Bit Character Frame ....... . . 7 - 2 7-2.
Page 106
Tables 7-14. Transfer Memory Assignments for ”Transfer Initialization Data for Parameter Block 7” ..........7 - 30 7-15.
Page 107
CP 523 Communications Mode Communications Mode In Communications mode, the CP 523 permits transfer of a frame of up to 256 bytes between the CPU and a peripheral device connected to the CP 523 in response to a CPU job request: •...
Page 108
Communications Mode CP 523 7.1.1 3964 and 3964R Protocols (relevant in 3964(R) mode only) Protocol data The 3964 and 3964R protocols control the flow of data between your programmable controller and the partner in the communications link. The data to be transmitted must be entered in the CP 523's output buffer, and is then forwarded to the partner in the link together with the 3964 or 3964R protocol.
Page 109
CP 523 Communications Mode If the connection can be established, the useful data in the output buffer is transmitted to the partner in the link at the specified baud rate. The partner in the link monitors the interval between incoming characters, which may not exceed the character delay time (ZVZ)*. Each DLE character found in the buffer is transmitted as two DLE characters (double DLE), i.e.
Page 110
Communications Mode CP 523 Receiving When no Send request is pending in 3964(R) mode, the CP waits for the link partner to establish a connection. If the CP receives a character (other than STX) while in the idle state, it waits until the character delay time has expired (ZVZ) and then sends NAK.
Page 111
CP 523 Communications Mode If transmission errors occur during reception (characters are lost, framing error, parity error), the CP continues receiving until the connection is cleared down, transmits NAK to the link partner, and waits for a retry as described above. Example of error-free data interchange: CP 523 Partner in the link...
Page 112
Communications Mode CP 523 Initiation conflict If one partner in the link replies to a line bid (STX character) from the other link partner with STX instead of DLE or NAK, the result is an initiation conflict, i.e. both link partners want to transmit. The low-priority partner retracts its line bid and sends DLE.
Page 113
CP 523 Communications Mode Protocol Errors The protocol can detect errors caused by incorrect behaviour on the part of the link partner and errors caused by disturbances or interference on the line. In both cases, an attempt is first made to transmit or receive the message frame without error by initiating a retry.
Page 114
Communications Mode CP 523 3. Establishing connections The programmable controller must be switched off to carry out the following measures: • Install the CP 523 in the central controller or expansion unit. • Establish the connection between the CP 523 and the peripheral device. •...
Page 115
CP 523 Communications Mode Setting the CP 523 Parameters in Communications Mode The CP 523 is supplied with default values for all parameters. • Parameters for the interface to the peripheral device (baud rate, type of interface, handshake mode ...) The parameters must conform to the specifications and settings on/in the peripheral device.
Page 116
Communications Mode CP 523 7.3.1 Setting the CP 523 Parameters with the Memory Submodule You can store the parameter setting data on a memory submodule in data block (DB) 1. Note: The procedure for setting the memory submodule parameters in Communications mode is almost identical to the procedure in Print mode.
Page 117
CP 523 Communications Mode Table 7-2. Parameter Block Assignments on the Memory Submodule Param- Default Values on eter Meaning Value Range the CP 523 Block Baud rate 110 Bd 200 Bd 300 Bd 600 Bd 1200 Bd 2400 Bd 4800 Bd 9600 Bd Parity even...
Page 118
Communications Mode CP 523 Table 7-2. Parameter Block Assignments on the Memory Submodule (Continued) Mode (for memory Print mode submodule con- Transparent mode figured with Interpretive mode message texts) 3964(R) mode (no memory submodule) Parameters for Transparent mode Character delay time 0001 to 3000 0001 6 10 ms...
Page 119
CP 523 Communications Mode Table 7-2. Parameter Block Assignments on the Memory Submodule (Continued) Parameters for 3964(R) mode Character delay time (ZVZ) 00001 to 65535 (1 to 65535) ·10 ms Time-out (QVZ) 00001 to 65535 00200 (1 to 65535) ·10 ms Block delay time (BWZ) 00001 to 65535...
Page 120
Communications Mode CP 523 Explanation of data transmission parameters Baud rate You have a choice of eight baud rates. The default is 600 baud. If you are using the RS-232-C (V.24) interface, you must take the load capacitance of cables longer than 15 m/29 ft. into account. If you operate the CP 523 with the active TTY interface, cable lengths of up to 10 m/330 ft.
Page 121
CP 523 Communications Mode Hardware handshake (HW handshake) This parameter is only significant for the RS-232-C (V.24) interface. If you set HW handshaking ON, the "RTS", "CTS", "DTR" and "DSR" control signals of the RS-232-C (V.24) interface are evaluated. The XON/XOFF protocol is not possible. The default is HW handshake OFF, i.e.
Page 122
Communications Mode CP 523 Setting ”TRANSPARENT MODE” parameters via the MEMORY SUBMODULE When you want to use Transparent mode to tranfer your datas, you must enter all parameter setting data in parameter blocks 0 and 7. Table 7-3. Contents of the Parameter Blocks for Transparent Mode Param- Default Values on eter...
Page 123
CP 523 Communications Mode Example: Setting parameters on the MEMORY SUBMODULE for ”TRANSPARENT MODE” with the PG 685 Start address 128 is set on the CP 523. The module is to be operated in ”Transparent mode”. Parameters are set as follows: •...
Page 124
Communications Mode CP 523 Setting parameters for ”INTERPRETIVE MODE” via the MEMORY SUBMODULE When you have decided to transmit your data in Interpretive mode, you enter all parameter setting data in parameter blocks Table 7-5. Parameter Block Assignments for Interpretive Mode Param- Default Values Description...
Page 125
CP 523 Communications Mode Table 7-5. Parameter Block Assignments for Interpretive Mode (Continued) Mode (for memory Print mode submodule con- figured with Transparent mode message texts) Interpretive mode (no memory 3964 (R) mode submodule) Character delay time 0001 to 3000 0001 (6 10 ms) (1 to 3000) ·...
Page 126
Communications Mode CP 523 The following procedure is recommended: 1. Enter the parameter setting data on the programmer in DB 1 and include sufficient comments. 2. Store DB 1 on diskette or hard disk. 3. Transfer DB 1 to the memory submodule. Table 7-6.
Page 127
CP 523 Communications Mode Setting Parameters for ”3964(R) MODE” via the MEMORY SUBMODULE When you have decided upon 3964(R) mode, you enter your data in blocks 0 and 7. Enter your data in the same way as in the other modes. ”3964(R)” mode requires additional parameters in parameter block 7.
Page 128
Communications Mode CP 523 Table 7-7. Parameter Block Assignments for 3964(R) Mode (Continued) 0 (for memory Mode submodule con- Print mode figured with Transparent mode message texts) Interpretive mode 1 (no memory 3964(R) mode submodule) Character delay time (ZVZ) 00001 to 65535 (1 to 65535) ·10 ms Time-out (QVZ)
Page 129
CP 523 Communications Mode The following procedure is recommended: 1. Enter the initialization data in DB 1 using the programmer, and include sufficient commen- tary. 2. Store DB 1 on floppy or hard disk. 3. Transfer DB 1 to the memory submodule. Table 7-8.
Page 130
Communications Mode CP 523 Table 7-9. Transfer Memory Assignments for ”Transfer Initialization Data for Parameter Block 0” Default Values Byte Meaning Possible Values on the CP 523 Job number ”Transfer parameter setting data” Bit 4 to 7: Parameter block number Bit 0 to 3: Only significant for parameters block 7 and 9...
Page 131
Communications Mode Communications Mode Table 7-10. Transfer Memory Assignments for “Transfer Parameter Setting Data for Parameter Block 7“ 3964(R) Mode Transparent Mode Interpretive Mode 3964(R) Mode Follow-Up Request Default Default Default Default Permissible Permissible Permissible Values or Description Values on the Description Values on the Description...
CP 523 Communications Mode Transferring parameter setting data for parameter block 2 (relevant in Interpretive mode only) Table 7-11. Transfer Memory Assignments for ”Transfer Parameter Setting Data for Parameter Block 2” Default Values Byte Meaning Possible Values on the CP 523 Job number ”Transfer parameter setting data”...
Page 133
Communications Mode CP 523 Setting parameters for ”TRANSPARENT MODE” in the USER PROGRAM Transferring the parameter setting data for parameter block 0 Table 7-13. Transfer Memory Assignments for ”Transfer Parameter Setting Data for Parameter Block 0” Default Values Byte Description Possible Values on the CP 523 Job number...
Page 134
CP 523 Communications Mode Example: Transferring parameter setting data for parameter block 0 Start address 128 is set on the CP 523. You can set its parameters as follows: Parameters for the serial interface (parameter block 0) • 2400 baud •...
Page 135
Communications Mode CP 523 Transferring parameter setting data for parameter block 7 Table 7-14. Transfer Memory Assignments for ”Transfer Initialization Data for Parameter Block 7” Default Values Byte Meaning Possible Values on the CP 523 Job number ”Transfer parameter setting data” Bits 4 to 7: Parameter block number Bits 0 to 3: Mode 0: If a memory sub-...
Page 136
CP 523 Communications Mode Example: Transferring the parameter setting data for parameter block 7 Start address 128 is set on the CP 523. The module is to be operated in Transparent mode. The message frames to be transferred have a length of 6 bytes. An end-of-text character is not required.
Page 137
Communications Mode CP 523 Setting parameters for INTERPRETIVE MODE in the USER PROGRAM Transferring the parameter setting data for parameter block 0 Table 7-15. Transfer Memory Assignment for ”Transfer Parameter Setting Data for Parameter Block 0” Default Values Byte Description Possible Values on the CP 523 Job number...
Page 138
CP 523 Communications Mode Example: Transferring parameter setting data for parameter block 0 Start address 128 is set on the CP 523. Set CP parameters as follows: Parameters for the serial interface (parameter block 0) • 2400 baud • Even parity •...
Page 139
Communications Mode CP 523 Transferring parameter setting data for parameter block 2 Table 7-16. Transfer Memory Assignments for ”Transfer Parameter Setting Data for Parameter Block 2” Default Values Byte Description Possible Values on the CP 523 Job number ”Transfer parameter setting data” Bits 4 to 7: Parameter block number Bits 0 to 3: Relevant for parameter blocks 7 and 9 only...
Page 140
CP 523 Communications Mode Example: Transferring parameter setting data for parameter block 2 STL OB 22 STL FB 113 Explanation Load ASCII codes for XON and XOFF NAME :BLOCK2 character into ACCUM 1, transfer to CP NAME :SYNC** KH 1113 in bytes 2 and 3.
Page 141
Communications Mode CP 523 Transferring parameter setting data for parameter block 7 Table 7-17. Transfer Memory Assignments for ”Transfer Parameter Setting Data for Parameter Block 7” Default Values Byte Description Possible Values on the CP 523 Job number ”Transfer parameter setting” Bits 4 to 7: Parameter block number Bits 0 to 3: Mode 0: when memory...
Page 142
CP 523 Communications Mode Example: Transferring parameter setting data for parameter block 7 Start address 128 is set on the CP 523. The module is to be operated in Interpretive mode. The message frames to be transmitted have different lengths; the end of the message frame is therefore signalled with 0D0D (0D0D =two carriage returns).
Page 143
Communications Mode CP 523 Setting parameters for the 3964(R) MODE in the USER PROGRAM Transferring the parameter setting data for parameter block 0 Table 7-18. Transfer Memory Assignments for ”Transfer Parameter Setting Data for Parameter Block 0” Default Values Byte Description Possible Values on the CP 523...
Page 144
CP 523 Communications Mode Example: Transferring parameter setting data for parameter block 0 Start address 128 is set on the CP 523. Set CP parameters as follows: Parameters for the serial interface (parameter block 0) • 2400 baud • Even parity •...
Page 145
Communications Mode CP 523 Transfer parameter setting data for parameter block 7 Table 7-19. Transfer Memory Assignments for Job Number ”9073 ” Default Values Byte Description Possible Values on the CP 523 Job number ”Transfer initialization data” Bits 4 to 7: Parameter block number Bits 0 to 3: Mode 0: Memory Print mode...
Page 146
CP 523 Communications Mode Example: Transferring parameter setting data for parameter block 7 Start address 128 is set on the CP 523. Set the parameters as follows in ”3964(R) mode”: • Message frame delay time: 4000 ms • Time-out: 2000 ms •...
Page 147
Communications Mode CP 523 Transfer parameter setting data for parameter block 9 Default Values Byte Description Possible Values on the CP 523 Job number ”Transfer parameter setting data” Bits 4 to 7: Parameter block number Bits 0 to 3: Sign for correction value positive 1 negative Correction value (s/month)
Page 148
CP 523 Communications Mode CP 523 Feedback Information The CP 523 has an eight-byte transfer memory for data exchange with the CPU. The CP 523 reads the data from the transfer memory and updates the transfer memory with current values only when the start address of the module has been written into word 0 of the transfer memory with T PW in the user program.
Page 149
Communications Mode CP 523 7.4.1 Reading the Status Byte, the Status of the Peripheral Device and the Current Clock Data As soon as job request 0000 has been transferred to the CP, the CP writes the following into the transfer memory: •...
Page 150
CP 523 Communications Mode Table 7-23. Status Byte (Byte 0) in Communications Mode Following ”Coordinate Data Transfer” Byte 0 Status Bits 4 to 7 Bits 0 to 3 No error Memory submodule defective Entries in job buffer (init. requests only) No battery backup Job buffer full (init.
Page 151
Communications Mode CP 523 Example: Evaluating the status of the peripheral device Start address 128 is set on the module. If the peripheral device is not ready for operation, output 4.1 is set. STL FB 118 Explanation NAME :ERROR3 Transfer nonrelevant data to the CP. The CP then updates the KH 0000 transfer memory with the current data.
Page 152
CP 523 Communications Mode 7.4.2 Reading Coordination Information after "Coordinate Data Transfer" As soon as the "Coordinate data transfer" request has been transferred to the CP, the CP 523 writes coordination information into bytes 1 to 7 of the transfer memory. This information can be read out with load operations.
Page 153
Communications Mode CP 523 Table 7-25. Status Byte (Byte 0) in Communications Mode after ”Coordinate Data Transfer” Byte 0 Status Bits 4 to 7 Bits 0 to 3 Character delay time exceeded Parity error Receive after XOFF or after DTR = 0 Frame exceeds 256 bytes Continuous break in line to I/O device Receive mailbox overflow...
Page 154
CP 523 Communications Mode Message frames exceeding 256 bytes (5C The peripheral device has sent a message frame that is longer than 256 bytes. The CP flags error 5C if it has not detected an end-of-text character after receiving 256 characters.
Page 155
Communications Mode CP 523 Example: Reading coordination information after "Send message frame" Start address 128 is set on the CP 523. A four-byte message frame is to be sent. The message frame is stored in DB 20 in DW 0. Flag 100.3 is to be set if the CP 523 accepts the job. The program does not describe how F100.3 is reset.
Page 156
CP 523 Communications Mode Example: Reading coordination information after "Receive message frame" Start address 128 is set on the CP 523. If the CP has received message frames from the peripheral device, these are to be transferred to the CPU. The message frames transferred from the peripheral device have a fixed length of four bytes.
Page 157
Communications Mode CP 523 Special features of ”3964(R) mode” In ”3964 R” mode, you receive different return info after submitting a ”Coordinate data transfer” request than you receive in Transparent or Interpretive mode. The return info for ”3964(R) mode” is presented separately in the following. In ”3964R”...
Page 158
CP 523 Communications Mode Table 7-27. Status Information for Send Request ”A001 ” Byte Description Possible Values Status byte Send request accepted Send request rejected Coordination byte 'send' (CBS) Table 7-30 3 - 5 Not significant Number of message blocks in Send message frame to 20 Number of message frames in Receive mailbox to 64...
Page 159
Communications Mode CP 523 All information presented in the next three tables (7-29, 7-30, 7-31) is relevant in 3964(R) mode only. Table 7-29. Return Info and Error Flags in the Coordination Byte 'Send' (CBS) in ”3964(R)” Mode Description Response 5 4 3 2 1 0 Return info for A000 Send buffer free Send buffer not free...
Page 160
CP 523 Communications Mode Table 7-29. Return Info and Error Flags in the Coordination Byte 'Send' (CBS) in ”3964(R)” Mode (Continued) Error flags for A000 and A001 Negative acknowledgement from receiver Receive data invalid to connection cleardown attempt Negative acknowledgement from receiver Receive data invalid to connection buildup attempt Parameter error...
Page 161
Communications Mode CP 523 Table 7-30. Return Info and Error Flags in the Coordination Byte 'Receive' (CBR) in ”3964(R) Mode” Description Response 5 4 3 2 1 0 Return info for A080 Request accepted No message frame to fetch Error flags for A080 Parity error Data rejected Frame length 0...
Page 162
CP 523 Communications Mode When several errors occur simultaneously, the error codes are output in the priority shown below: Table 7-31. Error Priority in ”3964(R) Mode” Error Code Description Priority High Message frame too long Break Input buffer full Too many message frames Message frame time-out DLE error STX error...
Communications Mode CP 523 Overview of Permissible Job Requests in Communications Mode Data exchange between the CPU and the CP 523 is always initiated by a job request from the CPU. The CPU transfers the job request to the CP 523 in word 0. The job number is stored in byte 0. Table 7-32.
Page 164
CP 523 Communications Mode Illegal job requests in Communications mode If you write a job request into word 0 of the transfer memory other than one of those listed above, the CP flags "Illegal job request" error 4X in the status byte. The "Print all message texts"...
Page 165
Communications Mode CP 523 Sending Message Frames to a Peripheral Device (Job Number A001 The CPU can forward up to 256 bytes to the CP 523 with one Send request. This data is referred to as a message frame in the following. Schematic for ”...
Page 166
CP 523 Communications Mode START CPU transfers message frame length or end- of-text character to the transfer memory on the CP (words 2 and 4) CPU transfers the "Send message frame" request to the transfer memory of the CP (word 0*) CPU reads the transfer memory and evaluates the coordination bytes (bytes 0 and 1) Has the...
Page 167
Communications Mode CP 523 CPU user program CP functions CPU issues the "Send message frame" request Word 0 Word 2 Word 4 Word 6 job No. Send length End-of-text - reads job number from A001 in bytes character significant transfer memory - writes coordination information into the transfer memory...
Page 168
CP 523 Communications Mode Message frame structure A message frame consists of all the data transferred in response to a Send or Receive request. In the case of the CP 523, a message frame can be up to 256 bytes long. The CPU sends and receives a message frame in message blocks of eight bytes.
Page 169
Communications Mode CP 523 7.6.1 Sending Message Frames with the Message Frame Length Specification You specify the message frame length in bytes with the Send request in word 2. Note: The length of the message frame sent by the CPU can vary from the length configured in parameter block 7 ( 7.3).
Page 170
CP 523 Communications Mode Example: Sending a message frame with a length of 12 bytes Start address 128 is set on the CP. The message frame is stored in data block 20 beginning from DW 0. Flag 100.0 is set if the CP has accepted the job. The STL does not describe how F 100.0 is to be reset.
Page 171
Communications Mode CP 523 7.6.2 Sending Message Frames with End-of-Text Character Specification Specify one or two end-of-text characters with the Send request in word 4. The CP detects the end of a message frame autonomously through these end-of-text characters. Note: The end-of-text characters of the message frame sent by the CPU may differ from the end-of- text characters configured in parameter block 7 ( 7.3).
Page 172
CP 523 Communications Mode START Permission to send? End-of- text character flag set? Prepare to transfer message block DW=end-of- text character? Set end-of- text character flag Transfer word to CP Last word of the message block? Prepare transfer of next word Figure 7-11.
Page 173
Communications Mode CP 523 FB 123 LEN=103 Segment 1 0000 NAME :SEND 3 :BADR I/Q/D/B/T/C: D KM/KH/KY/KC/KF/KT/KZ/KG: KF :ENZE I/Q/D/B/T/C: D KM/KH/KY/KC/KF/KT/KZ/KG: KH STL FB 123 Explanation Open source data block. Has a message frame been sent? 100.1 If yes, Block End. =M001 Load module start address, =BADR...
Page 174
CP 523 Communications Mode STL FB 123 Explanation If end-of-text character flag set, M003 100.2 block end. =M001 Load data word pointer, FW 242 increment by 4 :ADD KF +4 and store. FW 242 Load auxiliary data word pointer, FW 244 increment by 4 :ADD KF +4 and store.
Page 175
Communications Mode CP 523 7.6.3 Sending Message Frames with 3964(R) Protocol In principle, data transfers between the CPU and the CP 523 are handled the same way as in Transparent mode. The additional return information about the protocol itself is entered in a so- called coordination byte (CBS, CBR).
Page 176
CP 523 Communications Mode Example: Sending a 12-byte message frame with 3964(R) protocol Base address 128 is set on the CP. The message frame is in data block 20 beginning data word DW 0. Flag 100.0 is set when the CP has accepted the Send request. The statement list does not show how or when this flag is reset.
Page 177
Communications Mode CP 523 Receiving a Message Frame from a Peripheral Device (A080 The CPU can receive up to 256 bytes with a single job request. This data is referred to as a message frame in the following. Peripheral S5-CPU CP 523 device Serial...
Page 178
CP 523 Communications Mode START CPU forwards a "Receive message" request to CP's transfer memory (word 0*) CPU reads transfer memory and evaluates coordination information and coordination byte (word 0). Is a message frame in the Receive mailbox? (bit 7 in byte 1= 1) CPU writes word 0 CP transfers data from Receive mailbox to transfer memory...
Page 179
Communications Mode CP 523 CPU user program CP functions CPU issues "Receive message" request Word 0 Word 2 Word 4 Word 6 CP reads job request from Job No. transfer memory and writes A080 significant significant significant coordination information into transfer memory CPU reads coordination information Word 2 Word 0...
Page 180
CP 523 Communications Mode Message frame structure A message frame is defined as all data transferred after a Send or Receive request. A message frame can be up to 256 bytes in length in the case of the CP 523. The CPU sends and receives message frames in message blocks of eight bytes.
Page 181
Communications Mode CP 523 7.7.1 Receiving Message Frames with Evaluation of the Specified Message Frame Length You can receive a fixed-length message frame from the CP with a Receive request. Prerequisites • You must specify the fixed length in parameter block 7 when initializing the CP 523. •...
Page 182
CP 523 Communications Mode Example: Receiving a message frame with a length of 12 bytes Start address 128 is set on the module. The message frame is to be stored in data block 21 beginning DW0. Flag 101.0 is to be set if a message frame is in DB 21. The STL does not explain how flag 101.0 is reset.
Page 183
Communications Mode CP 523 7.7.2 Receiving Message Frames with Evaluation of the Specified End-of-Text Characters After a Receive request, you can receive a message frame from the CP which ends with end-of-text characters. The CP checks the end-of-text characters. You can evaluate the receive data in the user program.
Page 184
CP 523 Communications Mode START Prepare to receive message block Read word from the transfer memory Word=end-of- text character? Store word in DB Store word in DB Prepare Last word of the transfer of message block? next word Prepare transfer of next message block...
Page 185
Communications Mode CP 523 FB 126 LEN=85 NETWORK 1 0000 NAME :RECEIVE4 :BADR I/Q/D/B/T/C: D KM/KH/KY/KC/KF/KT/KZ/KG: KF :ENZE I/Q/D/B/T/C: D KM/KH/KY/KC/KF/KT/KZ/KG: KH STL FB 126 Explanation Open target data block. Message frame in DB? M001 101.1 If yes, then Block End. =M001 Load and store =BADR...
Page 186
CP 523 Communications Mode STL FB 126 Explanation Store data bytes FW 232 in destination DB. Block End if 101.2 end-of-text character detected. =M001 Has the message block FW 232 been completely transferred? FW 234 If no, read in two further :><F data bytes.
Page 187
Communications Mode CP 523 7.7.3 Receiving Message Frames with 3964(R) Protocol Basically, data transfers between the CPU and the CP 523 are handled the same way as in Transparent mode. The additional return information pertaining to the itself is entered in a coordination byte (CBS, CBR).
Page 188
CP 523 Communications Mode Example: Receiving a 12-byte message frame with 3964(R) protocol Base address 128 is set on the CP. The message frame is to be stored in data block 21 beginning DW 0. Flag 101.0 is to be set as soon as a message frame is entered in data block 21. The statement list does not explain how or when flag 101.0 is reset.
Page 189
System Overview Technical Description Hardware Installation Notes on Operation Address Assignment Print Mode Communications Mode Using the ”SEND” and ”RECEIVE” Function Blocks Using "SEND" FB 200 ......... 8 - 1 8.1.1 Calling "SEND"...
Page 190
Figures 8-1. Structure of the "STAT" Status Byte ........8 - 4 8-2.
Page 191
CP 523 Using the ”SEND” and ”Receive” Function Blocks Using the "SEND" and "RECEIVE" Function Blocks The "SEND" and "RECEIVE" function blocks, FB 200 and FB 201, offer you a user-friendly interface which considerably simplifies use of "Send message frame to peripheral device" job (A001 ) and "Receive message frame from peripheral device"...
Page 192
Using the ”SEND” and ”Receive” Function Blocks CP 523 8.1.1 Calling "SEND" FB 200 "SEND" FB 200 can be called in cyclic programs and in programs servicing timed interrupts and process interrupts. LAD / CSF FB 200 : JU FB 200 NAME : SEND BADR...
Page 193
CP 523 Using the ”SEND” and ”Receive” Function Blocks 8.1.2 Setting ”SEND” FB 200 Parameters If you want to send a message frame of specific size, specify the length of the message frame to be sent (in words) in the QLAE parameter. The "ENDZ" parameter is not significant here. In 3964(R) mode, the message frame size must be specified.
Page 194
Using the ”SEND” and ”Receive” Function Blocks CP 523 8.1.3 Structure of the Status Byte The status bytes of "SEND" FB 200 and "RECEIVE" FB 201 are identical. The status byte gives information on whether • Receive data is available (bit 0 = 1) •...
Page 195
CP 523 Using the ”SEND” and ”Receive” Function Blocks 8.1.4 Schematic of the Principle of Operation of ”SEND” FB 200 Note: This section is intended merely to explain the method of operation of "SEND" FB 200. You do not require this information to use the "SEND" FB 200. FB 200 services the Send request according to the following schematic: Read status of the CP 523 Segment 2...
Page 196
Using the ”SEND” and ”Receive” Function Blocks CP 523 8.1.5 Flowchart of "SEND" FB 200 Evaluate RLO and read status SEGMENT 2 START Note "RLO at jump" Transfer "Read STATUS" request to CP 523 Read job request acknowledgement from CP 523 Read CBS (when 3964(R) mode) Display CP 523 - STATUS Display CBS (when 3964(R) mode)
Page 197
CP 523 Using the ”SEND” and ”Receive” Function Blocks SEGMENT 3 Checking the ”SEND” FB parameters Q-DB available? Calculate Q-DB length QANF ok? QLAE > ENDZ > 0 QLAE > Q-DB length>= QANF+QLAE Output error message EWA 4NEB 811 6044-02a...
Page 198
Using the ”SEND” and ”Receive” Function Blocks CP 523 SEGMENT 4 Calculating the "Number of Send frames" Establish "SEND" connection to the CP 523 SEGMENT 5 Transfer send length to the CP Transfer end-of-text character to the CP Transfer "SEND" ID to the CP Evaluate job acknowledgement SEGMENT 6 from CP 523...
Page 199
CP 523 Using the ”SEND” and ”Receive” Function Blocks SEGMENT 7 Transferring Send data to the CP 523 Is data to be sent in fixed-length message frames? Set pointer to start of message block Calculate message frame remainder register Transfer data word Prepare transfer of next Decrement message block number by 1 to CP...
Page 200
Using the ”SEND” and ”Receive” Function Blocks CP 523 8.1.6 Flags in "SEND" FB 200 Explanation of the flags used by "SEND" FB: Flags Symbol Meaning Auxiliary flag for buffering the 255.0 H-FLAG-1 RLO at jump 254.0 H-FLAG-2 Auxiliary flag for STAT bit "SEND executing" Auxiliary flag for detecting end-of-text 237.0 H-FLAG-3...
Page 201
CP 523 Using the ”SEND” and ”Receive” Function Blocks FB 200 LEN=371 Segment 1 0000 NAME :SEND :BADR I/Q/D/B/T/C: D KM/KH/KY/KC/KF/KT/KZ/KG: KF :Q-DB I/Q/D/B/T/C: B :QANF I/Q/D/B/T/C: D KM/KH/KY/KC/KF/KT/KZ/KG: KF :QLAE I/Q/D/B/T/C: I BI/BY/W/D: BY :ENDZ I/Q/D/B/T/C: D KM/KH/KY/KC/KF/KT/KZ/KG: KH :STAT I/Q/D/B/T/C: Q BI/BY/W/D: BY...
Page 202
Using the ”SEND” and ”Receive” Function Blocks CP 523 STL FB 200 Explanation no computer link 003F =RKPL 0040 =NORK Set pointer to base 0041 FW 242 address + 2 (byte 2 = CBS 0042 for computer link) 0043 FW 242 0044 Read CBS (when computer link) 0045...
Page 203
CP 523 Using the ”SEND” and ”Receive” Function Blocks STL FB 200 Explanation Segment 3 006F Check whether Q DB available 006F Load Q DB parameter 0070 =Q-DB Isolate DB number from 0071 :SLW Q DB parameter 0072 :SRW 0073 Calculate start address 0074 KH E400...
Page 204
Using the ”SEND” and ”Receive” Function Blocks CP 523 STL FB 200 Explanation 009F KB 128 00A0 :>F " E R R O R " 00A1 =FE03 00A2 Check to make sure that 00A3 QANF+QLAE not > Q-DB length 00A4 =QANF 00A5 =QLAE...
Page 205
CP 523 Using the ”SEND” and ”Receive” Function Blocks STL FB 200 Explanation 00CA Set pointer to base address 00CB FW 242 of the CP 523 00CC and store 00CD FW 242 00CE 00CF Write KOOR ID "SEND" 00D0 KH 00A0 to word 0 00D2 FW 242...
Page 206
Using the ”SEND” and ”Receive” Function Blocks CP 523 STL FB 200 Explanation 00F7 00F8 Error in status byte 00F9 00FA 00FB :!= F ”N O E R R O R” 00FC :JC = NEIN 00FD Set error flag for STAT 00FE 254.3 00FF...
Page 207
CP 523 Using the ”SEND” and ”Receive” Function Blocks STL FB 200 Explanation 0126 =QLAE 0127 KH 0000 0129 :>F Jump to Send with fixed length 012A =TELE 012B 012C 012D ***************************************** SEND WITH END-OF-TEXT CHARACTERS 012E 012F ***************************************** 0130 BLOC : Increment QANF register by 3 0131 FW 244...
Page 208
Using the ”SEND” and ”Receive” Function Blocks CP 523 STL FB 200 Explanation transferred? 0156 FW 242 0157 :><F ”Preparations” for next message block 0158 =VORB 0159 Did this message block contain the end- 015A F 237.0 of-text character?->”END” 015B =END 015C Increment QANF register by 1...
Page 209
CP 523 Using the ”SEND” and ”Receive” Function Blocks STL FB 200 Explanations and store 0185 FW 240 0186 Is the message block to be transferred 0187 KB 0 the last subframe? 0188 :!=F ”LAST MESSAGE BLOCK” 0189 =LBLO 018A Increment QANF register by 3 018B FW 244...
Page 210
Using the ”SEND” and ”Receive” Function Blocks CP 523 STL FB 200 Explanations and forward to CP 01B4 Decrement pointer 01B5 FW 250 01B6 01B7 FW 250 01B8 Last word of message block 01B9 FW 250 forwarded? 01BA FW 242 01BB :><F ”NEXT ADDRESS”...
Page 211
CP 523 Using the ”SEND” and ”Receive” Function Blocks Using "RECEIVE" FB 201 "RECEIVE" FB 201 transfers message frames from the CP 523 to the CPU. You must specify the following when calling "RECEIVE" FB 201: • The start address of the CP 523 •...
Page 212
Using the ”SEND” and ”RECEIVE” Function Blocks CP 523 8.2.2 Structure of the Status Byte The status bytes for "SEND" FB 200 and "RECEIVE" FB 201 are identical. The status byte contains information about whether: • Receive data is available (bit 0 = 1) •...
Page 213
CP 523 Using the ”SEND” and ”RECEIVE” Function Blocks The FB 201 services the Receive request according to the following schematic: Segment Read CP 523 status Data available? Segment Check the "RECEIVE" FB parameters Parameter- error? Segment Establish "RECEIVE" connection to the CP 523 Segment Read job acknowledgement from CP 523 Acknow-...
Page 214
Using the ”SEND” and ”RECEIVE” Function Blocks CP 523 8.2.4 Flowchart of "RECEIVE" FB 201 Evaluate RLO and read status Segment 2 START Buffer "RLO at jump" Issue "Read STATUS" request to CP 523 Read job acknowledgement from CP 523 Display CP 523-STATUS Display CBR (relevant only in 3964(R) mode)
Page 215
CP 523 Using the ”SEND” and ”RECEIVE” Function Blocks Segment 3 Check the "RECEIVE" FB parameters Z-DB available? Calculate Z-DB length ZANF ok? Q-DB length >= QANF + QLAE Output error message 8-25 EWA 4NEB 811 6044-02a...
Page 216
Using the ”SEND” and ”RECEIVE” Function Blocks CP 523 Establish "RECEIVE" connection to CP 523 Segment 4 Transfer "Receive" ID to the CP Evaluate job acknowledgement from CP 523 Segment 5 Read acknowledgement from CP Acknowledge with error? Output error message 8-26 EWA 4NEB 811 6044-02a...
Page 217
CP 523 Using the ”SEND” and ”RECEIVE” Function Blocks Fetch Receive data from CP 523 Segment 6 Buffer number of message blocks given in acknowledgement and process Buffer message frame length given in acknowledgement and process Calculate the number of words in the last message block Further program preparations Access word 0 on CP...
Page 218
Using the ”SEND” and ”RECEIVE” Function Blocks CP 523 8.2.5 Flags in "RECEIVE" FB 201 Explanation of the flags used by "RECEIVE" FB 201: Table 8-4. Overview of the Flags Used by "RECEIVE" FB 201 Flag Symbol Meaning Auxiliary flag for buffering the RLO at jump 255.0 H-FLAG-1 Auxiliary flag for STAT bit "Data available"...
Page 219
CP 523 Using the ”SEND” and ”RECEIVE” Function Blocks FB 201 LEN=374 Segment 1 0000 NAME :EMPFANG :BADR I/Q/D/B/T/C: D KM/KH/KY/KC/KF/KT/KZ/KG: KF :Z-DB I/Q/D/B/T/C: B :ZANF I/Q/D/B/T/C: D KM/KH/KY/KC/KF/KT/KZ/KG: KF :ZLAE I/Q/D/B/T/C: Q BI/BY/W/D: BY :STAT I/Q/D/B/T/C: Q BI/BY/W/D: BY :KBE I/Q/D/B/T/C: Q BI/BY/W/D: BY...
Page 220
Using the ”SEND” and ”RECEIVE” Function Blocks CP 523 STL FB 201 Explanations 0039 =NEIN Load STAT bit ”Data available” and 003A jump to 'output STAT' 003B KH 0001 003D =STAT STAT bit ”No data” 003E NEIN : 003F KH 0000 Output STAT bit 0041 STAT : 0042...
Page 221
CP 523 Using the ”SEND” and ”RECEIVE” Function Blocks STL FB 201 Explanations 0069 ZANF greater than 255? 006A :TAK 006B KB 255 006C :>F ”E R R O R” 006D =FE04 006E ZANF >Z-DB length? 006F :TAK 0070 FW 232 0071 :<=F ”N O”...
Page 222
Using the ”SEND” and ”RECEIVE” Function Blocks CP 523 STL FB 201 Explanations Read byte 1 (acknowledgement or 0092 FW 242 CBR when computer link) 0093 and output 0094 =KBE or buffer 0095 FY 246 0096 Set pointer back to 0097 FW 242 module base address...
Page 223
CP 523 Using the ”SEND” and ”RECEIVE” Function Blocks STL FB 201 Explanations 00C0 Set pointer to base 00C1 FW 242 address +6 (byte 6) 00C2 00C3 FW 242 00C4 Read no. of message blocks in 00C5 FW 242 Receive message frame from the CP, 00C6 decrement by 1, 00C7...
Page 224
Using the ”SEND” and ”RECEIVE” Function Blocks CP 523 STL FB 201 Explanations Open destination DB 00EE =Z-DB 00EF (Retrigger scan time) 00F0 NBLO :JU OB 31* Access word 0 on CP 523 00F1 KH 0000 for transferring a message block 00F3 FW 242 00F4...
Page 225
CP 523 Using the ”SEND” and ”RECEIVE” Function Blocks STL FB 201 Explanations 011E 011F =END 0120 0121 KEND : Increment ZLAE register by 1 0122 FW 230 0123 :ADD KF +1 and store 0125 FW 230 0126 Increment ZANF register by 1 0127 FW 236 0128...
Page 226
Using the ”SEND” and ”RECEIVE” Function Blocks CP 523 STL FB 201 Explanations 0150 JUM1 : Last word of the message block 0151 FW 242 read? 0152 :ADD KF +6 0154 FW 234 0155 :!=F ”Y E S” 0156 =LWOR 0157 Increment BADR index register by 2 0158...
Page 227
CP 523 Using the ”SEND” and ”RECEIVE” Function Blocks 8.2.6 Execution Times for FB 200 and 201 Table 8-5. Execution Times for FB 200 and 201 (in ms) 12 Bytes 12 Bytes 12 Bytes 256 Bytes 256 Bytes 256 Bytes RLO = 0 Fixed Mess.
Page 228
....A - 13 Combinations of the Most Important Parameters ....A - 16 Siemens Addresses Worldwide EWA 4NEB 811 6044-02a...
Page 229
Tables A-1. Parameter Setting Data for Print Mode ....... A - 1 A-2.
Page 230
CP 523 Summary Summary Parameter Setting in Print Mode Table A-1. Parameter Setting Data for Print Mode ( 6.3) Param. Value Default Value Description Block Range on the CP 523 Baud rate 110 baud 200 baud 300 baud 600 baud 1200 baud 2400 baud 4800 baud...
Page 231
Summary CP 523 Table A-1. Parameter Setting Data for Print Mode (Continued) Date and time of day display Any combination of year, Order for date month and day is permissible = Year = Month T,D = Day Separator for date ASCII character (20 to 7F ”.”...
Page 232
CP 523 Summary Job Requests in Print Mode Table A-2. Permissible Job Requests to the CP 523 in Print Mode (CPU to CP) ( 6.7) Byte 0 Byte 1 Job Request Read status byte, status of the printer and current clock data Message text number Print message text with CR/LF at end Day of the week...
Page 233
Summary CP 523 "Print message text" ( 6.7.1) Table A-3. Transferring Additional Information for "Print Message Text" (CPU to CP) Word Meaning Assignment (Byte) Value of the variable 0000 to FFFF (2+3) (dependent on the configured data format) number of the message text to be inserted 0000 to 0FFF Value of the variable...
Page 234
CP 523 Summary Feedback Information in Print Mode Table A-5. Status of the Module in Print Mode (Byte 0) ( 6.6) Byte 0 Status Detailed Explanation Bits 4 to 7 0 to 3 No error Job buffer empty Defective memory submodule No texts configured No message texts configured on the memory...
Page 235
Summary CP 523 Table A-6. Status of the Printer, Date and Time of Day Byte Value Range Meaning to 07 Bits 0 to 3 : 1=Sunday, 2=Monday, 3=Tuesday, to 17 4=Wednesday, 5=Thursday, 6=Friday, 7=Saturday Bit 4=0 Printer ready Bit 4=1 Printer not ready to 31 to 12...
Page 236
CP 523 Summary Setting Parameters in Communications Mode • Setting parameters via the memory submodule: Enter the data in DB 1 ( 7.3.1) • Setting parameters via the user program: "Transfer parameter setting data for parameter block X" ( 7.3.2) Table A-7.
Page 238
CP 523 Summary Job Requests in Communications Mode Table A-8. Permissible Job Requests to the CP 523 in Communications Mode Byte 0 Byte 1 Job Request Read status byte, status of the peripheral device and current clock data Set clock (settings in bytes 1 to 7) Day of the week setting Transfer parameter setting data...
Page 239
Summary CP 523 "Send fixed-length message frame" or send with 3964(R) ( 7.6.1) Table A-9. Transfer Memory Assignments for ”Send Fixed-Length Message Frame" (CPU to CP) Byte Meaning Value Range Job number for "Coordinate data transfer" "Send message frame" identifier Send length in bytes 0001 to 0100...
Page 240
CP 523 Summary Feedback Information in Communications Modes 1 and 2 Table A-12. Coordination Information for "Coordinate Data Transfer" (CP to CPU) ( 7.4) Byte Meaning Possible Values Status byte Permission to send and receive CPU can neither send nor receive CPU can send CPU can receive CPU can send and receive...
Page 241
Summary CP 523 Table A-14. Status Byte in Communications Mode (CP to CPU) ( 7.4) Byte 0 Status Bits 4 to 7 Bits 0 to 3 No error No memory submodule Entries in job buffer (for parameter setting requests only) No battery backup Job buffer full (for parameter setting requests only) CP restart in progress...
Page 242
CP 523 Summary Feedback Information in Communications Mode 3 Table A-15. Status Info from the CP 523 for Job Number ”A000 ” Possible Byte Description Values Status byte Permission to send and receive CPU can neither send nor receive CPU can send CPU can receive CPU can send and receive Coordination byte 'send' (CBS)
Page 243
Summary CP 523 Table A-18. Return Info and Error Flags in the Coordination Byte 'Send' (CBS) in 3964(R) Mode Description Response 5 4 3 2 1 0 Return info for job request A000 Send buffer free Send buffer not free Return info for job request A001 The info returned in the CBS following issue of Send request A000...
Page 244
CP 523 Summary Table A-19. Return Info and Error Flags in the Coordination Byte 'Receive' (CBR) in 3964(R) Mode Description Response 5 4 3 2 1 0 Return info for job request A080 Request accepted No frame to fetch Error flagged for A080 Parity error Data is rejected Message frame length 0...
Page 246
System Overview Technical Description Hardware Installation Notes on Operation Address Assignment Print Mode Communications Mode Using the ”SEND” and ”RECEIVE” Function Block Summary Siemens Addresses Worldwide EWA 4NEB 811 6044-02a...
Page 247
Federal Republic Ireland Siemens AG Österreich of Germany (continued) Siemens Ltd. Vienna Hanover Dublin Bregenz Cologne Graz Mannheim Italy Innsbruck Munich Siemens S. p. A. Klagenfurt Nuremberg Milan Linz Saarbrücken Bari Salzburg Stuttgart Bologna Brescia Belgium Finland Casoria Siemens S.A.
Page 248
SIEMENS Addresses Worldwide CP 523 Romania Switzerland USSR Siemens birou de Siemens-Albis AG Siemens AG Agency consulta ii tehnice Zürich Moscow Bukarest Bern Siemens-Albis S.A. Yugoslavia Spain Lausanne, Renens General Export Siemens S.A. OOUR Zastupstvo Madrid Turkey Belgrade ETMA Ljubljana...
Page 249
CP 523 SIEMENS Addresses Worldwide Sudan Brazil Honduras National Electrical & Siemens S.A. Representaciones Electro- Commercial Company São Paulo industriales S. de R.L. (NECC) Belém Tegucigalpa Khartoum Belo Horizonte Brasília Mexico Swaziland Campinas Siemens S.A. Siemens (Pty.) Ltd. Curitiba México, D.F.
Page 250
Electro Mechanical Co. Iraq Peshawer Abu Dhabi Samhiry Bros. Co. (W.L.L.) Quetta Baghdad Rawalpindi Siemens Resident Engineer Abu Dhabi Siemens AG (Iraq Branch) People's Republic of China Scientechnic Baghdad Siemens Represen- Dubai tative Office Japan Beijing Siemens Resident Engineer Siemens K.K.
Page 251
CP 523 SIEMENS Addresses Worldwide Asia (continued) Yemen (Arab Republic) Tihama Tractors & Engineering Co.o., Ltd. Sanaa Siemens Resident Engineer Sanaa Australasia Australia Siemens Ltd. Melbourne Brisbane Perth Sydney New Zealand Siemens Liaison Office Auckland EWA 4NEB 811 6044-02a...
Page 252
System Overview Technical Description Hardware Installation Notes on Operation Address Assignment Print Mode Communications Mode Using the ”SEND” and ”RECEIVE” Function Blocks Appendix Siemens Worldwide Index EWA 4NEB 811 6044-02a...
Page 253
CP 523 Index Index Configuration data 2-10, 6-7 Accuracy of the real-time clock 2-11 - for entering message texts Addressing - for message text printout 6-3, 6-8 ASCII character Configuring - message text 6-16 - message texts on the memory submodule 6-41 Configuring footers...
Page 255
CP 523 Index Module Processing - functioning - job requests 6-30 - plug in Protocol - status 6-30, 6-34, 6-35 - 3964 - unplug - 3964R Protocol error Operating modes - change Reading clock data 6-37 Output Reading coordination information 7-47, 7-51 - message text 6-1, 6-43...
Page 256
Index CP 523 Spaceholder 6-7, 6-16, 6-18 - for control parameters 6-20 XOFF - for date 6-19 - receive 7-48 - entering 6-42 XON / XOFF character 7-15 - inserting 6-17 XON / XOFF protocol 2-6, 2-7, 6-7, 7-11, - for message texts 6-19 7-15 - for time of day...
Page 257
Siemens AG From ( please fill in ) AUT E1114B Name Postfach 1963 Werner-von-Siemens-Str. 50 Company/Department D-92209 Amberg Fed. Rep. of Germany Address Telephone Suggestions: Corrections: CP 523 Manual Release 3 (6ES5 998-0DD21) Have you discovered any printing errors in this manual? If so, please list them on the preprinted form.