How can you send data to an S7-CPU and receive data from an S7-CPU via the serial interface of the PC and a DP/RS 232C link?
This software is generally available in "Start > Programs > Accessories > Communication". There might be slight differences depending on the version of the operating system used. If the program is not available on the computer, then please go ahead and install it from your Windows installation CD on which it is included by default.
Below is a description of serial communication via the DP/RS 232C link in number of characters mode.
Configuration on the S7 side
- Open your STEP 7 project and your Hardware Configuration.
- Add a PROFIBUS master system to the integrated interface of your S7 CPU or to your PROFIBUS DP CP.
- Now add to the master system the "DP/RS 232C link" contained in
the hardware catalog under "Other field devices > Gateway".
- Assign the DP address set on the device.
Please do not use the address 99, because it is reserved for internal diagnostics functions.
- Now go to the "Parameter Assignment" tab and open the folder "Device-specific parameters".
- Make the settings as illustrated in the figure below.
- red fields = connection settings of the serial interface
- blue fields = configuration of the number of characters mode
- white fields = not needed for the configuration )
The "Baud rate" and "Parity" parameters of the DP/RS 232C link have to match the "Bits per second" and "Parity" parameters of the COM interface (see Fig. 6).
- Add a "Universal module" to Slot 0 of your link.
- Configure and input/output module with the start addresses I0
and Q0. For the length of the data area please specify 9 and Byte
(8 bytes of data + 1 byte for the length specification) and select
"Unit" for "Consistent over".
- Save the Hardware Configuration and load it into your CPU.
Configuration on the Windows side
- Start the "HyperTerminal" software on your PC and assign a name
of your choice for the connection.
- Select "COM1" as the interface.
- Now make the following interface settings (similar to the
configuration of the parameters "Baud rate" and "Parity" in Fig.
- Open the Properties of the HyperTerminal connection and set the
check box "Echo typed characters locally". This ensures that your
entries are displayed simultaneously in the output window.
Testing the connection
- Open a variables table in STEP 7 in addition to the HyperTerminal.
- Enter the input and output byte addresses 0...8.
- Set up an online connection between the variables table and your CPU.
- Enter one character per output byte and transfer these values to the CPU.
- The data is now also displayed in the HyperTerminal
- As can be seen in the figure above, only 8 characters are transferred. The first characters always contains the length of the character string.
- Now enter a character string in the HyperTerminal.
- The data is then displayed in the separate input bytes of the
- If the data is read, then likewise only 8 characters can be transferred. The first byte contains the number of bytes transferred.
You must always specify all eight characters in the HyperTerminal or in the variables table. Only then is the transferred triggered.
Technical information on the DP/RS 232C link is available in Entry ID 1177086.