PLC2U.com

...The latest article and sample code for your automation and control

  • Increase font size
  • Default font size
  • Decrease font size
Home Article PLC S7-200 Tip: Using a Bar Code Reader

S7-200 Tip: Using a Bar Code Reader

Special Hardware Requirements:
  • 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)

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).

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.

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.

s7-200 Tip: Using bar code reader

 

 

Project Example

 


Related articles:

Powered By relatedArticle

Blog Catalog

My BlogCatalog BlogRank

Blog Directory

Blog Directory & Search engine

Blog Directory

Technology

Visitors Counter

mod_vvisit_countermod_vvisit_countermod_vvisit_countermod_vvisit_countermod_vvisit_countermod_vvisit_counter
mod_vvisit_counterToday99
mod_vvisit_counterYesterday154
mod_vvisit_counterThis week465
mod_vvisit_counterLast week811
mod_vvisit_counterThis month955
mod_vvisit_counterLast month3010
mod_vvisit_counterAll days22686