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 Principle of Operation and Adressing Print Mode ASCII Mode ASCII Code Table Appendices Index GWA 4NEB 812 6030-02b...
Page 4
Preface CP521 Preface for the S5-1OOU The CP 521 is a powerful printer/ ASCII communications module programmable controller. To be able to make the best use of the module, you require detailed information. The performance of the S5-1 OOU is constantly being increased. For this reason, the manual of the S5- 10OU has become very large.
Page 5
CP 521 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 521. The manual can be divided into blocks according to topics.
Page 6
Introduction CP 521 • Appendix A: Summary All the information you require to operate the CP 521 has been gathered together here in list form. This is for those users who have read the manual and wish to find some brief item of information quickly. •...
Page 7
CP 521 Introduction Certain conventions were observed when writing the manual. These are explained below. • A number of abbreviations have been used. Example: Programmer (PG) • Footnotes are identified by superscripts consisting of a small digit (e.g. "1") or "*".
Page 8
Introduction CP 521 Courses Siemens provide SIMATIC 55 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 521. Topics not specific to the CP 521 however, are only briefly dealt with. You will find more detailed information in the following literature: •...
Page 9
CP 521 Introduction • Programming Primer for the SIMATIC (R) S5-100U Practical Exercises with the PG 615 Programmer Siemens AG, Berlin and Munich, 1988 Contents: Assembly and installation of the S5-100U Introduction to programming with the PG 615 Order No.:...
Page 10
CP 521 Introduction • Remarks Form The Remarks Form is provided for your comments and suggestions. If you are in the United States, please use the postage-paid form. Conventions The following conventions are used in this book and are listed for your reference. Convention Definition Example...
Page 11
Your comments and recommendations will help us to improve the quality and usefulness of our publications. Please take the first available opportunity to fill out this questionnaire and return it to Siemens. Only if you are in the United States of America should you use the postage-paid form.
Page 13
Figures 1-1. Complete Configuration: A Programmable Controller with a CP 521 and Printer ......1 - 1-2.
Page 14
CP 521 System Overview System Overview The CP 521 is a powerful and active printer / ASCII communications processor module that can be used in the S5-100U (not with CPU 100, 6ES5 100-8MA01). The module has a dedicated processor and can be operated in print mode or ASCII mode.
Page 15
Overview System In print mode, the CP 521 assumes a printer with a RS-232-C (V.24) or active TTY interface. The printout of message texts does not increase the res~onse time of the programmable controller. You can have the following printed out: Texts configured by the user on a memory submodule (data blocks 2 to 63).
Page 16
System Overview C P 5 2 1 In In ASCII mode, the CP 521 assumes a peripheral device (terminal, modem, enables you to transmit message frames between the CPU and an peripheral device connected to the CP 521. Maximum data throughput is six bytes of useful data per two program scans.
CP 521 Technical Description Technical Description Principle of operation of the CP 521 The CP 521 handles data transfer with a peripheral device autonomously. Data transfer between the CPU and the CP 521 must always be started by the CPU by sending a job request to the CP 521.
Page 20
Technical Description CP 521 Print mode The "Print message text XY" job causes the message text stored in the memory submodule under the number XY to be transferred to the printer via the serial interface. Current values of variables, time of day and date can be entered in the message text during this process.
Page 21
CP 521 Technical Description EPROM/EEPROM You can use EPROM and EEPROM memory submodules with up to 8 Kbytes. The EPROM/EEPROM is configured with the programmer. • Print mode In print mode, the paramter setting data for the serial interface and for the format of the printout is defined on the memory submodule in data block (DB) 1.
CP 521 Technical Description Serial Interface CP 521 - Peripheral Device The CP 521 is equipped with a RS-232-C (V.24) interface and a passive TTY interface. You can set the serial interface parameters in two ways: • In the user program (only significant in ASCII mode) with job 90H "Set interface parameters"...
Page 24
Technical Description CP 521 • 8 data bits: 1 start bit, 8 data bits, 1 parity bit, 1 stop bit Signal state ”1” Signal state ”0” 1 Stop Parity Start 8 Data bits X = can assume signal state 0 or 1 Figure 2-3.
CP 521 Technical Description 2.3.1 Print Mode You have a choice of three methods of transmission in print mode. Table 2-1. Methods of Transmission in Print Mode Method Line used Required parameters Para- Remarks of trans- TTY/RS-232-C meter mission (V.24) block XON/ XON characters...
Technical Description CP 521 2.3.2 ASCII 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 (handshake OFF or ON). •...
Page 27
CP 521 Technical Description RS-232-C (V.24) interface with handshake ON The RS-232-C (V.24) interface of the CP 521 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...
Page 28
Technical Description CP 521 Data transfer between the CP and peripheral devices takes place as follows: The CP 521 sets the "DTR" output after startup. This indicates that it is ready to operate and receive. Example: The CP wants to send data 1.
CP 521 Technical Description Example: Peripheral device wants to send data Peripheral device only checks the DTR line If ON: data may be sent (CP ready to receive) If OFF: Sending of data must be interrupted (CP not ready to receive) 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:...
Technical Description CP 521 Hardware Clock The CP 521 incorporates a hardware clock, which may be provided with battery backup. Sthe date (date, month, year) and the time of day (second, minute, hour) can be output with a message text on the printer. In this way, for example, the time of failure of a machine can be recorded.
CP 521 Technical Description Accessories List and Ordering Data Memory submodules (EPROM) memory submodule, 8 Kbytes 6ES5 375-0LA15 (EEPROM) memory submodule, 2 Kbytes 6ES5 375-0LC11 (EEPROM) memory submodule, 8 Kbytes 6ES5 375-0LC31 Printer connecting cable You can use the same printer connecting cable that you use for connecting the programmer (PG) to the PT printer.
CP521 Hardware Installation Hardware Installation Mechanical Assembly . The module may only be plugged in or unplugged when the PC is in the “STOP” mode. . The module may only be plugged into slots O to 7 on a bus unit (slot 7 is not permitted with the CPU 102, 6ES5 102-8MAO1 and the CPU 103, 6ES 103- .
Hardware Installation CP521 Installing module: Hook in the module at the top of the bus unit, . Swing it down onto the bus unit Press it firmly down Tighten the screw at the front. Dimension Drawing I n t e r n a l t h r e a d Standard sectional rail EN 50022-35x15 Figure 3-2.
Page 36
CP 521 Hardware Installation Pin assignment of the 25-pin subminiature D connector Ground V.24 RXD + RXD - RXD Ground + TXD Ground V.24 -TXD Shield - TXD Shield Figure 3-3. Pin Assignment of the 25-pin Subminiature D Connector Permissible cross-section of the lines used in subminiature D connections: up to 0.5 mm (20 AWG) GWA 4NEB 812 6030-02b...
Hardware Installation CP 521 Protective Measures Against Faults on the Line Please note the cable length to ensure trouble-free data transfer. TTY interface Note voltage drops along the cable and the send and receive elements of the module ( 2.2) RS-232-C (V.24) interface Cable lengths up to 15 m are not critical.
Page 38
CP 521 Hardware Installation Typical Configurations This section contains a few typical configurations for operating the CP 521 in print and ASCII mode. 3.5.1 Print mode In print mode, the CP 521 assumes a printer at the I/O interface with an RS-232-C (V.24) interface or an active TTY interface for printing message texts.
Page 39
Hardware Installation CP 521 Terminal Diagram of the TTY Interface with BUSY Line CP 521 PT 88 TTY OUT+ (10) (10) TTY In - 20 mA TTY OUT - (12) (9) TTY IN+ Shield 24 1 Shield Shield 25 TTY IN+ (6) (21) TTY OUT - TTY IN - (8) (18) TTY OUT+...
Page 40
CP 521 Hardware Installation 3.5.2 ASCII Mode The CP 521 assumes a peripheral device with an RS-232-C (V.24) or active TTY interface. Terminal diagram of the CP 521 (TTY passive) - CP 523 (TTY active) CP 521 CP 523 TTY IN+ (6) (22) 20mA TTY IN - (8)
Page 41
Hardware Installation CP 521 Terminal Diagram of the CP 521 - CP 521 (RS-232-C (V.24)) CP 521 CP 521 RS-232-C (V.24) RXD RS-232-C (V.24) TXD RS-232-C (V.24) TXD RS-232-C (V.24) RXD 2/21/23 2/21/23 GND Shield 24/25 24/25 Shield Figure 3-8. Pin Assignment: CP 521-CP 521 with Handshaking Note: If you use the RS-232-C (V.24) interface, the CP 521 cannot detect a "Permanent wire break".
Page 42
Notes on Operation Restart Characteristics ......4 - 4.1.1 Checking the Module .
CP 521 Notes on Operation Notes on Operation Restart Characteristics The CP 521 performs a restart operation when the power supply is restored (POWER ON). The restart procedure consists of • Deleting the message buffer • Checking the module ( 4.1.1) •...
Notes on Operation CP 521 4.1.2 Memory Submodule Evaluation The parameters of the serial interface and message texts specified on the module are checked here. Errors with the appropriate number in byte 0 of the PII "Module status" can be evaluated in the control program. Table 4-2.
CP 521 Notes on Operation Table 4-3. Clock Test Messages Error number Message Remedy in byte 0 Clock fault Replace module Clock set Set the correct time with the Default setting programmer "FORCE VAR" or "FORCE" function X : May have different values Behavior in Operation You must note the following if you want to modify the configuration during operation:...
Notes on Operation CP 521 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 PC stops Activated print jobs are completed. POWER OFF Activated print jobs are not continued.
CP 521 Notes on Operation 4.2.2 ASCII Mode Operation may be interrupted for various reasons in ASCII mode. The following table lists the effects of the faults. Table 4-5. Interruptions in Operation (ASCII Mode) Fault Comment Effect CPU stops Data traffic continues between CP and peripheral device.
Page 49
Principle of Operation and Addressing Monitoring of the CP 521 by the CPU ....5 - Addressing ........5.2.1 Slot Addressing .
Page 51
CP 521 Principle of Operation and Addressing Principle of Operation and Addressing This section describes how the CPU monitors the data traffic of the CP 521 and how the printer output module is addressed. Monitoring of the CP 521 by the CPU Every data interchange between the CP 521 and the CPU must be started by the CPU sending a job to the CP 521.
Page 52
Principle of Operation and Addressing CP 521 Memory sub- module Printer CP 521 Terminal device or CP 521 Figure 5-1. General Functional Description The control program controls the CP 521 via the I/O bus and evaluates its data. The I/O bus transfers 64 data bits (8 bytes) from the CPU to the CP 521 and 64 data bits (8 bytes) from the CP 521 to the CPU.
Page 53
CP 521 Principle of Operation and Addressing Addressing The CP 521 is addressed like a 4-channel analog module. Please note the following: • The module may only be plugged into slots 0 to 7 (slot 7 is not permitted with CPU 102, 6ES5 ((usw.)) and CPU 103 6ES5 ((usw.)).
Page 54
Print Mode General ..........Prerequisites for Operating in Print Mode .
CP 521 Print Mode Print Mode General The CP 521 enables the output of message texts to a printer in print mode: • Output of message texts defined by you in the memory submodule in data blocks (DB) 2 to 63. •...
Page 59
Print Mode CP 521 2. Setting the CP 521 parameters Store all parameter setting data in the memory submodule in DB 1: • Parameters for the printer interface (baud rate, type of interface, BUSY signal, ...) • Configuration data for entering message texts (function character, end-of- text character) •...
Page 60
CP 521 Print Mode 5. Startup of the CP 521 in print mode If the CP 521 has a memory submodule, it is automatically in print mode after POWER ON. If the CP 521 has no memory submodule, it is automatically in ASCII mode. Changing operating modes (during operation) You can change betwenn ”Print mode”, ”Transparent ASCII mode”...
Print Mode CP 521 Setting the CP 521 Parameters in Print Mode The CP 521 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 of the CP 521 in data block (DB) 1 •...
Page 62
CP 521 Print Mode Table 6-1. Contents of the Parameter Blocks Parameter Contents Block Number Setting the serial interface parameters: Serial interface parameters Waiting times after "CR", "LF" and "FF" XON/XOFF protocol The XON/XOFF Protocol has priority over the BUSY signal Parameter setting data for entering message texts: Text parameters Parameter setting data for message text printout:...
Page 63
Print Mode CP 521 Dividing the parameters into seven parameter blocks has the advantage that you only need to assign parameters to the block which deviates from the default values. However, this parameter block must be entered complete even if individual parameters within the block are to retain their default values.
Page 64
CP 521 Print Mode Further tips for input: • When entering text, change the data format from KS to S and vice versa in each line. • You can enter comments in addition to the parameter blocks. Schematic for entering of parameter blocks The parameter blocks can be entered in DB 1 according to the following schematic: Block separator...
Page 65
Print Mode CP 521 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. Table 6-2. Parameter Setting Data for the Serial Interface (Parameter Block 0) Block Meaning Value...
Page 66
CP 521 Print Mode Baud rates 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 capacity of cables longer than 15 m into account. Longer cables can be used in general if the baud rate is reduced.
Print Mode CP 521 Data format Characters are transmitted between the CP and the peripheral device in an 11-bit character frame. You can choose between seven and eight data bits within the character frame: • 7 data bits: 1 start bit, 7 data bits, 1 parity bit, 2 stop bits •...
CP 521 Print Mode Parameters for XON/XOFF character If you have an XON/OFF protocol, you have free choice of XON/XOFF characters. Code 11 (DC1) is reserved in ASCII code for the XON character and code 13 (DC3) for the XOFF character. You must not use the same values when initializing the XON/XOFF characters.
Print Mode CP 521 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. Table 6-5. Configuration Data for Message Text Printout (Parameter Blocks 4 to 6) Block Meaning...
Page 70
CP 521 Print Mode Page format The page format is defined by configuring of parameter blocks 5 and 6. Table 6-6. Page Format Line Page format Blank line (if page number, header or footer have been configured) Blank line (if page number, header or footer have been configured) Page No.
Page 71
Print Mode CP 521 Configuring headers and footers You can configure up to two headers and two footers. The headers and footers may contain place holders for date and time of day as well as control characters. LF, FF and CR are not evaluated. Place holders for variables and message texts are also not evaluated.
CP 521 Print Mode 6.3.4 Setting the Mode Parameters (Parameter Block 7) You can set the mode and the parameters for ASCII mode in parameter block 7. If you want to work in print mode, this parameter block is insignificant for you since the CP 521 automatically sets print mode if a memory submodule is plugged in.
Print Mode CP 521 6.3.5 Parameter Setting Example for the CP 521 in Print Mode The CP 521 is plugged into slot 7 (intitial address 120). You can set its parameters as follows: • Parameters for the serial interface (parameter block 7) - 2400 Baud - Even parity - No BUSY...
Page 74
CP 521 Print Mode DB 1 is called up on the programmer. Enter the values. Add comments to make the entries more readily understood (KS = ...). Entry on PG 685 programmer for DB 1 Explanation KS = 'Parameters for the serial'; C = 'interface';...
Print Mode CP 521 6.3.6 Parameter Setting with the PG 615 Programmer Parameters must be entered in DB 1 on the memory submodule . All parameters must be entered in ASCII code (KH = hexadecimal constant). It is advisable to use a list showing alphanumeric characters next to their ASCII codes. Chapter 8 contains an ASCII code table showing the hexadecimal value of ASCII characters.
CP 521 Print Mode Configuring Message Texts You can store up to 255 message texts in data blocks 2 to 63 on the memory submodule. Every message text may be up to 80 characters long, including variables. Memory submodule capacity must be taken into account. The message texts can be distributed over several data blocks in any sequence: •...
Page 77
Print Mode CP 521 Message text number The message text is stored in the DB under a message text number (1 to 255). If you want to print a message text, transfer the message text number and the "Print message text" job to the CP 521 in the user program ( 6.6.1). Separators After the message text number you must enter the separator ":".
Page 78
CP 521 Print Mode Example: Configuring message texts without place holders You want to store the following message texts in DB 2: Message text 4: Excess temperature Message text 5: Coolant loss Entry on the PG 685 programmer Explanation for DB 2 Message text number 4 KS = '4:Excess temperature$';...
Print Mode CP 521 6.4.2 Entering Place Holders Place holders are used for inserting the date, time of day, variables and further message texts. Some place holders can also be used in headers and footers. The headers and footers are configured on the memory submodule in data block 1, parameter block 6 ( 6.3.3).
Page 80
CP 521 Print Mode You can enter place holders in either lower or uppercase. Example: Place holders for date and time of day: ”D”, ”d”, ”T”, ”t” Place holders for variables: ”KH”, ”Kh”, ”kH”, ”kh” Transfer of data when using place holders for "Inserting variables". Transfer the values for the place holders "Insert variables"...
Print Mode CP 521 6.4.3 Place Holders for Date and Time of Day When printing out a message text the following takes place: • The place holder "D" for the date is replaced by the actual date • The place holder "T" for the time of day is replaced by the actual time. The output format of the date and the time of day can be configured.
CP 521 Print Mode 6.4.4 Place Holders for Message Text The place holder is replaced by a message text on printout. The number of the message text to be replaced is specified when the message is configured. Direct entry of the message text number "KPa" "a"...
Page 83
Print Mode CP 521 Entry on the PG 685 for DB 7 Explanation Message text number, separator, 0: KS = '70:'The following overview; message text with place holder for "Insert 12: C = 'indicates, 'KP73','; message text 73" Message text, end-of-text 22: KS = ' 'KP74' and 'KP75'.$';...
Page 84
CP 521 Print Mode Maximum length of message texts Messages may not exceed 80 characters in length. If you use place holders, the printout may be longer than 80 characters. The maximum length of the printout is 250 characters. Example: Configuring a message text with place holders for inserting message text.
Print Mode CP 521 Final printout: The following table gives an overview of the faults occurring in the press controller with downtimes, the resulting waiting times of the next press controller and average press downtimers (190 characters) 6.4.5 Place Holders for Variables If you have configured up to three dummy characters for variables in a message text, you must specify the variables in bytes 2 to 7 in the "Print message text"...
Page 86
CP 521 Print Mode Table 6-9. Data Formats for Variables Data format Value Range Number of Printed Positions Constant: Bit pattern 16 bits Constant: Hexadecimal 0000 to FFFF pattern KC/KS Constant: Alphanumeric to 7F / 20 characters KT Constant: Timebase 1.0 to 999.3 Constant: Count 0 to 999...
Page 87
Print Mode CP 521 ”KT” data format You can use data format "KT" to insert internal times/D in the message text. Load the time in BCD with L TX into the accumulator and then transfer it to the CP. The four places are given in seconds (s) on the printer.
Page 88
CP 521 Print Mode ”KFa,b” format You can set the following possible parameters: • Specify the number of places before the point with "a" • Specify the number of places after the point with "b" • The sum of places before the point and places after the point must not exceed five.
Print Mode CP 521 6.4.6 Control Parameters You can configure printer control parameters in two different ways in the message text: • Direct with the KH format • Entry with the ^ character (CTRL key) Direct entry with the "KH" format When configuring a message text, the control parameters are entered direct as hexadecimal values (data format "KH").
Page 90
CP 521 Print Mode Entry with the "^" character (not with PG 615) If the module encounters the "^" character when evaluating the message texts, it automatically subtracts 40 from the next character. Example: Set double-width type on the PT 88 printer. This is done with the ESC 8 command .
Print Mode CP 521 Data Transfer from the CPU to the CP 521 Data is transferred in the data cycle via the I/O bus. 6.5.1 Data from the CP 521 to the CPU (Status of the CP 521, the printer and current clock data) The CP 521 makes the following information available cyclically via the PII of organization block OB 1: Table 6-12.
Page 92
CP 521 Print Mode Table 6-13. Status of the Module in Print Mode (Byte 0 in the PII) Status Detailed Explanation 4 to 7 0 to3 No error Memory submodule Fault in submodule configuration fault No text No message texts have been con- figured on the memory submodule Message text No message text has been stored on...
Page 93
Print Mode CP 521 Example: Scanning the status of the module (byte 0 in the PII) The module is installed in slot 7 (initial address 120). If the battery of the printer output module is defective, message text No. 8 is printed out.
Page 94
CP 521 Print Mode Status of the printer and day of the week (byte 1 in the PII) Byte 1 is divided into two half-bytes. The status of the printer is specified in the left half-byte, bits 4 to 7, and the current day of the week is in the right half-byte, bits 0 to 3.
Page 95
Print Mode CP 521 Date and time of day (bytes 1 to 7 in the PII) Date and time of day (bytes 1 to 7 in the PII) The printer status is specified in byte 1 bit 4. This information is independent of the current day of the week, which is specified in byte 1, bit 0 to 3.
Page 96
CP 521 Print Mode Example: Reading the current time of day The module is installed in slot 7 (initial address 120). The clock data is to be output on digital output modules from address 8. STL FB 100 Explanation Reading the current clock data and transferring it NAME :UHRDATEN to the digital output modules.
Print Mode CP 521 6.5.2 Data from the CPU to the CP 521 (CPU Jobs) The CPU can transfer eight bytes to the CP 521. The CP 521 processes the jobs (bytes 0 and 1) in response to a pulse edge, i.e. it responds only to signal changes in byte 0 or byte 1.
CP 521 Print Mode Overview of Possible Jobs in Print Mode The CPU transfers the job to the CP 521 in word 0. The job number is stored in byte 0. Table 6-16. Permissible Jobs in Print Mode (Byte 0 in the PIQ) Byte 0 Byte 1 Meaning...
Page 99
Print Mode CP 521 Printing the message text with and without CR/LF at the end (job 30 and 430 You must specify the message number in hexadecimal form in byte 1. The "Print message text without CR/LF" job allows you to print several message texts in one line.
Page 100
CP 521 Print Mode Setting the clock (job 10 Specify settings in BCD code in bytes 2 to 7. Enter weekdays as digits between 1 and 7 (1 = Sunday, 2 = Monday, .., 7 = Saturday). If any clock data is to remain unchanged, enter the value FFH in the relevant byte. If a setting lies outside the permissible limit values, the clock is not set.
Page 101
Print Mode CP 521 Deleting the message buffer (job 70 All CPU jobs stored in the buffer are deleted. Printout of all messages (job 80 The message texts are printed out as configured, with message text number in ascending order. •...
CP 521 Print Mode 6.6.1 Printing the Message Text (Job 30 and 40 After the "Print out message text XY" job the CP 521 transfers message text XY to the printer. You specify whether the printer is to execute line feed (LF) or carriage return (CR) after printing message text XY.
Page 103
Print Mode CP 521 Table 6-19. PIQ in the Case of the "Print Message Texts" Jobs Byte Meaning Permissible Assignment Job numbers : Print message text with CR/LF : Print message text without CR/LF : Output page feed : Output line feed Message text number to FF (1to 255)
Page 104
CP 521 Print Mode Example: Initiating output of a message text without job monitoring (CP replies are not evaluated) The CP is installed in slot 7 (initial address 120). A memory submodule on which message text 9 is configured is plugged into the CP ( 6.4.3). Message text 9 is to be printed if flag 20.0 is set.
Page 105
Print Mode CP 521 Example: Initiating output of a message text with job monitoring (CP responses are evaluated) The CP 521 is installed in slot 7 (initial address 120). Message text 1 (I 5.0) or 2 (I 5.1) is to be output if input I 5.0 or I 5.1 changes its signal state from "0" to "1". Explanation If I 5.0 is "1", flag 5.0 is set.
Page 106
CP 521 Print Mode STL (Cont.) Explanation (Cont.) Set flags 6.0 and 7.0 and transfer the M 001 "Output message text 1 with CR/LF" job to the module. KH 3001 QW 120 Block end Set flags 6.1 and 7.0 and transfer the M 002 "Output message text 2 with CR/LF"...
Print Mode CP 521 6.6.2 Setting the Time of Day and the Date (Job 10 You can set the clock in two ways: • With the user program This is suitable, for example, if the clock is to be set for a SINEC L1 time syn- chronization •...
Page 108
CP 521 Print Mode Table 6-20. PIQ in the Case of the "Set Clock" Job Byte Meaning Value Range "Set clock"Job Weekday (01 = Sunday, 02 = Monday, ..., 07 = Saturday) to 07 to 31 Month to 12 Year to 99 Hours 24h clock...
Page 109
Print Mode CP 521 6.6.3 Setting the Page Numbers (Job 20 When configuring the memory submodule, you can specify if and where a page number is to be printed. The default begins with page number 1 printed at bottom centre of the page. You can change this default in the following ways: You can change this default in the following ways: •...
Page 110
CP 521 Print Mode 6.6.4 Outputting Page Feed (Job 50 When instructed by the CPU, the CP 521 orders the printer to output page feed. Page feed is implemented by executing the number of line feeds configured (parameter block 5 "Page format": lines per page). Operator inputs required Specify job 50 in byte 0.
Page 111
Print Mode CP 521 6.6.5 Outputting Line Feed (Job 60 When instructed by the CPU, the CP 521 orders the printer to output line feed. Operator inputs required Specify job 60 in byte 0. Example: Outputting line feed The module is installed in slot 7 (initial address 120). Line feed is to be output on the printer.
Page 112
CP 521 Print Mode 6.6.6 Deleting the Message Buffer (Job 70 When instructed by the CPU, the CP 521 deletes all CPU jobs stored in the message buffer. You can delete the message buffer in two ways: • In the user program •...
Page 113
Print Mode CP 521 6.6.7 Printout of All Configured Message Texts (Job 80 When instructed by the CPU, the CP 521 prints out all configured message texts on the user submodule. The message texts are printed as configured with message text number in ascending order. Place holders are not evaluated. You can assign the job in two ways: •...
Page 114
CP 521 Print Mode 6.6.8 Transferring Parameter Setting Data (Job 90XX The parameter setting data of the serial interface is stored on the memory submodule in parameter blocks 0, 2 and 7 of data block (DB) 1. Configure the user submodule before operation.
Page 115
Print Mode CP 521 Table 6-21. PIQ in the Case of the "Setting the Serial Interface Parameters"Job Byte Meaning Value Range Default Values on the CP 521 Number of the parameter block Baud rate 110 Bd 200 Bd 300 Bd 600 Bd 1200 Bd 2400 Bd...
Page 116
CP 521 Print Mode Table 6-22. PIQ in the Case of "Setting the XON/XOFF Listing Parameters Job” Byte Meaning Value Range Default Values on the CP 521 Number of the parameter block XON/XOFF protocol XON character to 7F No listing FFFF (No XON/XOFF- XON/XOFF protocol...
Page 117
Print Mode CP 521 Table 6-24. PIQ in the Case of "Transparent ASCII Mode" Job Byte Meaning Value Range Default Values on the CP 521 Number of the parameter block (7) 0: If memory and operating mode code (1) for submodule "Transparent ASCII mode"...
Page 118
CP 521 Print Mode Table 6-25. PIQ in the Case of the "Interpretive ASCII Mode" Job Byte Meaning Value Range Default Values on the CP 521 Number of the parameter block (7) 0: If memory sub- and operating mode code (2) for module with "Interpretive ASCII mode"...
Page 119
Print Mode CP 521 C A U T I O N : The following two examples must be executed in the following order: 1. Disconnect the TTY connecting cable between the CP and the printer. 2. Set printer to new data •...
Page 120
CP 521 Print Mode Example 1b: Setting the XON/XOFF listing The same details apply as in example 1a. Operand Signal States Meaning Byte 2: XON character (DC 1 as ASCII code) QW 122 KH= 1113 Byte 3: XOFF character (DC 3 as ASCII code) Byte 0:"Transfer parameter setting data"...
Page 121
ASCII Mode General ..........Prerequisites for Operation in ASCII Mode .
Page 122
Figures 7-1. Job Transfer and Error Evaluation ....7 - 7-2. Schematic for Entering Parameter Blocks in DB 1 ..7 - 14 7-3.
CP 521 ASCII Mode ASCII Mode In ASCII mode with a CPU job request, the CP 521 allows transfer of a message of up to 256 bytes between the CPU and a peripheral device connected to the CP 521: • Communication with a terminal device (terminal, keyboard ...) •...
ASCII Mode CP 521 Prerequisites for Operation in ASCII Mode The following conditions must be met for operating the CP 521: 1. Settings on the peripheral device The settings on the peripheral device must agree with the parameter setting data on the CP 521.
Page 126
CP 521 ASCII Mode 3. Establishing connections The CPU must be at POWER OFF to carry out the following measures: • Establish connection between the CP 521 and the peripheral device. • If you have stored the parameter setting data in a memory submodule, plug the memory submodule into the CP 521.
Page 127
ASCII Mode CP 521 Changing the mode (during operation) You can alternate between "Print mode", "Transparent ASCII mode" and "Interpretive ASCII mode" during operation. Note: Note that as soon as you either • Change from one mode to another • Call up the programmed mode again via the user program, the entire send and receive buffer is deleted.
Page 128
CP 521 ASCII Mode Setting the CP 521 Parameters in ASCII Mode The CP 521 is supplied with default values for the parameter setting data. • Parameters for the interface to the peripheral device (baud rate, type of interface, handshake mode ...) •...
ASCII Mode CP 521 7.3.1 Setting the CP 521 Parameters with Job 90XX You can use the "Transfer parameter setting data" job to transfer data for a parameter block to the CP 521. Note: You can only initialize parameter blocks 0, 2 and 7 with the "Transfer parameter setting data"...
Page 130
CP 521 ASCII Mode The following pages contain • The PIQ assignment plan for the "Transfer the parameter setting data for parameter block X" jobs • Example program for transferring parameter setting data Parameter setting data for parameter block 0 Table 7-2.
Page 131
ASCII Mode CP 521 Parameter setting data for parameter block 2 Table 7-3. PIQ for the "Transfer the parameter setting data for parameter block 2" Job Byte Meaning Value Default Values Range on the CP 521 Job number Number of the parameter block XON/XOFF protocol XON character to 7F...
Page 132
CP 521 ASCII Mode Parameter setting data for parameter block 7 Table 7-4. PIQ for the "Transfer the parameter setting data for parameter block 7" Job (Print Mode) Byte Meaning Value Default Values Range on the CP 521 Job number Parameter block number and 0: if memory sub- code for "Print mode"...
Page 133
ASCII Mode CP 521 Table 7-6. PIQ for the "Transfer the parameter setting data-for parameter block 7" Job (Interpretive ASCII Mode) Byte Meaning Value Default Values Range on the CP 521 Job number Parameter block number and 0: if memory sub- code for "Interpretive ASCII module with mode"...
Page 134
CP 521 ASCII Mode Example: Setting parameter data in the user program for operation in ASCII mode using the PG 685 The CP 521 is plugged into in slot 7 (initial address 120). The module is to be operated in interpretive ASCI mode and is initialized as follows: •...
Page 135
ASCII Mode CP 521 Example: Transferring parameter setting data for parameter blocks 0, 2 and 7 The CP 521 is plugged into in slot 7 (initial address 120). The module is to be operated in interpretive ASCI mode and is initialized as follows: OB 1 FB 60 Explanation...
Page 136
CP 521 ASCII Mode OB 1 (continued) FB 62 Explanation :AN F 100.2 NAME :BLOCK7 Load end codes into KH 0D0D ACCUM 1 and transfer to NAME :BLOCK7 QW 126 the CP in bytes 6 and 7 :AN F 100.2 F 100.2 Load message lengths KH 0000...
ASCII Mode CP 521 7.3.2 Setting the CP 521 Parameters with the Memory Submodule You can store the parameter setting data on a memory submodule in DB 1. Note The procedure for setting the memory submodule parameters in ASCII mode is almost identical to the procedure in print mode.
Page 138
CP 521 ASCII Mode The following pages contain the assignment of the parameter blocks and an input example. Note: Parameter block assignment setting parameters with memory submodule corresponds to PIQ assignment when setting parameters with the user program. Table 7-7. Assignments for Parameter Block 0 Block Meaning Value Range...
Page 139
ASCII Mode CP 521 Table 7-8. Assignments for Parameter Block 2 Block Meaning Value Range Default Values on the CP 521 XON/XOFF protocol XON character to 7F no protocol FFFF XON/XOFF protocol (no XON/XOFF XOFF character to 7F protocol) no protocol * only possible in interpretive ASCII mode Table 7-9.
Page 140
CP 521 ASCII Mode Table 7-10. Assignments for Parameter Block 7 (Interpretive ASCII Mode) Block Meaning Value Range Default Values on the CP 521 Parameter block number and code for "Interpretive ASCII mode" Character delay time 0001 to 3000 (four decimal digits) Message length 000 to 256 (three decimal digits)
Page 141
ASCII Mode CP 521 We recommend the following procedure: 1. Enter the parameter setting data on the programmer in DB 1 and include sufficient comments. 2. Store in DB 1 on diskette or hard disk 3. Transfer DB 1 to the memory submodule Table 7-11.
CP 521 ASCII Mode CPU Job Requests with CP Responses in ASCII Mode The CPU sends and receives messages in eight-byte blocks. The messages have a maximum length of 256 bytes. Each block consists of a "header code" of two bytes (coordination bytes) and six bytes of data.
ASCII Mode CP 521 7.4.1 Sending Messages The CPU transfers messages in eight-byte blocks. The messages have a maximum length of 256 bytes. Each block consists of a header code of two bytes (coordination bytes) and six bytes of data. 1.
Page 144
CP 521 ASCII Mode Sending fixed-length messages The following is a description of which jobs the CPU uses when prompting the CP 521 to send messages and how the CP 521 acknowledges these jobs. Table 7-13 contains all the CPU jobs permissible in ASCII mode. After setting the interface parameters (90 ) ( 7.3), jobs A0 and B0...
Page 145
ASCII Mode CP 521 Data transfer from the CPU to the CP 521 CPU CP 521 Byte Coord. Coord. Send length End-of-text Irrelevant byte: character SEND CPU CP 521 Coord. Coord. Data Irrel. Number Irrelevant info byte valid messages CPU CP 521 Data Data Block...
Page 146
CP 521 ASCII Mode CPU CP 521 Data Block Data transf. number CPU CP 521 Coord. Coord. Data Block Number Irrelevant info. byte valid number messages . . . CPU CP 521 Data Data Block tansf. number CPU CP 521 Irrelevant Coord.
Page 147
ASCII Mode CP 521 CPU job request: Coordinate data transfer To coordinate data transfer, job A0 is written into byte 0 of the PIQ. This defines the meaning of bytes 1 to 7. Table 7-14 Coordination Job Byte Value Meaning Job: Coordinate data transfer Send message (send bit) Send length (here: 256 bytes)
Page 148
CP 521 ASCII Mode If data is to be sent from the CPU to a peripheral device, the parameters "Send length" and "End-of-text character" must be transferred with the send job. When sending data with end-of-text characters, these end-of-text characters are transferred also in both directions, but the send length is not transferred.
Page 149
ASCII Mode CP 521 Byte 1: "Send" coordination bit set. If the coordination data is invalid, the CP 521 resets the "Send bit" to 00 Byte 2: indicates whether the coordination data is valid (00 ) or invalid Byte 4: indicates how many messages (max.
Page 150
CP 521 ASCII Mode CPU job request: "Send data" (B0 After you have output job A0 and received the corresponding acknowledge- ment from the CP 521, output job B001 with the 1st data block of the message (PIQ). Table 7-16. Data Transfer: Sending the 1st Data Block Byte Value...
Page 151
ASCII Mode CP 521 CP response to job B001 The CP 521 acknowledges the "Send 1st data block of the message" job as follows (PII): Table 7-17. Acknowledging the 1st Data Block Byte Value Meaning Acknowledgment of job: Send data "Send"...
Page 152
CP 521 ASCII Mode If you send the next job B0H with incremented byte 1 (5), the CP 521 acknowldges with incremented byte 3 (6). CPU job request: B002 Table 7-18. Data Transfer: Sending the 2nd Data Block Byte Value Meaning Job: Send data...
Page 153
ASCII Mode CP 521 If you send a message of variable length and you use the maximum message length, the last CPU job request (7) and the CP acknowledgement (8) appear as follows: CPU job request : B02B Table 7-20. Data Transfer: Sending the 43rd Data Bloc k Byte Value Meaning...
Page 154
CP 521 ASCII Mode CP response to job B02B Table 7-21. Acknowledging the Last (43rd) Data Block Byte Value Meaning Acknowledgement for job: Send data "Send" coordination bit set if data valid Coordination data valid Number of the 43rd data block (max.) ...
Page 155
ASCII Mode CP 521 Example: Sending a fixed-length message Let's assume you have the CP 521 in slot 7 (initial address 120) and you want to send a fixed-length message (12 bytes) to the peripheral device. You have stored the data for the message in data block (DB) 20. STL FB 1 Explanation Send fixed length (12 bytes)
Page 156
CP 521 ASCII Mode STL FB 1 (Continued) Explanation (Continued) Read in of bytes 2 and 3 If the coordination data is invalid (after KH 0000 coordination job), or if a data block is :><F acknowledged, jump to label 003. If the coordination data were invalid, the 1st data block is transferred.
Page 157
ASCII Mode CP 521 STL FB 1 (Continued) Explanation (Continued) If data has been transferred from the CPU M002 to the CP free of errors, and if the send F00F length entered in the coordination job has been reached, flag 80.0 is reset. KH 5000 :! = F 80.0...
Page 158
CP 521 ASCII Mode Sending variable-length messages Data transfer with variable-length messages is similar to transfer with fixed- length messages. They differ in that when sending with variable-length in conjunction with job "A001 " (cf.: 1 sending messages) one or two end-of-text characters must be transferred in bytes 4 and 5.
Page 159
ASCII Mode CP 521 Example: Sending a variable-length message (only for CPU 103) You have plugged into the CP 521 in slot 7 (initial address 120) and you want to transfer a message of undefined length to a peripheral device. The data for the message is taken from DB 20.
Page 160
CP 521 ASCII Mode STL FB 2 (Continued) Explanation (Continued) Has the CP acknowledged the transferred M002 data block? KH F00F KH 5001 :><F =M001 Check of the number of the acknowledged data block :><F :JC =M001 Transfer of the next data block with the relevant number Read out the data byte to be transferred from the source DB and transfer to the...
Page 161
ASCII Mode CP 521 STL FB 2 (Continued) Explanation (Continued) KF +1 KF +3 KF +3 KF +3 Acknowledgement from CP after transfer M001 IW 120 of the last data block KH F00F KH 5000 :><F =M003 If the acknowledgement from the CP is positive, transfer of the next data package is prepared.
Page 162
CP 521 ASCII Mode 7.4.2 Receiving Messages If you want to receive data from a peripheral device using the CP 521, you must program both devices with the same message length or end-of-message character. The periheral device sends messages to the CP 521 where they are collected in one receive mailbox.
Page 163
ASCII Mode CP 521 Receiving fixed-length messages If you want to receive fixed-length data messages from a peripheral device using the CP 521, you must define the message length with which both devices are to work. If the CP is to receive data, it must be configured with the same length as the sending peripheral device since the send length is not transferred.
Page 164
CP 521 ASCII Mode Data transfers: from the CP 521 to the CPU CPU CP 521 Byte Coord. Coord. Irrelevant byte: CPU CP 521 Data Block Data trans. number CPU CP 521 Irrelevant Ackn. Block number . . . CPU CP 521 Data Block Data...
Page 165
ASCII Mode CP 521 CPU job request: Coordinate data transfer (A0 To coordinate data transfer write job A0 into byte 0 of the PIQ. This defines the meaning of bytes 1 to 7. Table 7-25. Coordination Job Byte Value Meaning Job: Coordinate data transfer Receive message (receive bit)
Page 166
CP 521 ASCII Mode CP response to job A080 If the CP 521 receives job A0H (Coordinate data transfer) with receive bit 80 (Receive message) set, and if there are no errors, the CP 521 acknowledges the CPU job request with 6X in byte 0: Table 7-26.
Page 167
ASCII Mode CP 521 CPU acknowledgement (C0 The CPU acknowledges input of the data block with ”C0 ” in byte 0: Table 7-27. Acknowledging the 1st Data Block Byte Value Meaning Acknowledges entry of the 1st data block Number of the data block Irrelevant Irrelevant Irrelevant...
Page 168
CP 521 ASCII Mode Data transfer continues in the manner described till the CPU has acknowledged the last data block of a message ( ). The CP 521 terminates data transfer with a final reponse ( ): CP response to the CPU acknowledgement C0 Table 7-28.
Page 169
ASCII Mode CP 521 CPU acknowledgement for the 25th data block Tabelle 7-29. Acknowledgement for the 25th Data Block Byte Value Meaning Acknowledges entry of the last data block Number of the 25th data block Irrelevant Irrelevant Irrelevant Irrelevant Irrelevant Irrelevant 7-46 GWA 4NEB 812 6030-02b...
Page 170
CP 521 ASCII Mode Final response from the CP 521 Table 7-30. Final Coordination Information Byte Value Meaning Coordination information Coordination bit reset Data valid Irrelevant - 64 Number of messages in receive mailbox rrelevant Irrelevant Irrelevant Byte 1: The coordination bit is reset Byte 2: Data valid Byte 4:...
Page 171
ASCII Mode CP 521 Example: Receiving a fixed-length message Let's assume you have plugged into the module in slot 7 (initial address 120) and you want to receive twelve-byte-long data messages with the CP 521. Write the incoming data into data block (DB) 40. STL FB 3 Explanation Receive fixed length (12 bytes)
Page 172
CP 521 ASCII Mode STL FB 3 (Continued) Explanation (Continued) and transfer the acknowledgement for KH C001 block No. 1 to the CP. The block is completed :BEU Read in of bytes 0 and 1 M002 If no data has been sent to the CPU from KH 6002 the CP (byte 0 = 50 ), jump to label...
Page 173
ASCII Mode CP 521 Receiving variable-length messages Variable-length messages are received in the same way as fixed-length messages. If you want to receive variable-length data messages from a peripheral device using the CP 521, you must define the message end code for both devices with the job 9072 in word 6.
Page 174
CP 521 ASCII Mode STL FB 4 (continued) Explanation (continued) Block end :BEU Has data been transferred from the M001 CP 521 to the CPU? KH F00F :><F ” N O ” =M002 Store data received in the target DB. The end codes read in with the data KH 0D0D (here: 0D0D...
Page 175
ASCII Mode CP 521 STL FB 4 (Continued) Explanation (Continued) Increment the block number and the pointer in the target DB by 1 at "6XNR" KF +1 (FW 22) and "C0NR" (FW 24). KF +1 KF +3 KF +3 KF +3 Data is being received 90.7 Block end...
Page 176
CP 521 ASCII Mode STL FB 4 (Continued) Explanation (Continued) Prepare next message after positive acknowledgement Reset status flag 90.0 90.7 Preset acknowledgements and target KH 6001 DB pointer with their initial values. KH C001 KF +0 KF +1 KF +2 ENDE 7-53 GWA 4NEB 812 6030-02b...
Page 177
ASCII Mode CP 521 CPU Job Requests and CP Error Messages in ASCII Mode All the CPU job requests permissible in ASCII mode are listed in this section. There is also a complete list of error messages with which the CP 521 acknowledges CPU job requests.
Page 178
CP 521 ASCII Mode 7.5.2 Illegal Jobs with Error Messages If data has not yet been transferred and you write a job in word 0 of the PIQ (byte 0 and byte 1) other than the job executed above, the CP 521 stores an error message in the status byte (PII).
Page 179
ASCII Mode CP 521 Message 4X "Illegal job" is transmitted if the CPU tries to continue data transfer after it has been aborted (B0XX The CP 521 aborts a receive job immediately (A080 ) if • there is no message present in the CP (CP acknowledgement 5000 ) or •...
Page 180
CP 521 ASCII Mode 7.5.3 Further Error Messages he CP 521 signals further errors stored in byte 0 (status byte) of the module, which you can read in and evaluate via the PII. Byte 0, which documents the status of the module, is divided into two half bytes whose values can be combined with each other in any way (e.g.
Page 181
ASCII Mode CP 521 Table 7-35. Status Byte in ASCII Mode (PII) (Continued) Byte 0 Status Bit 4 to 7 Bit 0 to 3 Clock defective Default time set Time/date error Illegal job Coordination information (only after job "Coordinate data transfer") Data transfer from the CP 521 to the CPU Hardware error X= Signal status for other byte half irrelevant...
Page 182
CP 521 ASCII Mode Backup battery missing (X7 • No battery has been inserted in the CP 521, or • the battery is defective. Job not accepted (X8 This message is sent to the CPU on two occasions: • A CPU job request cannot be accepted because the previous job has not yet been processed by the CP operating system.
Page 183
ASCII Mode CP 521 When using MODEM control signals: The CP 521 sends DTR = 0 to the peripheral device if • less than 20 bytes are free in the receive mailbox • the CP has received more than 100 messages. The CP 521 sends DTR = 1 again only when more than 256 bytes are free in the reveive mailbox.
Page 184
CP 521 ASCII Mode Default time set (2X The clock is set with the values Sunday 01.01.89 112.00.00. Time/date error (3X At least one manipulated variable is outside the permissible range. The clock has not accepted the new clock data and continues to operate with the old data.
Page 188
Appendix : Summary CPU Jobs (PIQ) ........A - CP Responses (PII).
Page 189
Tables A-1. PIQ for Job ”Transfer Parameter Setting Data for Parameter Block 0” ......A - A-2.
Page 192
CP 521 Summary CP Responses (PII) Half Byte Half Byte PII (byte 0) No error No error Clock defective Memory submodule not plugged in or empty Default time set No message text configured or memory submodule empty Time/date error Not used Job error/ illegal job Not used Coordination...
Page 194
CP 521 Summary CP Responses (PII) (Continued) Half Byte Half Byte PII (byte 3) 01 - 12 Month Irrelevant* or block no. for sending Data** PII (byte 4) 00 - 99 Year Number of messages in 00 - 64 receive buffer* Data** PAE (Byte 5) PII (byte 5)
Page 195
Summary CP 521 Parameter Setting Data for Print Mode (User Submodule) Block Meaning Value Range Default Values on the CP 521 Baud rate 110 Bd 200 Bd 300 Bd 600 Bd 1200 Bd 2400 Bd 4800 Bd 9600 Bd Parity even (Parity bit always ”1”) ”mark”...
Page 196
CP 521 Summary Block Meaning Value Range Default Values on the CP 521 Function character ASCII character to 7F End-of-text character ASCII character to 7F Date and time of day: Order for date JMT, JTM,MTJ, MJT, TJM, = Year TMJ, YMD, YDM, MDY, = Month MYD, DYM, DMY T,D = Day...
Page 197
Summary CP 521 Block Meaning Value Range Default Values on the Operating mode Print mode (with user sub- Transparent module) ASCII mode 1 (without user ASCII mode submodule) Character delay time (0001 to 3000) ·100ms 0001: 100ms (four decimal digits) Message length 000 to 256 bytes 064 bytes...
Page 198
CP 521 Summary Parameter Setting Data for ASCII Mode (User Program) Table A-1. PIQ for Job "Transfer Parameter Setting Data for Parameter Block 0" Byte Meaning Value Range Default Values on the CP 521 Job number Parameter block number Baud rate 110 Bd 200 Bd 300 Bd...
Page 199
Summary CP 521 Table A-2. PIQ for Job ”Transfer Parameter Setting Data for Parameter Block 2” Byte Meaning Value Range Default Values on the CP 521 Job number Parameter block number XON/XOFF protocol XON character to 7F no protocol FFFF XON/XOFF protocol (No XON/XOFF XOFF character...
Page 200
CP 521 Summary Table A-4. PIQ for Job "Transfer Parameter Setting Data for Parameter Block 7" (Transparent ASCII Mode) Byte Meaning Value Range Default- Values on the CP Job number Parameter block number and 0: If memory submodule Identifier for "Transparent ASCII with message texts mode"...
Page 201
Summary CP 521 Slot Addressing Slot Addresses PII/PIQ Status Messages and Error Messages Byte 0 Status Bit 4 to 7 Bit 0 to 3 No error CP backup battery missing CP active/job not processed Character time out Parity error Receive after XOFF or receive after DTR = 0 Message length greater than 256 bytes Permanent break on I/O line Receive mailbox overflow...
Page 202
CP 521 Summary Typical Printouts of the ”KFa, b” Data Format Configur- Printout of the Variables KF ation 32767 32767 – – KF 5,0 -256 32767 -32767 KF 4,0 3277 -3277 KF 3,0 -328 KF 2,0 KF 1,0 KF 0,0 -256 32767 -32767...
Page 203
Appendix B: Application Example Task ..........Device Configuration .
Page 204
Figures B-1. Configuration Schematic: Point-to-Point Connection of Two S5-100Us ........B - B-2.
Page 205
CP 521 Application Example Application Example Task Two S5-100U programmable controllers are to exchange six bytes of data. For this purpose, a point-to-point connection is established between both PCs (ASCII mode). Both PCs contain a program for sending and receiving data messages. Device Configuration The device configuration is shown in Figure B-1.
Page 207
CP 521 Application Example Setting the Parameters on the Serial Interface of the CP 521 To establish a point-to-point connection, you must set the ASCII mode parameters for the serial interface of the CP 521. Store all parameter setting data in DB 1 on a user submodule (EPROM/EEPROM): •...
Page 208
Application Example CP 521 Programming the Programmable Controller Before entering the statement list, we would like to explain the basic settings of the example program. The program is designed so that both programmable controllers are permanently ready to receive. Transmission on a 200 ms timebase (5 Hz). The CPU expects to receive messages constantly and switches to "Send"...
Page 211
CP 521 Application Example STL FB 2 Explanation Read 6-byte message NAME :Empfang Job processed by CP? 0F00 0800 :!=F :BEC Receive active? 102.0 =M001 Coordinate receive A080 Receive active! 102.0 :BEU Wait cycle after STOP-RUN till CP status M001 102.1 reported 102.1...
Page 212
Application Example CP 521 STL FB 2 (Continued) Explanation (Continued) Acknowledge from CPU to CP KH C001 :BEU Receive message complete? M002 F00F 5000 :!=F Reset receive active 102.0 GWA 4NEB 812 6030-02b...
Page 213
CP 521 Application Example STL FB 3 Explanation Data exchange CPU CP 521 NAME :CPU <-> CP free-running 5 Hz timebase 100 ms pause 010.0 100 ms pulse 010.0 Send edge flag 100.0 100.0 100.1 100.0 Send job in 200 ms time if no receive 100.1 active 102.0...
Page 214
Application Example CP 521 STL OB 1 Explanation Test Store input byte 1 and 2 in send buffer Data exchange CPU CP 521 :CPU <-> CP Test Display receive data in output byte 3 and 4 B-10 GWA 4NEB 812 6030-02b...
Page 215
CP 521 Application Example Testing an Example Program You can test the program after entering all blocks: • Enter all send data in the send PC via the simulator module (input byte 1 and • This data is transferred to the receive PC •...
Page 222
Index CP 521 Time - error 7-61 - inserting 6-22 Time of day - inserting - reading 6-39 - setting 6-50 Transmission mode TTY current-loop interface TTY interface - pin assignment 3-5, 3-6 - terminal diagram 3-5, 3-6 Unplugging - module User submodule 2-11 V.24 interface...
Page 223
Siemens AG Suggestions AUT E1114B Postfach 1963 Corrections Werner-von-Siemens-Str. 50 For publication: D-92209 Amberg Fed. Rep. of Germany Title: CP 521 Printer / ASCII Communications Module From: Order No.: 6ES5 998-0UD21 Name Edition: Firm/Dept. Should you come across any printing errors when reading this publication, we would ask you to inform us accordingly, using this form.