×
Siemens Industry Online Support
Siemens AG
Entry type: FAQ Entry ID: 14690552, Entry date: 05/23/2003
(1)
Rate

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?

  • Entry
  • Associated product(s)
For this type of communication you can use the HyperTerminal software available in Windows.

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. 

Note
How to use the delay between characters mode is described in Entry ID 14690998. Another example using the START/END delimiter mode is given in Entry ID 14693176.

Configuration on the S7 side

  1. Open your STEP 7 project and your Hardware Configuration.
  2. Add a PROFIBUS master system to the integrated interface of your S7 CPU or to your PROFIBUS DP CP.
  3. Now add to the master system the "DP/RS 232C link" contained in the hardware catalog under "Other field devices > Gateway".
      

    Fig. 1
        
  4. Assign the DP address set on the device.
    Important
    Please do not use the address 99, because it is reserved for internal diagnostics functions.
  5. Now go to the "Parameter Assignment" tab and open the folder "Device-specific parameters".
  6. Make the settings as illustrated in the figure below.
      

    Fig. 3
     
    - red fields    = connection settings of the serial interface
    - blue fields  = configuration of the number of characters mode
    - white fields = not needed for the configuration    )         
    Note
    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).
  1. Add a "Universal module" to Slot 0 of your link.
  2. 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".
     

    Fig. 3 
      
  3. Save the Hardware Configuration and load it into your CPU.

Configuration on the Windows side

  1. Start the "HyperTerminal" software on your PC and assign a name of your choice for the connection.
     

    Fig. 4
     
  2. Select "COM1" as the interface.
     

    Fig. 5
     
  3. Now make the following interface settings (similar to the configuration of the parameters "Baud rate" and "Parity" in Fig. 2).
     

    Fig. 6  
       
  4. 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.
     

    Fig. 7 

 Testing the connection

  1. Open a variables table in STEP 7 in addition to the HyperTerminal.
  2. Enter the input and output byte addresses 0...8.
  3. Set up an online connection between the variables table and your CPU.
  4. Enter one character per output byte and transfer these values to the CPU.
  5. The data is now also displayed in the HyperTerminal window.
     

    Fig. 8
      
  6. As can be seen in the figure above, only 8 characters are transferred. The first characters always contains the length of the character string.
  7. Now enter a character string in the HyperTerminal.
  8. The data is then displayed in the separate input bytes of the variables table. 
     

    Fig. 9
     
  9. If the data is read, then likewise only 8 characters can be transferred. The first byte contains the number of bytes transferred. 

Important
You must always specify all eight characters in the HyperTerminal or in the variables table. Only then is the transferred triggered.

Note
Technical information on the DP/RS 232C link is available in Entry ID 1177086.

Security information
In order to protect technical infrastructures, systems, machines and networks against cyber threats, it is necessary to implement – and continuously maintain – a holistic, state-of-the-art IT security concept. Siemens’ products and solutions constitute one element of such a concept. For more information about cyber security, please visit
https://www.siemens.com/cybersecurity#Ouraspiration.