CP 243-1
Operating Instructions, 03/2012, C79000-G8976-C244-02
131
Sample program
C
Below, you will find an example of how to handle the CP 243-1 as an S7 client. This example
shows how to use the subroutines created by the Internet wizard integrated in STEP 7
Micro/WIN 32 at the end of configuration. The data block in which the configuration is stored
by the Internet wizard is specified at the end of the program code.
The sample program is included on the QuickStart CD for SIMATIC NET along with the
configuration as a STEP 7 Micro/WIN 32 project. To run this program you will need Ethernet
access to a second S7-200 system on which there is a suitably configured S7 server.
The user name for the administrator in the sample program is "root" and the password is
"rootroot".
Program code
Project name: Example_Client
Version: 02.01
Date: 20.01.2003
Target hardware: CPU 224 with CP 243-1 in slot 0
Description: Sample program for communication between two S7-200 stations via Industrial
Ethernet.
A character string ("CP243") that is stored starting at address VB500 and with a length of 5
bytes is sent from the local S7-200 system to another S7-200 system. It is stored there at the
same address and then read back from there. This procedure is repeated continuously.
The associated server must be configured as a suitable counterpart. The user program that
runs on the server simply has to call up the ETHx_CTRL subroutine. Calls for the ETHx_XFR
subroutine are not required for operating the server.
The CRC check is enabled.
The configuration (IP addresses, …) must be adapted to the current situation. The "CP243"
string must be stored starting at address VB500.
NETWORK 1
The ETHT0_CTRL subroutine initializes and monitors the CP 243-1.
Status bit SM0.0 is generated at input "EN". This ensures that the subroutine is always
activated. As soon as the CP 243-1 has completed startup, the "CP_Ready" and
"CH_Ready" outputs are set. If an error occurred in the configuration, the "Error" output is
set. The transferred error code is stored in memory word 2. It can be read out in the status
table.
LD Always_On
CALL ETH0_CTRL, cp_ready, ch_ready, cp_error
Содержание SIMATIC NET CP 243-1
Страница 6: ...Preface CP 243 1 6 Operating Instructions 03 2012 C79000 G8976 C244 02 ...
Страница 10: ...Table of contents CP 243 1 10 Operating Instructions 03 2012 C79000 G8976 C244 02 ...
Страница 104: ...Programming 4 5 ETHx_FTPC CP 243 1 104 Operating Instructions 03 2012 C79000 G8976 C244 02 ...
Страница 118: ...Diagnostics 5 2 Error messages of the CP 243 1 CP 243 1 118 Operating Instructions 03 2012 C79000 G8976 C244 02 ...
Страница 124: ...Certification CP 243 1 124 Operating Instructions 03 2012 C79000 G8976 C244 02 ...
Страница 138: ...Sample program CP 243 1 138 Operating Instructions 03 2012 C79000 G8976 C244 02 ...
Страница 142: ...Index CP 243 1 142 Operating Instructions 03 2012 C79000 G8976 C244 02 ...