- One PC/PPI cable
- One converter (depends on the interface of the bar code reader: for example, a 9-pin male to 25-pin female converter, or a null modem adapter for swapping lines 2 and 3)
- One bar code reader
- One bar code decoder (sometimes reader and decoder are one unit)
This example demonstrates how to use an S7-200 CPU to receive data from a bar code reader by means of the Freeport communication mode of the CPU. You can use Freeport mode to transmit data and to receive data. In this case, you are receiving data from the bar code reader. The CPU receives the information through Port 0.NOTE: One problem might occur. Because the SIMATIC S7-200 and the bar code reader both behave as slaves (data communications equipment, or DCE), the data transfer of each device tries to run in the same direction. This means that both the receive and transmit data lines end up connected to each other (lines 2 and 3). You can avoid this problem by setting up the converter properly or by using an appropriate wiring adapter (a null modem adapter).
You can use the Freeport mode to define your communication protocol. You select the Freeport protocol in special memory byte SMB30 (for Port 0 of your S7-200 CPU) or SMB130 (for Port 1 of your S7-200 CPU, if your CPU has two ports). You also store the information needed for communication in one of these special memory bytes. After selecting the Freeport mode, you declare the following:
- Baud rate
- Number of data bits per character
- Parity
The bar code reader reads the bar code, interprets the information, and transmits the data to the S7-200 CPU by means of the Freeport mode. Two buffers store the codes in the memory of the S7-200 CPU. The program switches from one buffer to the other with every new incoming bar code.
Usually such data is used by a process. However, in this example, the information is only stored in the receive buffers and can be viewed using the S7-200 programming package.


















