Industrial Automation
Industrial Automation | Europe

myKnowledge

Main > Product Type > Automation Systems > PLCs
Minimize Text   Default    Enlarge Text
 

Print
E-mail

Sending ASCII Data Strings with a PLC


Objectives

This article provides general information about transmitting ASCII data strings from a PLC.

Introduction

Applications often require the need to send specific character strings from a PLC to an externally connected, third party device. External hardware such as bar code readers, vision systems, modems and other devices may require transmission of commands in the form serial data during operation. Omron PLCs have several hardware configurations that can communicate in this fashion.

  • - Built-in serial port on the PLC CPU Unit (such as CP1 series, CJ2M series as well as older PLCs)
  • - Option boards on the PLC CPU Unit (such as CP1W-CIF01 and CS1W-SCB21-V1)
  • - Serial communications units (such as CJ1W-SCU21-V1, CJ1W-SCU22, CJ1W-SCU41-V1 and CS1W-SCU21-V1)
  •  
Content 

Hardware Configuration
Always ensure proper serial cable wiring between the PLC and the external device, specifically regarding the transmit data (TD), send data (SD) and signal ground (SG) pins. Other connector pins may be required such as the RST, CTS, DSR or DTR depending on device specifications. Refer to the external device documentation for connection details.


Port Settings
It is normally necessary to change the communication settings of the PLC serial port to match those of the external device. Determine the baud rate, data bits, parity and stop bits of the external device and make them match in the PLC. A common example of these settings might be 9600-8-N-1 respectively meaning baud rate of 9600, 8 data bits, parity of None, and 1 stop bit.

To send (and receive) ASCII data using one of the above hardware configurations, the serial port must be set to RS-232C mode/No-protocol Mode*. This prevents other protocols such as NT-Link or Host Link from being applied to the serial communications. When RS-232C/No-Protocol mode is selected, the user has the ability to control the start code and end code for each message transmitted. The start code and end code must match the external device specifications in order to establish communications.

*NOTE: When changing the mode of a serial port, always check any hardware dip-switch settings in the related hardware manual.

User Program
A PLC program must be created to control the transmission of ASCII serial data. When using C-series PLCs, send data with the TXD(236)/TXDU(256)/DTXDU(262) instructions. More information about these instructions can be found in the CS/CJ/NSJ Series Instruction Reference Manual (Cat. No. W474).

 

Summary

This article is a general overview of sending ASCII data strings from a PLC. More detail and examples can be found in the CS/CJ/NSJ Series Instruction Reference Manual (Cat. No. W474). 
 

 

 




Comments (View All Comments / Add Comment)

Related Articles
No related articles found.
Created 2008-09-11
Modified 2014-02-10
Views 13471

 

You are not logged in.