CP Functions
CP Functions
Preface
___________________
Description 1
___________________
CP 340 function blocks 2
SIMOTION
___________________
CP 341 function blocks 3
Supplement to the
CP 340 and CP 341 Modules ___________________
Alarm processing 4
___________________
Appendices A
Function Manual
11/2010 Edition
Legal information
Legal information
Warning notice system
This manual contains notices you have to observe in order to ensure your personal safety, as well as to prevent
damage to property. The notices referring to your personal safety are highlighted in the manual by a safety alert
symbol, notices referring only to property damage have no safety alert symbol. These notices shown below are
graded according to the degree of danger.
DANGER
indicates that death or severe personal injury will result if proper precautions are not taken.
WARNING
indicates that death or severe personal injury may result if proper precautions are not taken.
CAUTION
with a safety alert symbol, indicates that minor personal injury can result if proper precautions are not taken.
CAUTION
without a safety alert symbol, indicates that property damage can result if proper precautions are not taken.
NOTICE
indicates that an unintended result or situation can occur if the corresponding information is not taken into
account.
If more than one degree of danger is present, the warning notice representing the highest degree of danger will
be used. A notice warning of injury to persons with a safety alert symbol may also include a warning relating to
property damage.
Qualified Personnel
The product/system described in this documentation may be operated only by personnel qualified for the specific
task in accordance with the relevant documentation for the specific task, in particular its warning notices and
safety instructions. Qualified personnel are those who, based on their training and experience, are capable of
identifying risks and avoiding potential hazards when working with these products/systems.
Proper use of Siemens products
Note the following:
WARNING
Siemens products may only be used for the applications described in the catalog and in the relevant technical
documentation. If products and components from other manufacturers are used, these must be recommended
or approved by Siemens. Proper transport, storage, installation, assembly, commissioning, operation and
maintenance are required to ensure that the products operate safely and without any problems. The permissible
ambient conditions must be adhered to. The information in the relevant documentation must be observed.
Trademarks
All names identified by ® are registered trademarks of the Siemens AG. The remaining trademarks in this
publication may be trademarks whose use by third parties for their own purposes could violate the rights of the
owner.
Disclaimer of Liability
We have reviewed the contents of this publication to ensure consistency with the hardware and software
described. Since variance cannot be precluded entirely, we cannot guarantee full consistency. However, the
information in this publication is reviewed regularly and any necessary corrections are included in subsequent
editions.
Function blocks
The function blocks for communication between the SIMOTION system and the CP 340 and
CP 341 modules are part of the program library of the "SIMOTION SCOUT" engineering
system.
SIMOTION Documentation
An overview of the SIMOTION documentation can be found in a separate list of references.
This documentation is included as electronic documentation in the scope of delivery of
SIMOTION SCOUT. It comprises 10 documentation packages.
The following documentation packages are available for SIMOTION V4.2:
● SIMOTION Engineering System
● SIMOTION System and Function Descriptions
● SIMOTION Service and Diagnostics
● SIMOTION IT
● SIMOTION Programming
● SIMOTION Programming - References
● SIMOTION C
● SIMOTION P
● SIMOTION D
● SIMOTION Supplementary Documentation
Additional information
Click the following link to find information on the the following topics:
● Ordering documentation/overview of documentation
● Additional links to download documents
● Using documentation online (find and search in manuals/information)
http://www.siemens.com/motioncontrol/docu
Please send any questions about the technical documentation (e.g. suggestions for
improvement, corrections) to the following e-mail address:
docu.motioncontrol@siemens.com
My Documentation Manager
Click the following link for information on how to compile documentation individually on the
basis of Siemens content and how to adapt this for the purpose of your own machine
documentation:
http://www.siemens.com/mdm
Training
Click the following link for information on SITRAIN - Siemens training courses for automation
products, systems and solutions:
http://www.siemens.com/sitrain
FAQs
You can find Frequently Asked Questions on the Service&Support pages under Product
Support:
http://support.automation.siemens.com
Technical support
Country-specific telephone numbers for technical support are provided on the Internet under
Contact:
http://www.siemens.com/automation/service&support
Preface ...................................................................................................................................................... 3
1 Description................................................................................................................................................. 9
1.1 General ..........................................................................................................................................9
1.2 Product description ........................................................................................................................9
1.3 Setup and connection ..................................................................................................................11
1.4 Integrating the communications processors in the SIMOTION project........................................12
1.5 Integrating the function blocks in the user project .......................................................................13
1.6 Creating I/O variables ..................................................................................................................14
2 CP 340 function blocks ............................................................................................................................ 15
2.1 Overview of the function blocks of the CP 340 ............................................................................15
2.2 _CP340_send function block........................................................................................................16
2.3 _CP340_receive function block....................................................................................................20
2.4 _CP340_printer function block .....................................................................................................24
2.4.1 Description of the _CP340_printer FB .........................................................................................24
2.4.2 supplemental function blocks.......................................................................................................30
2.4.3 CP 340 print call examples ..........................................................................................................35
2.5 _CP340_getV24Signals function block ........................................................................................39
2.6 _CP340_setV24Signals function block ........................................................................................41
2.7 Calling the CP 340 function blocks ..............................................................................................42
2.8 Data consistency..........................................................................................................................44
2.9 Application Examples...................................................................................................................45
2.9.1 sending and receiving with CP 340 .............................................................................................45
2.9.2 Printing with CP 340 ....................................................................................................................49
3 CP 341 function blocks ............................................................................................................................ 53
3.1 Overview of the function blocks of the CP 341 ............................................................................53
3.2 _CP341_send function block........................................................................................................54
3.2.1 Description of the _CP341_send FB............................................................................................54
3.2.2 Application with 3964(R) protocol or ASCII driver .......................................................................55
3.2.3 Application with RK 512 computer interfacing .............................................................................59
3.3 _CP341_receive function block....................................................................................................67
3.3.1 Description of the _CP341_receive FB ........................................................................................67
3.3.2 Application with 3964(R) protocol or ASCII driver .......................................................................67
3.3.3 Application with RK 512 computer interfacing .............................................................................72
3.4 _CP341_printer function block .....................................................................................................79
3.4.1 Description of the _CP341_printer FB .........................................................................................79
3.4.2 supplemental function blocks.......................................................................................................85
3.4.3 CP 341 print call examples ..........................................................................................................90
Note
This manual is a supplement to SIMATIC manuals CP 340 Point-to-Point Connection,
Installation and Parameter Assignment/CP 341 Point-to-Point Connection, Installation and
Parameter Assignment.
These documents are shipped with SIMOTION SCOUT in electronic form!
The following software versions are required for the standard functions described in this
documentation:
● SIMOTION SCOUT V4.2 or higher
● SIMOTION Kernel V4.2 or higher
Possible applications
In addition to the possible applications described in SIMATIC manuals CP 340 Point-to-Point
Connection, Installation and Parameter Assignment and CP 341 Point-to-Point Connection,
Installation and Parameter Assignment, these communications processors (CPs) can also be
used in a SIMOTION system. The communications processors can be used as centralized
modules (on the SIMOTION C2xx only) or as distributed modules (SIMOTION C2xx,
SIMOTION P350 and SIMOTION D4xx).
More than one CP 340/CP 341 can be used on one SIMOTION device.
The figure below shows the connection of an ET 200M distributed I/O device with IM 153-1
and CP 340 or CP 341 to a SIMOTION device (e.g. SIMOTION C2xx).
3*3&
36 &[[ 60V
6,027,21
+DUGZDUHSODWIRUP
HJ&[[
,0
&3&3
36
352),%86'3
6,0$7,&
(70 'LVWULEXWHG,2
,0
(70
Figure 1-1 Connection of an ET 200M distributed I/O device with IM 153-1 and CP 340 or CP 341 to
a SIMOTION C2xx (example of distributed application)
Overview
The following sequence of operations is required to commission the CP 340/CP 341 and
operate it under the control of the SIMOTION system:
Note
For steps 1 to 4, refer to the ET 200M Distributed I/O manual.
This documentation is included in the SIMOTION SCOUT scope of supply as electronic
documentation!
Requirement
The following requirements must be met in the case of networking via PROFIBUS:
1. You have created a project in SIMOTION SCOUT and have inserted a rack with a
SIMOTION hardware platform in the hardware configuration.
2. You have configured a PROFIBUS subnet (for distributed application only).
Note
For information on creating a project and configuring a PROFIBUS subnet, refer to the
online help for SIMOTION SCOUT.
The following requirements must be met in the case of networking via PROFINET:
1. You have created a project in SIMOTION SCOUT and have inserted and configured a
rack with a PROFINET-compatible SIMOTION device in the hardware configuration.
2. You have configured a PROFINET IO system (for distributed application only).
Note
For information on creating a project and configuring a PROFINET IO system, refer to the
online help for SIMOTION SCOUT.
6. The inserted I/O device must now be fitted with your project modules. To do this, open
the CP 300 subfolder below the selected I/O device in the hardware catalog and select
the relevant CP modules.
Note
Diagnostic alarms are not enabled by default. Activate the alarms for each module in the
Properties dialog box.
VAR_GLOBAL
...
myInstCP340Send : _CP340_send; // create FB instance
myInstCP341Send : _CP341_send; // create FB instance
...
END_VAR
Example of an application
The application example is included on the "SIMOTION Utilities & Applications" CD-ROM
and is available for various SIMOTION hardware platforms.
The "SIMOTION Utilities & Applications" CD-ROM is provided free of charge and part of the
SIMOTION SCOUT scope of delivery.
Overview
Communication between the SIMOTION device and the CP 340 and CP 341 takes place by
means of direct I/O access and data set transfer. For data set transfer, the module address
is transferred to the FB as an input parameter. I/O variables are used to address the direct
read/write access to the I/O.
You can freely assign the names of I/O variables in SIMOTION SCOUT. I/O variables must
be specified as ARRAY [0..15] of BYTE. You assign the address settings in the hardware
configuration to these I/O variables.
The names of the I/O inputs must be transferred to the function blocks as call parameters
(periIn). The prepared data for the I/O outputs are provided by the FB as in/out parameters
(periOut). The in/out parameter must be supplied with a variable of type ARRAY [0..15] of
BYTE. After the block is called, this variable must be assigned to the I/O variables for the I/O
outputs (see Chapter Calling the CP 340 function blocks (Page 42)).
Note
The variable for supplying the in/out parameters must not be created as a temporary variable
(VAR_TEMP or local variable of a function).
The following example shows how to assign the module addresses to the I/O variables in
SIMOTION SCOUT.
Note
For additional information, see the following sources:
SIMOTION SCOUT online help
Programming Manual of the corresponding programming language, e.g.:
– SIMOTION ST, Structured Text programming manual
– SIMOTION MCC, Motion Control Chart programming manual
– SIMOTION LAD/FBD, Ladder Diagram and Function Block Diagram programming
manual
These documents are included in the SIMOTION SCOUT scope of delivery as electronic
documentation.
Note
The SIMOTION identifiers have changed as of V4.0. A comparison of the SIMOTION and
SIMATIC identifiers can be found in the appendix SIMOTION and SIMATIC names
(Page 109) in the table "SIMOTION and SIMATIC CP 340 identifiers".
SIMOTION SCOUT contains all of the required FBs and the Struct_CP340_printData data
structure (for _CP340_printer function block only) of the CP 340. The function blocks can be
used to control one or more CP 340 modules.
Function
The _CP340_send function block enables you to send data from the data send array to a
communications partner. You have 1,024 bytes available for this.
For the transfer, you can use the 3964 (R) protocol or ASCII driver.
B&3BVHQG
(1 (12
%22/ H[HFXWH GRQH %22/
%22/ UHVHW HUURU %22/
',17 PRGXOH$GGUHVV HUURU,' :25'
8',17 GDWD2IIVHW HUURU,G7UDQVIHU ',17
8',17 GDWD/HQJWK VWDUWXS %22/
$55$<>@RI%<7( SHUL,Q
/$'VSHFLILFSDUDPHWHUV
Parameter description
H[HFXWH
UHVHW
GRQH
HUURU
&RPSOHWLRQZLWKHUURUV
VWQWK6(1'SDUW
7UDQVIHUULQJDERUW
7UDQVIHUULQJDERUW
6HQGUHTXHVWLV
ZLWKRXWHUURUV
ZLWKRXWHUURUV
QRWH[HFXWHG
&RPSOHWLRQ
&RPSOHWLRQ
VHQGLQJLV
6HQGLQJ
GLVDEOHG
UHTXHVW
Note
The execute input is edge-triggered. The send job starts when there is a positive edge at the
execute input.
The _CP340_send FB must be called repeatedly by a program. The send job can only be
executed by cyclically calling the send FB.
A positive edge at the execute input initiates the transfer. A data transfer operation can run
over several calls, depending on the amount of data involved.
The active transfer job can be canceled by setting the reset parameter to "TRUE". This will
reset the _CP340_send FB to its initial state. The send operation will remain disabled as long
as the signal state at the reset parameter is "TRUE".
The moduleAddress parameter specifies the module address of the CP 340 being
addressed.
Note
There is no parameter check for the _CP340_send function block. Incorrect parameterization
of this block may cause the SIMOTION device to switch to "STOP" mode.
Before the CP 340 can process an initiated job following a transition of the
SIMOTION device from "STOP" to "RUN" mode, the CP-SIMOTION startup mechanism of
the _CP340_send FB must be complete. Any jobs initiated in the meantime will not be lost.
They are transferred to the CP 340 once the startup coordination has finished.
The end of the startup coordination is indicated in output parameter startup = FALSE.
Note
Once the data have been entered in the static memory of the send FB, you can modify the
variable created in the data parameter. This does not affect the data to be sent.
Function
The _CP340_receive function block enables you to receive data from a communications
partner in the data receive field. You have 1,024 bytes available for this.
For the transfer, you can use the 3964 (R) protocol or ASCII driver.
_CP340_receive
(1 (12
/$'VSHFLILFSDUDPHWHUV
Parameter description
HQDEOH
UHVHW
QHZ'DWD5HFHLYHG
HUURU
GDWD/HQJWK
&RPSOHWLRQZLWKRXWHUURUV
&RPSOHWLRQZLWKRXWHUURUV
&RPSOHWLRQZLWKHUURUV
&RPSOHWLRQZLWKHUURUV
5HFHLYLQJLVGLVDEOHG
(QDEOHUHFHLYLQJ
1RWUHFHLYLQJ
5HFHLYLQJ
5HFHLYLQJ
DERUW
Receiving of data is enabled with static signal state "TRUE" in the enable parameter. An
active data transfer can be canceled with signal state "FALSE" in the enable parameter. The
canceled receive job is terminated with an error message (errorID output). The receive
operation will remain disabled as long as the signal state at the enable parameter is
"FALSE". A data transfer operation can run over several calls, depending on the amount of
data involved.
The active transfer job can be canceled by setting the reset parameter to "TRUE". This will
reset the _CP340_receive FB to its initial state. The receive operation will remain disabled as
long as the signal state at the reset parameter is "TRUE".
The moduleAddress parameter specifies the module address of the CP 340 being addressed
for the data set transfer.
Note
There is no parameter check for the _CP340_receive function block. Incorrect
parameterization of this block may cause the SIMOTION device to switch to STOP mode.
Before a job from the CP 340 can be received following a transition of the SIMOTION device
from "STOP" to "RUN" mode, the CP SIMOTION startup mechanism of the
_CP340_receiveFB must be complete.
The end of the startup coordination is indicated in output parameter startup = FALSE.
Function
The _CP340_printer function block is used to send data of type Struct_CP340_printData from
the printer memory area to a serial printer. For example, the _CP340_printer function block
might send a process message to the CP 340. The CP 340 prints out the process message
on the connected printer.
B&3BSULQWHU
(1 (12
%22/ H[HFXWH GRQH %22/
%22/ UHVHW HUURU %22/
',17 PRGXOH$GGUHVV HUURU,' :25'
$55$<>@RI%<7( SHUL,Q VWDUWXS %22/
HUURU,G7UDQVIHU ',17
/$'VSHFLILFSDUDPHWHUV
Parameter description
H[HFXWH
UHVHW
GRQH
HUURU &RPSOHWLRQZLWKHUURUV
VWQWK35,17SDUW
7UDQVIHUULQJDERUW
7UDQVIHUULQJDERUW
35,17UHTXHVWLV
ZLWKRXWHUURUV
ZLWKRXWHUURUV
QRWH[HFXWHG
&RPSOHWLRQ
&RPSOHWLRQ
VHQGLQJLV
6HQGLQJ
GLVDEOHG
UHTXHVW
Note
The execute input is edge-triggered. The send job starts when there is a positive edge at the
execute input.
The moduleAddress parameter specifies the module address of the CP 340 being addressed
for the data set transfer.
For call examples for the _CP340_printer FB, see Chapter CP 340 print call examples
(Page 35).
Note
There is no parameter check for the _CP340_printer function block. Incorrect
parameterization of this block may cause the SIMOTION device to switch to "STOP" mode.
Before the CP 340 can process an initiated job following a transition of the SIMOTION
device from "STOP" to "RUN" mode, the CP-SIMOTION startup mechanism of the
_CP340_printer FB must be complete. Any jobs initiated in the meantime will not be lost.
They are transferred to the CP 340 once the startup coordination has finished.
The end of the startup coordination is indicated in output parameter startup = FALSE.
Struct_CP340_dataRecord : STRUCT
dataLength : UDINT; // Data quantity
data : ARRAY [0..31] of BYTE; // Data field
END_STRUCT
Struct_CP340_printData : STRUCT
variable : ARRAY [0..3] of Struct_CP340_dataRecord; // 1st to 4th variable
format : ARRAY [0..150] of BYTE; // Format string
END_STRUCT
The first variable to be printed corresponds to the variable [0] element, the second variable
to be printed corresponds to the variable [1] element, etc. The number of bytes to be printed
per variable is limited to 32. The data for variable i must be placed in
variable [i-1].data[0..31]. The number of bytes to be printed must be entered in the
variable [i-1].dataLength element.
The format string corresponds to the format element. The format string must be structured as
follows (refer to the SIMATIC CP 340 Point-to-Point Connection, Installation and Parameter
Assignment manual):
● Specification of string length in format [0]
● Specification of individual characters in format [1 to 150]
Note
If the maximum length is exceeded, the print job is canceled and event number 16#1E41
is indicated at the errorID parameter output of the _CP340_printer FB.
Note
You can use supplemental function blocks (see Chapter supplemental function blocks
(Page 30)) to enter values into the printer memory area and to select message texts.
Example:
● Print message text no. 3 (stored in CP 340).
Configured message text: "This is message text no. 3"
myPrintData.variable[0].datalength := 1;
myPrintData.variable[0].data[0] := 3; // Message text no. 3
myPrintData.variable[0].datalength := 1;
myPrintData.variable[0].data[0] := 4; // Message text no.4
Notes on handling
The format string entry in the "format" field must be hexadecimal.
Example:
% corresponds to 25 hex in the IBM character set,
N (message text output) corresponds to 4E hex in the IBM character set.
(see Hardware configuration > Character set)
Data types DATE, TIME, DATE_AND_TIME_OF_DAY and TIME_OF_DAY are not
supported. The date information must be entered as a DWORD or WORD in the printer data
structure.
Representation type "A" (German date format):
//datefrg:=4018 (01.01.2001) and 4199 (01.07.2001)
printData.variable[0].datalength:=2;
printData.variable[0].data[0]:=WORD_TO_BYTE(SHR(datefrg,8));
printData.variable[0].data[1]:=WORD_TO_BYTE(SHR(datefrg,0));
Representation type "F":
The value to be printed must be in floating point format (mantissa/exponent) (see call
example 2, Chapter CP 340 print call examples (Page 35))
Representation type "C":
If variable[ ].datalength:=1 in the printer data structure, the characters will be printed
horizontally.
If variable[ ].datalength:=2 (3,4) in the printer data structure, the characters will be printed
vertically.
Representation type "X":
For CP 340 RS232, product version E08 and higher, representation type "X" (binary) outputs
the values correctly on a serial printer.
Disconnected printer
The communications link is not monitored for printers even if alarm generation is enabled in
HW Config of STEP 7.
Example:
● A break in the connection between the printer and the CP 340 triggers neither an error
nor a diagnostic alarm.
● Nor are they triggered if a print job is started but no printer is connected.
Note
The code in examples 1, 2, and 3 (see Chapter CP 340 print call examples (Page 35))
can be transferred to the SIMOTION SCOUT editor with Copy and Paste.
Function
Supplemental function blocks are provided for entering variables of various data types as
well as for entering message texts into data structure Struct_CP340_printData. You enter the
value of the variables byte by byte and in the proper format in the variable element of the
printer memory area and, optionally, in the format element. When numbers are entered for
message texts, one entry is made in each of the format and variable elements. The method
of representation for the variables in printed text and the method of entry in the format string
can be selected by means of parameters.
The following supplemental function blocks are available:
● _CP340_realToPrintData
Entry of a number of data type REAL into data structure Struct_CP340_printData
● _CP340_dwordToPrintData
Entry of a number of data type DWORD into data structure Struct_CP340_printData
● _CP340_wordToPrintData
Entry of a number of data type WORD into data structure Struct_CP340_printData
● _CP340_byteToPrintData
Entry of a number of data type BYTE into data structure Struct_CP340_printData
● _CP340_dintToPrintData
Entry of a number of data type DINT into data structure Struct_CP340_printData
● _CP340_intToPrintData
Entry of a number of data type INT into data structure Struct_CP340_printData
● _CP340_printMsgText
Selection of message texts stored in the CP 340
Note
SINT and USINT data types can be entered into data structure Struct_CP340_printData
with the _CP340_intToPrintData function block. Type conversion is implicit.
Parameter description
Table 2- 5 _CP340_realToPrintData
Table 2- 7 _CP340_printMsgText
Call example 1
UNIT E1CP340p;
INTERFACE
VAR_GLOBAL
myPreparePrintData : BOOL; // Initiate prepare print request
myRequestPrint : BOOL; // Initiate transfer to printer
myReset : BOOL; // Abort print
myActualLevel : REAL := 5.67; // actual value "level"
myModuleAddress_1 : DINT:= 256; // address of 1st CP340 module
myPrintData : Struct_CP340_printData; // instance of datastruct
myFB_CP340_printMessageText : _CP340_printMsgText; // instances of function blocks
myFB_CP340_realToPrintData : _CP340_realToPrintData; // instances of function blocks
myFB_CP340_print : _CP340_printer; // instance of function block
myOutputArrayCP340_1 : ARRAY[0..15] of BYTE; // field for CP340 output data
END_VAR
PROGRAM Example_print_1; // program for BackgroundTask
END_INTERFACE
IMPLEMENTATION
PROGRAM Example_print_1
// BackgroundTask program
END_PROGRAM //Example_print_1
END_IMPLEMENTATION
Call example 2
UNIT E2CP340p;
INTERFACE
VAR_GLOBAL
myRequestPrint : BOOL; // Initiate transfer to printer
myReset : BOOL; // abort print
myPrintDword : DWORD; // value to print out
myModuleAddress_1 : DINT := 256; // address of 1st CP340 module
myPrintData : Struct_CP340_printData; // instance of datastruct
myFB_CP340_print : _CP340_printer; // instance of function block
myOutputArrayCP340_1 : ARRAY[0..15] OF BYTE; // field for CP340 output data
END_VAR
PROGRAM Example_print_2; // program for BackgroundTask
END_INTERFACE
IMPLEMENTATION
PROGRAM Example_print_2 // BackgroundTask program
// example with notation "F" and variable of type DWORD
// (containing mantissa and exponent)
// assignment for variable (type DWORD), to print out with notation "F"
myPrintDword := REAL_TO_DWORD(10000.0); // variable (DWORD) with mantissa and exponent
// !!!
// ATTENTION! wrong example for this case is an assingnment with an integer value e.g.:
// myprintDword := 10000; // because the format is WITHOUT mantissa and exponent
// !!!
END_PROGRAM //Example_print_2
END_IMPLEMENTATION
Call example 3
UNIT E3CP340p;
INTERFACE
VAR_GLOBAL
myRequestPrint : BOOL; // Initiate transfer to printer
myReset : BOOL; // Abort print
myPrintReal1 : REAL; // 1st value
myPrintReal2 : REAL; // 2nd value
myPrintReal3 : REAL; // 3rd value
myModuleAddress_1 : DINT := 256; // address of 1st CP340 module
myPrintData : Struct_CP340_printData; // instance of datastruct
myFB_CP340_print : _CP340_printer; // instance of function block
myFB_CP340_realToprintData1 : _CP340_realToPrintData; // instances of function blocks
myFB_CP340_realToprintData2 : _CP340_realToPrintData; // instances of function blocks
myFB_CP340_realToprintData3 : _CP340_realToPrintData; // instances of function blocks
myOutputArrayCP340_1 : ARRAY[0..15] OF BYTE;
END_VAR
PROGRAM Example_print_3; // program for BackgroundTask
END_INTERFACE
IMPLEMENTATION
PROGRAM Example_print_3 // BackgroundTask program
// The following example program demonstrates usage of _CP340_realToPrintData()
END_PROGRAM //Example_print_3
END_IMPLEMENTATION
Function
The _CP340_getV24Signals function block reads the RS-232-C accompanying signals from
the CP 340 and makes them available to the user in the block parameters. The functionality
of the _CP340_getV24Signals FB can only be used if a parameterized ASCII driver is
specified.
B&3BJHW96LJQDOV
(1 (12
%22/ HQDEOH HUURU %22/
$55$<>@RI%<7( SHUL,Q VLJ'WU %22/
VLJ'VU %22/
VLJ5WV %22/
VLJ&WV %22/
VLJ'FG %22/
VLJ5L %22/
/$'VSHFLILFSDUDPHWHUV
Parameter description
Note
A minimum pulse duration is necessary to detect a signal change. Determining factors are
the cycle time (SIMOTION device), the update time on the CP 340, and the response time of
the communications partner.
Function
The _CP340_setV24Signals function block can be used to set or reset RS 232C
accompanying signals. The functionality of the _CP340_setV24Signals FB can only be used
if a parameterized ASCII driver is specified.
B&3BVHW96LJQDOV
(1 (12
%22/ HQDEOH HUURU %22/
%22/ VLJ'WU
%22/ VLJ5WV
/$'VSHFLILFSDUDPHWHUV
Parameter description
Name P type 1) Data type Meaning Actions performed by user Actions performed by
block
enable IN BOOL Block enable Entered Checked
sigDtr IN BOOL Data terminal ready Entered Checked
sigRts IN BOOL Request to send Entered Checked
periOut IN/OUT ARRAY[0..15] Prepared FB data for the Checked and transferred to Entered
of BYTE I/O outputs of the CP 2) the I/O variable for the I/O
outputs
error OUT BOOL Job completed with errors Checked Entered
1) Parameter types: IN = input parameters, OUT = output parameters, IN/OUT = in/out parameters
2) Note: The periOut parameter must be supplied with a variable of type ARRAY[0..15] of BYTE. Create a local or global
variable in your program under VAR (do not create a temporary variable under VAR_TEMP). After the FB has been
called, this variable must be assigned to the I/O variable for the I/O outputs of the module. See call example for CP 340.
Note
The CP 340 call example is an extract from the supplied E_CP340 application example,
which is included on the "SIMOTION Utilities & Applications" CD-ROM.
If you wish to control multiple CP 340 devices, you must create a new variable for the
data structure and FB instances with a new name for each CP 340 you implement.
UNIT E_CP340;
INTERFACE
VAR_GLOBAL
myExecSendCP340 : BOOL; // Trigger send task
myModuleAddrCP340 : DINT:=256; // module address
mySendDataArrayCP340 : ARRAY [0..1023] OF BYTE; // Send data array 1024 bytes
myInstCP340Send : _CP340_send; // Create instance of FB (1)
END_VAR
END_INTERFACE
IMPLEMENTATION
VAR_GLOBAL
MyResetSend : BOOL; // Cancel send order
END_VAR
VAR
MyCPOutputArray : ARRAY [0..15] OF BYTE; // Array for CP output data (3)
END_VAR
VAR_TEMP
MyDataLengthSend : UDINT; // Length of data to be sent
MyDataOffsetSend : UDINT; // Offset of first byte to be sent
END_VAR
END_IMPLEMENTATION
Note
The PROGRAM "ExampleCP340" must be assigned in the execution system.
Note
During the copy operation to the static memory area of the FB, data consistency cannot be
guaranteed if the send/receive data areas are accessed in a higher priority task.
Note
During the copy operation from the static memory area of the receive FB, data consistency
cannot be guaranteed if the send/receive data areas are accessed in a higher priority task.
When printing
The data in the printData parameter in the static memory area of the FB are copied when a
positive edge occurs at the execute input of the _CP340_printer FB. This means that once
the FB call has ended, you can write to the variable and the format string for the next print
request.
Function
This example shows how to:
● use the _CP340_send function block to send data from the Send data array to a
communications partner.
● use the _CP340_receive function block to receive data in the receive data array.
In the example program, the CP 340 is used both as sender and as receiver. This requires
the jumpering of the send and receive lines (PIN 2 and PIN 3 on the RS232 interface) and
the "ASCII" setting in the parameter assignment tool. The _CP340_send FB is used to
transfer the send data to the CP module. This sends the data using the RS232 interface. The
jumpered send and receive line means that the data to be sent is read immediately by the
CP module. The _CP340_receive FB reads the received data from the CP module and
copies these data to the receive data array.
This example requires proper installation of the parameter assignment tool, as described in
the SIMATIC CP 340 Point-to-Point Connection, Installation and Parameter Assignment
manual.
Hardware platform
The application example is available for various SIMOTION hardware platforms. You must
adapt the example for centralized applications with SIMOTION C.
Note
If the application example is not available for your hardware platform, you must adapt the
hardware configuration.
Note
You can either monitor and control the input and output variables used in the programming
example in the INTERFACE area of the unit (under VAR_GLOBAL) using the symbol
browser, or you can assign real inputs and outputs to the input and output variables in your
user program.
Note
Proper data transfer can be observed as follows:
The "TxD" and "RxD" LEDs on the CP module illuminate.
Output parameter (_CP_send FBs) done = TRUE or NewDataReceived = TRUE
Function
The example shows how to use the _CP340_printer function block to send
Struct_CP340_printData type data from the print memory area to a serial printer. For more
information, see Chapter _CP340_printer function block (Page 24).
In the example program, text examples with and without variables, date specifications, and
line and page feeds are output to the printer by means of the CP 340.
This example requires proper installation of the parameter assignment tool, as described in
the SIMATIC CP 340 Point-to-Point Connection, Installation and Parameter Assignment
manual.
Hardware platform
The application example is available for various SIMOTION hardware platforms.
Note
If the application example is not available for your hardware platform, you must adapt the
hardware configuration.
9. Under "Edit Message", enter a number on the left and the text on the right, as follows:
– 1 System level log
– 2 Date:
– 3 Level %I I reached at %Z (time)
Confirm your selection with OK.
10.To edit the page layout, double-click the Page Layout icon to open the relevant dialog
box.
11.Select the following settings in this dialog box:
– Left-hand margin: 3
– Lines per page: 20
– Separators / end of line: CR LF
– Header lines: Example: Printing with the CP 340 for SIMOTION
– Page footers: page %P
Confirm your selection with OK.
12.The default settings for the "IBM" character set remain selected under "Font" and "Control
Characters".
13.Apply your settings in the parameter assignment interface with the File > Save menu
command, and close the interface with the File > Exit menu command. Click OK to close
the Properties window for the CP 340 module.
14.Save the hardware configuration with the Station > Save and compile menu command.
15.Download the hardware configuration with the Target system > Download to module
menu command.
The red "SF" LED on the IM 153 turns on and then off if the assigned module parameters
have been downloaded without errors.
The date, time, and level quantity can be changed using the following variables:
● myDateGermany
● myTimeValue,
● myQuantity
Note
The active transfer job can be canceled by setting the "myStopPrinter" variable to "TRUE".
The _CP340_printer FB is reset to its initial state.
The sending of print jobs will remain disabled as long as the signal state of the
"myStopPrinter" variable is "TRUE".
Note
The SIMOTION identifiers have changed as of V4.0. A comparison of the SIMOTION and
SIMATIC identifiers can be found in the appendix SIMOTION and SIMATIC names
(Page 109) in the table "SIMOTION and SIMATIC identifiers CP 341".
SIMOTION SCOUT contains all of the required function blocks and the
Struct_CP341_Cl512Data data structure (for RK 512 computer link only) of the CP 341. The
function blocks can be used to control one or more CP 341 modules.
Function
The _CP341_send function block enables you to send data from the send data array to a
communications partner (3964(R) protocol, RK 512 protocol, ASCII driver) or to fetch data
from a communications partner and store it there (RK 512). You have 4,096 bytes available
for this.
Note
There is no parameter check for the _CP341_send function block. Incorrect parameterization
of this block may cause the SIMOTION device to switch to "STOP" mode.
Before the CP 341 can process an initiated job following a transition of the
SIMOTION device from "STOP" to "RUN" mode, the CP-SIMOTION startup mechanism of
the _CP341_send FB must be complete. Any jobs initiated in the meantime will not be lost.
They are transferred to the CP 341 once the startup coordination has finished.
The end of the startup coordination is indicated in output parameter startup = FALSE.
Note
Once the data have been entered in the static memory of the send FB, you can modify the
variable created in the data parameter. This does not affect the data to be sent.
B&3BVHQG
(1 (12
%22/ H[HFXWH GRQH %22/
%22/ UHVHW HUURU %22/
8',17 PRGXOH$GGUHVV HUURU,' :25'
8',17 GDWD2IIVHW HUURU,G7UDQVIHU ',17
8',17 GDWD/HQJWK VWDUWXS %22/
$55$<>@RI%<7( SHUL,Q
/$'VSHFLILFSDUDPHWHUV
Parameter description
Table 3- 1 Parameters of the _CP341_send FB (application with 3964(R) protocol or ASCII driver)
H[HFXWH
UHVHW
GRQH
HUURU
VWQWK6(1'SDUW
7UDQVIHUULQJDERUW
7UDQVIHUULQJDERUW
&RPSOHWLRQZLWK
6HQGUHTXHVWLV
ZLWKRXWHUURUV
ZLWKRXWHUURUV
QRWH[HFXWHG
&RPSOHWLRQ
&RPSOHWLRQ
VHQGLQJLV
6HQGLQJ
GLVDEOHG
UHTXHVW
HUURUV
Note
The execute input is edge-triggered. The send job starts when there is a positive edge at the
execute input.
Note
The handling of the _CP341_send FB differs according to whether data is to be exchanged
with a SIMOTION System or a SIMATIC System.
The parameter assignment is described below for a function block for SIMOTION with
SIMOTION communication.
You can send data to a communications partner by specifying 'SEND_CP' in the mode
parameter.
A positive edge at the execute input initiates the data transfer. A data transfer operation can
run over several calls (program cycles), depending on the amount of data involved.
The moduleAddress parameter specifies the module address of the CP that is to be used for
the data transfer.
The data to be sent is specified in the following parameters:
● data indicates the data array containing the send data.
● dataOffset corresponds to the array index containing the first send byte.
● dataLength corresponds to the amount of data to be sent in bytes.
You must also indicate where the data is to be entered on the receiver.
● The remoteCpuId parameter specifies the number of the receiver (relevant for
multiprocessor communication only).
● remoteDataType specifies the memory area where the data will be entered on the
receiver (if the communications partner is a SIMOTION device, 68 must always be
entered).
● remoteMemIndex specifies the memory index where the receive data will be entered.
RemoteMemIndex = 0 is not permissible. An error message will be generated.
● remoteDataOffset specifies the array index in which the first receive byte is to be entered.
Note
The above parameters relate to a variable addressed specifically by the receiver. The
receiver specifies the variable in which the data will be entered.
6HQGVLGH 5HFHLYHVLGH
$55$<
$55$<
YDULDEOHDGGUHVVHGE\UHFHLYHU
5HFHLYHGDWDDUHDGDWD&O
UHPRWH0HP,QGH[
UHPRWH'DWD2IIVHW $55$<
GDWD/HQJWK
$55$<
GDWD
GDWD2IIVHW
$55$<
GDWD/HQJWK
$55$<
The communication flag bit (see Chapter Special features related to data transfer
(Page 101)), which is checked in the receiver before the send job is initiated and set once
the send job is complete, is specified with parameters remoteComFlagByte (array index
containing the communication flag bit) and remoteComFlagBit (bit position of the
communication flag bit).
Note
The handling of the _CP341_send FB differs according to whether data is to be exchanged
with a SIMOTION System or a SIMATIC System.
The parameter assignment is described below for a function block for SIMOTION with
SIMATIC communication.
You can send data to a communications partner by specifying 'SEND_CP' in the mode
parameter.
A positive edge at the execute input initiates the data transfer. A data transfer operation can
run over several calls (program cycles), depending on the amount of data involved.
The moduleAddress parameter specifies the module address of the CP that is to be used for
the data transfer.
The data to be sent is specified in the following parameters:
● data indicates the data array containing the send data.
● dataOffset corresponds to the array index containing the first send byte.
● dataLength corresponds to the amount of data to be sent in bytes.
You must also indicate where the data is to be entered on the receiver.
● The remoteCpuId parameter specifies the number of the receiver (relevant for
multiprocessor communication only).
● remoteDataType indicates the memory area where data will be entered on the receiver.
– Data block = 68
– Extended data block = 88
– Flag = 77
– Input = 69
– Output = 65
– Counter = 90
– Timer = 84
● remoteMemIndex specifies the number of the data block or extended data block where
the receive data will be entered. It has no relevance for all other receive areas.
RemoteMemIndex = 0 is not permissible. An error message will be generated.
● remoteDataOffset specifies the array index in which the first receive byte is to be entered.
The communication flag bit (see Chapter Special features related to data transfer
(Page 101)), which is checked in the receiver before the send job is initiated and set once
the send job is complete, is specified with parameters remoteComFlagByte (array index
containing the communication flag bit) and remoteComFlagBit (bit position of the
communication flag bit) in the SIMATIC flag area.
Note
The handling of the _CP341_send FB differs according to whether data is to be exchanged
with a SIMOTION System or a SIMATIC System.
The parameter assignment is described below for a function block for SIMOTION with
SIMOTION communication.
You can fetch data from a communications partner by specifying "FETCH_CP" in the mode
parameter.
A positive edge at the execute input initiates the data transfer. A data transfer operation can
run over several calls (program cycles), depending on the amount of data involved.
The moduleAddress parameter specifies the module address of the CP that is to be used for
the data transfer.
You must also indicate where the data are to be fetched on the receiver.
● The remoteCpuId parameter specifies the number of the receiver (relevant for
multiprocessor communication only).
● remoteDataType specifies the memory area where the data will be fetched on the
receiver (if the communications partner is a SIMOTION device, 68 must always be
entered).
● remoteMemIndex specifies the memory index where the data will be fetched.
RemoteMemIndex = 0 is not permissible. An error message will be generated.
● remoteDataOffset specifies the array index where the first byte is to be fetched.
Note
The above parameters relate to a variable addressed specifically by the communications
partner. They specify the variable from which the data will be fetched.
6HQGVLGH 5HFHLYHVLGH
$55$<
$55$<
YDULDEOHDGGUHVVHGE\UHFHLYHU
5HFHLYHGDWDDUHDGDWD&O
UHPRWH0HP,QGH[
UHPRWH'DWD2IIVHW $55$<
GDWD/HQJWK
$55$<
GDWD
GDWD2IIVHW
$55$<
GDWD/HQJWK
$55$<
The following parameters are used to specify where the fetched data will be saved:
● data corresponds to the data array in which the requested data will be entered.
● dataOffset corresponds to the array index in which the first fetched data byte will be
entered.
● dataLength corresponds to the amount of data to be fetched in bytes.
The communication flag bit (see Chapter Special features related to data transfer
(Page 101)), which is checked in the receiver before the send job is initiated and set once
the fetch job is complete, is specified with parameters remoteComFlagByte (array index
containing the communication flag bit) and remoteComFlagBit (bit position of the
communication flag bit).
Note
The handling of the _CP341_send FB differs according to whether data is to be exchanged
with a SIMOTION System or a SIMATIC System.
The parameter assignment is described below for a function block for SIMOTION with
SIMATIC communication.
You can fetch data from a communications partner by specifying "FETCH_CP" in the mode
parameter.
A positive edge at the execute input initiates the data transfer. A data transfer operation can
run over several calls (program cycles), depending on the amount of data involved.
The moduleAddress parameter specifies the module address of the CP that is to be used for
the data transfer.
You must also indicate where the data is to be fetched on the communications partner.
● remoteCpuId specifies the number of the communications partner (relevant for
multiprocessor communication only).
● remoteDataType specifies the memory area where the data will be fetched on the
communications partner.
– Data block = 68
– Extended data block = 88
– Flag = 77
– Input = 69
– Output = 65
– Counter = 90
– Timer = 84
● remoteMemIndex specifies the number of the data block or extended data block where
the receive data will be fetched.
RemoteMemIndex = 0 is not permissible. An error message will be generated.
● remoteDataOffset specifies the array index where the first byte is to be fetched.
The following parameters are used to specify where the fetched data will be saved:
● data corresponds to the data array in which the requested data will be entered.
● dataOffset corresponds to the array index in which the first fetched data byte will be
entered.
● dataLength corresponds to the amount of data to be fetched in bytes.
The communication flag bit (see Chapter Special features related to data transfer
(Page 101)), which is checked in the communications partner before the send job is initiated
and set once the send job is complete, is specified with parameters remoteComFlagByte
(array index containing the communication flag bit) and remoteComFlagBit (bit position of the
communication flag bit) in the SIMATIC communication flag area.
B&3BVHQG
(1 (12
%22/ PRGH GRQH %22/
%22/ H[HFXWH HUURU %22/
%22/ UHVHW HUURU,' :25'
8',17 PRGXOH$GGUHVV HUURU,G7UDQVIHU ',17
8',17 GDWD2IIVHW VWDUWXS %22/
8',17 GDWD/HQJWK
86,17 UHPRWH&SX,G
86,17 UHPRWH'DWD7\SH
8,17 UHPRWH0HP,QGH[
8',17 UHPRWH'DWD2IIVHW
86,17 UHPRWH&RP)ODJ%\WH
86,17 UHPRWH&RP)ODJ%LW
$55$<>@RI%<7( SHUL,Q
/$'VSHFLILFSDUDPHWHUV
Parameter description
Function
The _CP341_receive function block enables you to receive data from a communications
partner in the receive data array (3964(R) protocol, ASCII driver, RK 512) or to make data
available for the communications partner (RK 512). Each data array depends on the type of
protocol used. If you are using the 3964(R) protocol or ASCII driver, the receive data array is
dataCl3964. For an RK 512 computer link, the data array is dataCl512. In both cases, 4,096
bytes are available. From the dataCl512 data array, data is also made available for the
communications partner.
Note
There is no parameter check for the _CP341_receive FB. Incorrect parameterization of this
block may cause the SIMOTION device to switch to "STOP" mode.
Before a job from the CP 341 can be received following a transition of the SIMOTION device
from "STOP" to "RUN" mode, the CP-SIMOTION startup mechanism of the _CP341_receive
FB must be complete.
The end of the startup coordination is indicated in output parameter startup = FALSE.
Note
To ensure data consistency, do not access the receive data array until all the data has been
received (newDataReceived = TRUE).
B&3BUHFHLYH
(1 (12
%22/ HQDEOH QHZ'DWD5HFHLYHG %22/
%22/ UHVHW HUURU %22/
',17 PRGXOH$GGUHVV HUURU,' :25'
8',17 GDWD2IIVHW GDWD/HQJWK 8',17
$55$<>@RI%<7( SHUL,Q HUURU,G7UDQVIHU ',17
VWDUWXS %22/
/$'VSHFLILFSDUDPHWHUV
HQDEOH
UHVHW
QHZ'DWD5HFHLYHG
HUURU
GDWD/HQJWK
&RPSOHWLRQZLWKRXWHUURUV
&RPSOHWLRQZLWKRXWHUURUV
&RPSOHWLRQZLWKHUURUV
&RPSOHWLRQZLWKHUURUV
5HFHLYLQJLVGLVDEOHG
(QDEOHUHFHLYLQJ
1RWUHFHLYLQJ
5HFHLYLQJ
5HFHLYLQJ
DERUW
Note
The handling of the _CP341_receive FB differs according to whether data is to be
exchanged with a SIMOTION System or a SIMATIC System.
The parameter assignment is described below for a function block for SIMOTION with
SIMOTION communication.
The data to be received will be entered in a variable created in the dataCl512 parameter.
The communications partner specifies where the receive data will be entered in the variable.
The information about the entry location is output at the following output parameters.
● localCpuId specifies the number of the receiver (relevant for multiprocessor
communication only).
● localDataType specifies the memory area where the receive data have been entered
(irrelevant for SIMOTION with SIMOTION communication).
● localMemIndex specifies the memory index where the receive data have been entered.
● localDataOffset specifies the array index where the first receive byte has been entered.
● dataLength corresponds to the amount of data received in bytes.
A static "TRUE" signal state in the enable parameter enables a check to determine whether
data are to be read from the CP 341. An active data transfer can be canceled with signal
state "FALSE" in the enable parameter. The canceled receive job is terminated with an error
message at the errorID output. The receive operation will remain disabled as long as the
signal state at the enable parameter is "FALSE". A data transfer operation can run over
several calls, depending on the amount of data involved.
The moduleAddress parameter specifies the module address of the CP that is to be used for
the data transfer.
The communication flag area (see Chapter Special features related to data transfer
(Page 101)) is specified by a variable created in the comFlags parameter. The
communication flag bit, which was checked in the receiver before the send job was initiated
and was set after the send job was finished, is indicated at output parameters
localComFlagByte (array index containing the communication flag bit) and localComFlagBit
(bit position of communication flag bit).
Note
The handling of the _CP341_receive FB differs according to whether data is to be
exchanged with a SIMOTION System or a SIMATIC System.
The parameter assignment is described below for a function block for SIMOTION with
SIMATIC communication.
The communications partner on the SIMATIC side must set the input parameters according
to the SIMOTION description.
HQDEOH
UHVHW
QHZ'DWD5HFHLYHG
HUURU
GDWD/HQJWK
&RPSOHWLRQZLWKRXWHUURUV
&RPSOHWLRQZLWKRXWHUURUV
&RPSOHWLRQZLWKHUURUV
&RPSOHWLRQZLWKHUURUV
5HFHLYLQJLVGLVDEOHG
(QDEOHUHFHLYLQJ
1RWUHFHLYLQJ
5HFHLYLQJ
5HFHLYLQJ
DERUW
)RU5.WKHSDUDPHWHUVRIWKHFXUUHQWUHTXHVWDUHDOVR
LQGLFDWHGDWWKHORFDORXWSXWVXQWLOWKHQH[WWLPHWKH)%LVFDOOHG
Note
The handling of the _CP341_receive FB differs according to whether data is to be
exchanged with a SIMOTION System or a SIMATIC System.
The parameter assignment is described below for a function block for SIMOTION with
SIMOTION communication.
Function block processing is enabled with static signal state "TRUE" in the enable
parameter. An active data transfer can be canceled with signal state "FALSE" in the enable
parameter. The canceled fetch job is terminated with an error message at the errorID output.
Data cannot be provided as long as the signal state at the enable parameter is "FALSE". A
data transfer operation can run over several calls, depending on the amount of data
involved.
The moduleAddress parameter specifies the module address of the CP that is to be used for
the data transfer.
The data to be provided are entered in a variable created in the dataCl512 parameter. The
communications partner specifies which data is to be fetched from the variable. The
information about the fetched data is output in the following output parameters.
● localCpuId specifies the number of the communications partner providing the data
(relevant for multiprocessor communication only).
● localDataType specifies the memory area where the data was fetched (irrelevant for
SIMOTION).
● localMemIndex specifies the memory index where the data were fetched.
● localDataOffset specifies the array index where the first data byte was fetched.
● dataLength corresponds to the amount of data sent in bytes.
Note
The handling of the _CP341_receive FB differs according to whether data is to be
exchanged with a SIMOTION System or a SIMATIC System.
The parameter assignment is described below for a function block for SIMOTION with
SIMATIC communication.
The communications partner on the SIMATIC side must specify the input parameters
according to the SIMOTION description.
HQDEOH
UHVHW
QHZ'DWD5HFHLYHG
HUURU
GDWD/HQJWK
&RPSOHWLRQZLWKRXWHUURUV
&RPSOHWLRQZLWKRXWHUURUV
&RPSOHWLRQZLWKHUURUV
&RPSOHWLRQZLWKHUURUV
5HFHLYLQJLVGLVDEOHG
(QDEOHUHFHLYLQJ
1RWUHFHLYLQJ
5HFHLYLQJ
5HFHLYLQJ
DERUW
)RU5.WKHSDUDPHWHUVRIWKHFXUUHQWUHTXHVWDUHDOVR
LQGLFDWHGDWWKHORFDORXWSXWVXQWLOWKHQH[WWLPHWKH)%LVFDOOHG
Note
There is no parameter check for the _CP341_receive FB. Incorrect parameterization of this
block may cause the SIMOTION device to switch to "STOP" mode.
Before a job from the CP 341 can be received following a transition of the SIMOTION device
from "STOP" to "RUN" mode, the CP-SIMOTION startup mechanism of the _CP341_receive
FB must be complete.
The end of the startup coordination is indicated in output parameter startup = FALSE.
B&3BUHFHLYH
(1 (12
%22/ HQDEOH ORFDO&SX,G 86,17
%22/ UHVHW ORFDO'DWD7\SH 86,17
8',17 PRGXOH$GGUHVV ORFDO0HP,QGH[ 8,17
$55$<>@RI%<7( SHUL,Q ORFDO'DWD2IIVHW 8',17
ORFDO&RP)ODJ%\WH 86,17
ORFDO&RP)ODJ%LW 86,17
QHZ'DWD5HFHLYHG %22/
HUURU %22/
HUURU,' :25'
GDWD/HQJWK 8',17
HUURU,G7UDQVIHU ',17
VWDUWXS %22/
/$'VSHFLILFSDUDPHWHUV
Parameter description
comFlags IN/OUT ARRAY[0..31] of Communication flag area for Entered and checked Entered
BYTE RK 512
localCpuId OUT USINT Number of the local Checked Entered
communications partner
localDataType OUT USINT Area type in the local Checked Entered
communications partner
localMemIndex OUT UINT Memory index in the local Checked Entered
communications partner
localDataOffset OUT UDINT First element in the local Checked Entered
communications partner
localComFlagByte OUT USINT Communication flag index in Checked Entered
the local communications
partner
localComFlagBit OUT USINT Communication flag bit no. Checked Entered
in the local communications
partner
newDataReceived OUT BOOL Job completed without Checked Entered
errors
error OUT BOOL Job completed with errors Checked Entered
Function
The _CP341_printer function block is used to send data of type Struct_CP341_printData from
the printer memory area to a serial printer. For example, the _CP341_printer function block
might send a process message to the CP 341. The CP 341 prints out the process message
on the connected printer.
B&3BSULQWHU
(1 (12
%22/ H[HFXWH GRQH %22/
%22/ UHVHW HUURU %22/
',17 PRGXOH$GGUHVV HUURU,' :25'
$55$<>@RI%<7( SHUL,Q VWDUWXS %22/
HUURU,G7UDQVIHU ',17
/$'VSHFLILFSDUDPHWHUV
Parameter description
H[HFXWH
UHVHW
GRQH
HUURU
HUURU,'
HUURU,G
7UDQVIHU
35,17
&DQFHO
(QGZLWKRXWHUURU
(QGZLWKRXWHUURU
7UDQVIHUUHVHW
7UDQVIHUHUURU
(QGZLWKHUURU
QRWEHH[HFXWHG
WUDQVPLWWLQJ
3ULQWMREZLOO
VZLWFKHGRII
Figure 3-7 Signal sequence diagram of the _CP341_printer FB
Note
The execute input is edge-triggered. The send job starts when there is a positive edge at the
execute input.
The moduleAddress parameter specifies the module address of the CP 341 being addressed
for the data set transfer.
For call examples for the _CP341_printer FB, see Chapter CP 341 print call examples
(Page 90).
Note
There is no parameter check for the _CP341_printer function block. Incorrect
parameterization of this block may cause the SIMOTION device to switch to "STOP" mode.
Before the CP 341 can process an initiated job following a transition of the SIMOTION
device from "STOP" to "RUN" mode, the CP-SIMOTION startup mechanism of the
_CP341_printer FB must be complete. Any jobs initiated in the meantime will not be lost.
They are transferred to the CP 341 once the startup coordination has finished.
The end of the startup coordination is indicated in output parameter startup = FALSE.
Struct_CP341_dataRecord : STRUCT
dataLength : UDINT; // Data quantity
data : ARRAY [0..31] of BYTE; // Data field
END_STRUCT
Struct_CP341_printData : STRUCT
variable : ARRAY [0..3] of Struct_CP341_dataRecord; // 1st to 4th variable
format : ARRAY [0..150] of BYTE; // Format string
END_STRUCT
The first variable to be printed corresponds to the variable [0] element, the second variable
to be printed corresponds to the variable [1] element, etc. The number of bytes to be printed
per variable is limited to 32. The data for variable i must be placed in
variable [i-1].data[0..31]. The number of bytes to be printed must be entered in the
variable [i-1].dataLength element.
The format string corresponds to the format element. The format string must be structured as
follows (refer to the SIMATIC CP 341 Point-to-Point Connection, Installation and Parameter
Assignment Manual):
● Specification of string length in format [0]
● Specification of individual characters in format [1 to 150]
Note
If the maximum length is exceeded, the print job is canceled and event number 16#1E41
is indicated at the errorID parameter output of the _CP341_printer FB.
Note
You can use supplemental function blocks (see Chapter supplemental function blocks
(Page 85)) to enter values into the printer memory area and to select message texts.
Example:
● Print message text no. 3 (stored in CP 341).
Configured message text: "This is message text no. 3"
Notes on handling
The format string entry in the "format" field must be hexadecimal.
Example:
% corresponds to 25 hex in the IBM character set,
N (message text output) corresponds to 4E hex in the IBM character set.
(see Hardware configuration > Character set)
Data types DATE, TIME, DATE_AND_TIME_OF_DAY and TIME_OF_DAY are not
supported. The date information must be entered as a DWORD or WORD in the printer data
structure.
Representation type "A" (German date format):
//datefrg:=4018 (01.01.2001) and 4199 (01.07.2001)
printData.variable[0].datalength:=2;
printData.variable[0].data[0]:=WORD_TO_BYTE(SHR(datefrg,8));
printData.variable[0].data[1]:=WORD_TO_BYTE(SHR(datefrg,0));
Representation type "F":
The value to be printed must be in floating point format (mantissa/exponent) (see call
example 2, Chapter CP 341 print call examples (Page 90))
Representation type "C":
If variable[ ].datalength:=1 in the printer data structure, the characters will be printed
horizontally. If variable[ ].datalength:=2 (3,4) in the printer data structure, the characters will
be printed vertically.
Representation type "X":
For CP 341 RS232, product version E08 and higher, representation type "X" (binary) outputs
the values correctly on a serial printer.
Disconnected printer
The communications link is not monitored for printers even if alarm generation is enabled in
HW Config of STEP 7.
Example:
● A break in the connection between the printer and the CP 341 triggers neither an error
nor a diagnostic alarm.
● Nor are they triggered if a print job is started but no printer is connected.
Note
The code in examples 1, 2, and 3 (see Chapter CP 341 print call examples (Page 90))
can be transferred to the SIMOTION SCOUT editor with Copy and Paste.
Function
Supplemental function blocks are provided for entering variables of various data types as
well as for entering message texts into data structure Struct_CP341_printData. You enter the
value of the variables byte by byte and in the proper format in the variable element of the
printer memory area and, optionally, in the format element. When numbers are entered for
message texts, one entry is made in each of the format and variable elements. The method
of representation for the variables in printed text and the method of entry in the format string
can be selected by means of parameters.
The following supplemental function blocks are available:
● _CP341_realToPrintData
Entry of a number of data type REAL into data structure Struct_CP341_printData
● _CP341_dwordToPrintData
Entry of a number of data type DWORD into data structure Struct_CP341_printData
● _CP341_wordToPrintData
Entry of a number of data type WORD into data structure Struct_CP341_printData
● _CP341_byteToPrintData
Entry of a number of data type BYTE into data structure Struct_CP341_printData
● _CP341_dintToPrintData
Entry of a number of data type DINT into data structure Struct_CP341_printData
● _CP341_intToPrintData
Entry of a number of data type INT into data structure Struct_CP341_printData
● _CP341_printMsgText
Selection of message texts stored in CP 341
Note
SINT and USINT data types can be entered into data structure Struct_CP341_printData
with the _CP341_intToPrintData function block. Type conversion is implicit.
Parameter description
Table 3- 7 _CP341_realToPrintData
Table 3- 9 _CP341_printMsgText
Call example 1
UNIT E1CP341p;
INTERFACE
VAR_GLOBAL
myPreparePrintData : BOOL; // Initiate prepare print request
myRequestPrint : BOOL; // Initiate transfer to printer
myReset : BOOL; // Abort print
myActualLevel : REAL := 5.67; // actual value "level"
myModuleAddress_1 : DINT:= 256; // address of 1st CP341 module
myPrintData : Struct_CP341_printData; // instance of datastruct
myFB_CP341_printMessageText : _CP341_printMsgText; // instances of function blocks
myFB_CP341_realToPrintData : _CP341_realToPrintData; // instances of function blocks
myFB_CP341_print : _CP341_printer; // instance of function block
myOutputArrayCP341_1 : ARRAY[0..15] of BYTE; // field for CP341 output data
END_VAR
PROGRAM Example_print_1; // program for BackgroundTask
END_INTERFACE
IMPLEMENTATION
PROGRAM Example_print_1
// BackgroundTask program
END_PROGRAM //Example_print_1
END_IMPLEMENTATION
Call example 2
UNIT E2CP341p;
INTERFACE
VAR_GLOBAL
myRequestPrint : BOOL; // Initiate transfer to printer
myReset : BOOL; // abort print
myPrintDword : DWORD; // value to print out
myModuleAddress_1 : DINT := 256; // address of 1st CP341 module
myPrintData : Struct_CP341_printData; // instance of datastruct
myFB_CP341_print : _CP341_printer; // instance of function block
myOutputArrayCP341_1 : ARRAY[0..15] OF BYTE; // field for CP341 output data
END_VAR
PROGRAM Example_print_2; // program for BackgroundTask
END_INTERFACE
IMPLEMENTATION
PROGRAM Example_print_2 // BackgroundTask program
// example with notation "F" and variable of type DWORD
// (containing mantissa and exponent)
// assignment for variable (type DWORD), to print out with notation "F"
myPrintDword := REAL_TO_DWORD(10000.0); // variable (DWORD) with mantissa and exponent
// !!!
// ATTENTION! wrong example for this case is an assingnment with an integer value e.g.:
// myprintDword := 10000; // because the format is WITHOUT mantissa and exponent
// !!!
END_PROGRAM //Example_print_2
END_IMPLEMENTATION
Call example 3
UNIT E3CP341p;
INTERFACE
VAR_GLOBAL
myRequestPrint : BOOL; // Initiate transfer to printer
myReset : BOOL; // Abort print
myPrintReal1 : REAL; // 1st value
myPrintReal2 : REAL; // 2nd value
myPrintReal3 : REAL; // 3rd value
myModuleAddress_1 : DINT := 256; // address of 1st CP341 module
myPrintData : Struct_CP341_printData; // instance of datastruct
myFB_CP341_print : _CP341_printer; // instance of function block
myFB_CP341_realToprintData1 : _CP341_realToPrintData; // instances of function blocks
myFB_CP341_realToprintData2 : _CP341_realToPrintData; // instances of function blocks
myFB_CP341_realToprintData3 : _CP341_realToPrintData; // instances of function blocks
myOutputArrayCP341_1 : ARRAY[0..15] OF BYTE;
END_VAR
PROGRAM Example_print_3; // program for BackgroundTask
END_INTERFACE
IMPLEMENTATION
PROGRAM Example_print_3 // BackgroundTask program
// The following example program demonstrates usage of _CP341_realToPrintData()
END_PROGRAM //Example_print_3
END_IMPLEMENTATION
Function
The _CP341_getV24Signals function block reads the RS-232-C accompanying signals from
the CP 341 and makes them available to the user in the block parameters. The functionality
of the _CP341_getV24Signals FB can only be used if a parameterized ASCII driver is
specified.
B&3BJHW96LJQDOV
(1 (12
/$'VSHFLILFSDUDPHWHUV
Parameter description
Note
A minimum pulse duration is necessary to detect a signal change. Determining factors are
the cycle time (SIMOTION device), the update time on the CP 341, and the response time of
the communications partner.
Function
The _CP341_setV24Signals function block can be used to set or reset RS-232-C
accompanying signals. The functionality of the _CP341_setV24Signals FB can only be used
if a parameterized ASCII driver is specified.
B&3BVHW96LJQDOV
(1 (12
%22/ HQDEOH HUURU %22/
%22/ VLJ'WU
%22/ VLJ5WV
/$'VSHFLILFSDUDPHWHUV
Parameter description
Name P type 1) Data type Meaning Actions performed by user Actions performed by
block
enable IN BOOL Block enable Entered Checked
sigDtr IN BOOL Data terminal ready Entered Checked
sigRts IN BOOL Request to send Entered Checked
periOut IN/OUT ARRAY [0..15] Prepared FB data for the I/O Checked and transferred to the Entered
of BYTE outputs of the CP 2) I/O variables for the I/O outputs
error OUT BOOL Job completed with errors Checked Entered
1) Parameter types: IN = input parameters, OUT = output parameters, IN/OUT = in/out parameters
2) Note: The periOut parameter must be supplied with a variable of type ARRAY[0..15] of BYTE. Create a local or global
variable in your program under VAR (do not create a temporary variable under VAR_TEMP). After the FB has been
called, this variable must be assigned to the I/O variable for the I/O outputs of the module. See call example for CP 341.
Note
The CP 341 call example is an extract from the supplied E_CP341 application example,
which is included on the "SIMOTION Utilities & Applications" CD-ROM.
If you wish to control multiple CP 341 devices, you must create a new variable for the
data structure and FB instances with a new name for each CP 341 you implement.
UNIT E_CP341;
INTERFACE
VAR_GLOBAL
myExecSendCP341 : BOOL; // Trigger send task
myModuleAddrCP341 : DINT:=256; // module address
mySendDataArrayCP341 : ARRAY [0..4095] OF BYTE; // Send data array 4,096 bytes
myInstCP341Send : _CP341_send; // Create instance of FB (1)
END_VAR
END_INTERFACE
IMPLEMENTATION
VAR_GLOBAL
MyResetSend : BOOL; // Cancel send order
END_VAR
VAR_TEMP
MyDataLengthSend : UDINT; // Length of data to be sent
MyDataOffsetSend : UDINT; // Offset of first byte to be sent
END_VAR
END_PROGRAM // ExampleCP341
END_IMPLEMENTATION
Note
The "ExampleCP341" program must be assigned in the execution system.
Note
During the copy operation to the static memory area of the FB, data consistency cannot be
guaranteed if the send/receive data areas are accessed in a higher priority task.
Note
During the copy operation from the static memory area of the receive FB, data consistency
cannot be guaranteed if the send/receive data areas are accessed in a higher priority task.
SIMOTION ↔ SIMOTION
In the variable (ARRAY [0..31] of BYTE) created in the comFlags parameter, the bit position
of the communication flag bit to be checked or set is specified as follows:
● remoteComFlagByte corresponds to the array index of the byte in which the bit is to be
set/checked.
● remoteComFlagBit corresponds to the bit position in the byte specified by the
remoteComFlagByte parameter.
Note
The same variable must always be transferred at the comFlags parameter during the
block call to ensure consistency of the communication flag bit.
SIMOTION ↔ SIMATIC
Communication flags are always stored in the flag area MB0 to MB254 in SIMATIC. The bit
position of the communication flag bit to be checked or set is specified as follows:
● remoteComFlagByte corresponds to the flag byte in which the bit is to be set or checked
(e.g. remoteComFlagByte=1 corresponds to MB1).
● remoteComFlagBit corresponds to the bit position in the byte specified by the
remoteComFlagByte parameter.
Note
If you fetch data from a CP 341, a _CP341_receive function block must be programmed
for the communications partner.
Passive jobs:
The _CP341_receive function block enables you to use passive jobs to coordinate the
reading of data on the CP 341 and make the data available. The communications partner is
active. You can
● Enter data sent by the communications partner in the dataCl512 receive data array.
● Make data available from dataCl512 for a remote communications partner.
Function
This example shows how to:
● use the _CP341_send function block to send data from the Send data array to a
communications partner.
● use the _CP341_receive function block to receive data in the receive data array.
In the example program, the CP 341 is used both as the sender and receiver. This requires
the jumpering of the send and receive lines (PIN 2 and PIN 3 on the RS232 interface) and
the "ASCII" setting in the parameter assignment tool. The _CP341_send FB is used to
transfer the send data to the CP module. This sends the data using the RS232 interface. The
jumpered send and receive line means that the data to be sent is read immediately by the
CP module. The _CP341_receive FB reads the received data from the CP module and
copies these data to the receive data array.
This example requires proper installation of the parameter assignment tool, as described in
the SIMATIC CP 341 Point-to-Point Connection, Installation and Parameter Assignment
manual.
Hardware platform
The application example is available for various SIMOTION hardware platforms. You must
adapt the example for centralized applications with SIMOTION C.
Note
If the application example is not available for your hardware platform, you must adapt the
hardware configuration.
Note
You can monitor and control the input and output variables used in the programming
example in the INTERFACE area of the unit (under VAR_GLOBAL); alternatively, you can
assign real inputs and outputs to the input and output variables in your user program.
Receiving data:
To receive data, you must set the "myEnableToReceive" variable to "TRUE" (static signal). If
receive jobs 1 and 3 are enabled (myReceiveOrder1 = TRUE and
"myReceiveOrder3" = TRUE), the data is stored in the "myReceiveDataArrayCP341" data
array starting with the "myReceiveDataArrayCP341[0]" array element (data offset is 0). If job
2 is enabled ("myReceiveOrder2" = TRUE), the data is stored in the
"myReceiveDataArrayCP341" data array starting with the "myReceiveDataArrayCP341[20]"
array element (data offset is 20).
If "myNewDataReceived" = TRUE, this indicates that new data has been received. This
signal is present for one cycle only.
If an error occurred during the transfer ("myReceiveError" = TRUE) the error code is stored
in the "mySendErrorNumber" variable. If error code 16#1E0F is present in
"myReceiveErrorNumber", an error occurred during the data transfer. The transfer error code
is stored in the "myReceiveTransErrorNumber" variable. The error signals are reset when
you set input "myResetReceive" = TRUE.
Sending data:
You can use the "mySendOrder1", "mySendOrder2" and "mySendOrder3" inputs to select
between three send jobs:
● Job 1 sends 10 bytes of data from the "mySendDataArrayCP341" data array from array
element "mySendDataArrayCP341[0]" to "mySendDataArrayCP341[9]"
● Job 2 sends 20 bytes of data from the "mySendDataArrayCP341" data array from array
element "mySendDataArrayCP341[20]" to "mySendDataArrayCP341[39]"
● Job 3 sends 4,096 bytes of data from the "mySendDataArrayCP341" data array.
The data is sent to the communications partner if the "myExecSendCP341" input detects a
signal change from "FALSE" to "TRUE" (positive edge).
If output signal "mySendDone" = TRUE, the send job has been completed. A new job can be
sent if the "myExecSendCP341" input signal detects another signal change from FALSE to
TRUE.
If an error occurred during the transfer ("mySendError" = TRUE), the error code is stored in
the "mySendErrorNumber" variable. If error code 16#1E0F is present in
"mySendErrorNumber", an error occurred during the data transfer. The transfer error code is
stored in the "mySendTransErrorNumber" variable. The error signals are reset when you set
input "myExecSendCP341" = FALSE.
When the signal state at the "myResetSend" or "myResetReceive" input is set to "TRUE",
the send job or receive job is canceled, respectively. If the signal state remains "TRUE",
sending and receiving of data is disabled.
Note
Proper data transfer can be observed as follows:
The "TxD" and "RxD" LEDs on the CP module illuminate.
Output parameter (_CP341_send FB) done = TRUE or NewDataReceived = TRUE
$ODUPHYHQW
3HULSKHUDO)DXOW7DVN
:KLFKLQWHUUXSW"
76,LQWHUUXSW,'
'LDJQRVWLFLQWHUUXSW
76,LQWHUUXSW,' B6&B',$*1267,&B,17(55837
7ULJJHULQJPRGXOH"
76,ORJ%DVH$GU,Q
76,ORJ%DVH$GU2XW
$ODUPLQIRUPDWLRQ
76,GHWDLOV
Alarm evaluation
Alarms originating from the I/O are evaluated in the PeripheralFaultTask. When the
PeripheralFaultTask is started, the Taskstartinfo is made available, which you can evaluate
in the user program.
The Taskstartinfo of PeripheralFaultTask is comparable to the local data of OB82 in the
SIMATIC system.
Bit assignment
The TSI#details variable is assigned in the same way as in a SIMATIC system.
Note
More information is available in the following SIMATIC manuals:
CP 340 Point-to-Point Connection, Installation and Parameter Assignment
CP 341 Point-to-Point Connection, Installation and Parameter Assignment
Name in the SIMOTION system Name in the SIMATIC system Name in the SIMOTION system
as of V4.0 up to V3.2
(command library in SCOUT) (SIMOTION Function Library)
Function block parameters
Name in the SIMOTION system Name in the SIMATIC system Name in the SIMOTION system
as of V4.0 up to V3.2
(command library in SCOUT) (SIMOTION Function Library)
_CP340_printer FB P_PRINT (FB 4) _FB_CP340_print
execute REQ request
reset R abort
moduleAddress LADDR moduleAddress
periIn - inputInterface
periOut - outputInterface
printData (DB_NO/DBB_NO) printerData
done DONE done
error ERROR error
errorID STATUS errorNumber
errorIdTransfer - transferErrorNumber
startup - startup
Name in the SIMOTION system Name in the SIMATIC system Name in the SIMOTION system
as of V4.0 up to V3.2
(command library in SCOUT) (SIMOTION Function Library)
Module parameters (supplemental Module parameters (supplemental function blocks)
function blocks)
_CP340_byteToPrintData, - _FB_CP340_byteToPrinterdata,
_CP340_wordToPrintData, _FB_CP340_wordToPrinterdata,
_CP340_dwordToPrintData, _FB_CP340_dwordToPrinterdata,
execute - execute
data - data
numVariable - numberVariable
entryFormatString - entryFormatstring
entryAtByteNumber - entryAtByteNumber
printData - printerData
done - done
error - error
_CP340_realToPrintData - _FB_CP340_realToPrinterdata
execute - execute
data - data
numVariable - numberVariable
entryFormatString - entryFormatstring
entryAtByteNumber - entryAtByteNumber
printData - printerData
done - done
error - error
_CP340_dintToPrintData, - _FB_CP340_dintToPrinterdata,
_CP340_intToPrintData _FB_CP340_intToPrinterdata
execute - execute
data - data
numVariable - numberVariable
entryFormatString - entryFormatstring
entryAtByteNumber - entryAtByteNumber
printData - printerData
done - done
error - error
_CP340_printMsgText - _FB_CP340_printMessageText
execute - execute
numMsgText - numberMsgText
numVariable numberVariable
entryFormatString - entryFormatstring
entryAtByteNumber - entryAtByteNumber
printData - printerData
done - done
error - error
Name in the SIMOTION system Name in the SIMATIC system Name in the SIMOTION system
as of V4.0 up to V3.2
(command library in SCOUT) (SIMOTION function library)
Function block parameters
_CP341_send FB P_SND_RK (FB 8) _FB_CP341_send
mode SF operatingMode
execute REQ request
reset R abort
moduleAddress LADDR moduleAddress
dataOffset DBB_NO dataOffset
dataLength LEN dataLength
periIn - inputInterface
periOut - outputInterface
data DB_NO data
done DONE done
error ERROR error
errorID STATUS errorNumber
errorIdTransfer - transferErrorNumber
remoteCpuId R_CPU_NO (computer interfacing) remoteCPUNumber
remoteDataType R_Typ (computer interfacing) remoteDataType
remoteMemIndex R_NO (computer interfacing) remoteMemoryIndex
remoteDataOffset R_OFFSET (computer interfacing) remoteDataOffset
remoteComFlagByte R_CF_BYT (computer interfacing) remoteComFlagByte
remoteComFlagBit R_CF_BIT (computer interfacing) remoteComFlagBit
startup _ startup
Name in the SIMOTION system Name in the SIMATIC system Name in the SIMOTION system
as of V4.0 up to V3.2
(command library in SCOUT) (SIMOTION function library)
localCpuId - localCPUNumber
localDataType L_TYP (computer interfacing) localDataType
localMemIndex L_NO (computer interfacing) localMemoryIndex
localDataOffset L_OFFSET (computer interfacing) localDataOffset
localComFlagByte L_CF_BYT (computer interfacing) localComFlagByte
localComFlagBit L_CF_BIT (computer interfacing) localComFlagBit
startup _ startup
_CP341_byteToPrintData, - No equivalent
_CP341_wordToPrintData,
_CP341_dwordToPrintData,
_CP341_realToPrintData,
_CP341_dintToPrintData,
_CP341_intToPrintData,
_CP341_printMsgText
Name in the SIMOTION system Name in the SIMATIC system Name in the SIMOTION system
as of V4.0 up to V3.2
(command library in SCOUT) (SIMOTION function library)
_CP341_setV24Signals FC V24_SET (FC 6) _FB_CP341_setV24Signals
enable -
periIn - inputInterface
error -
sigDtr DTR signalDTR
sigRts RTS signalRTS
periOut - outputInterface
Table A- 3 Abbreviations
Abbreviation Meaning
CP Communications processor
DP Distributed I/O
FB Function block
HW Hardware
IM Interface Modul (SIMATIC S7-300 interface module)
IN Input parameters
IN/OUT In/out parameters
I/O Input/Output
LAD Ladder Logic
LED Light Emitting Diode (Light emitting diodes)
OUT Output parameter
RK Computer link