<< Prev        Next >>

ID : 608

Data Communication

Data communication is a function enables you to communicate data with external devices in PacScript.

Task and Line

In Data communication, task opens a line and data communication will be performed through the line.

Once a task opens the line, the task acquires a communication permission of the line and the line cannot be opened by the other tasks. Task can open multiple lines, but a line cannot be opened by the multiple tasks concurrently. The line which has already opened cannot be accessed by the other tasks.*

Regardless of task status or running mode, the controller retains the information about line number and which task opens until the power supply turns OFF.

In Data communication function, the task can close the line which is not opened by the task when only designating "-1" for argument in Comm.Close method. This is a process to close the entire lines forcedly in case of when a system freezes with the line opened by the task. This should be used for error processing routine etc, not for regular task.

Selection of Communication Method

You can select from two types of communication methods Ethernet or RS-232C for data communication.

The communication method should be assigned according to the line number.

RS-232C

In RS-232C communication, handshake is not performed, so the line should be opened surely using Comm.Open.

When the line is opened, transmitted data will be stored in the communication buffer. Acquire the stored data using Comm.Input.

Line numbers of RS-232C are 1, 2, 3, 40 and 41.

Correspondence between a line number and a physical port can be designated in "Communication port setting". Refer to setting screen.

Ethernet

Line numbers of Ethernet are 4 to 15.

Ethernet data communication sends/receives data after surely establishing the line connection.

In Ethernet data communication, the communication will be established by "client" line connection to "server" line. "Server" and "Client" communication will be established in one-to-one basis.

Process of establishing Ethernet line communication is as follows.

  1. Open the server side line.
  2. Open the client side line. An error message will be displayed when the server line is not opened.
  3. Send/receive data.

Selection of Data Type

You can select the following two types of data for communication.

Text
Send/receive text data.
Binary
Send/receive binary data. Refer to "data communication in binary mode."

Commands Used in Data Communication

You can use the following commands for data communication.

Command name Function
Comm.Open Open the line for data communication.
Comm.Close Close the specified line for data communication.
Comm.Output Send data through data communication function.
Comm.Input Receive data through data communication function.
Comm.Clear Clear the receive buffer of data communication.
Comm.Count Return the number of bytes for data which can be read from receive buffer of data communication function.
Comm.State Return port status of data communication function.

ID : 608

<< Prev        Next >>

Related Information
Line number