Siemens Industry Online Support
Siemens AG
Entry type: FAQ Entry ID: 28378295, Entry date: 02/19/2008

How can you send or receive data via the serial interface in WinCC Runtime?

  • Entry
  • Associated product(s)

This entry describes how you can send and receive data via the serial interface of your PC in WinCC. For example, in this way you can read in the data of a barcode scanner.

Configuration Notes:
You need the Microsoft Communications Control (mscomm32.ocx) for communicating via the serial interface. However, no liability is assumed nor guarantee granted for the use of third-party ActiveX controls.

The sample scripts have been created in VBS using the following WinCC tags and objects:


  • "Connection" - Binary Tag
  • "Buffer" - Text tag 8-bit
  • "Output" - Text tag 8-bit


  • "Main.pdl" - WinCC picture
  • "MSComm1" - Microsoft Communications Control, V6.0

You can download the sample scripts here to make things easier:

Scripte_CommPort.zip ( 1 KB )


No. Description:
1 Insert the "Microsoft Communications Control"
Insert the control in a WinCC picture. There are no further settings to make. However, you should note that you can only use the function of the control if it is located in an active picture.
2 Open and parameterize CommPort
The following VB script shows how you open a port of the serial interface:

Fig. 01

3 Close CommPort
The following VB script shows how you close an open port of the serial interface:

Fig. 02

4 Read out the read buffer (receive data)
The following VB script shows how you read data out of the receive buffer:

Fig. 03

In the example, this global action is called via a cyclic trigger. However, you should note that cyclic triggers can be a heavy load on the system. It is better to configure an event trigger for this.

5 Send data
The following script sends a string via the serial interface:

Fig. 04

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
Rate entry
no rating
Requests and feedback
What do you want to do?