8 cautions when making communications programs, For the master station, Example of communications program – Nor-Cal SDC15 Controller User Manual

Page 174

Advertising
background image

7 - 8

Cautions when Making Communications
Programs for the Master Station

7-16

Pay attention to the following points when making communications programs:

• The longest response time on the device is two seconds. For this reason, set the response monitor time to two

seconds.

• Resend the same message if there is no response within two seconds. Set a communications error to occur if

there is no response even after two retries.

• Be sure to make the above resends to guard against the case when the message cannot be send correctly due to

the influence of noise, for example, during communications.

Note

When the master station resends the message, alternatively use the device ID

codes "X" and "x." This is convenient as you can tell whether or not the received

message is the previously received message.

Example of communications program

A sample program is installed in the folder in which the smart loader package

SLP-C35

has been installed.

In the default setting, the directory is "c:¥program files¥slp¥slpc35¥cpl.cpp".

The program is written in Borland's C++Builder5.0 or Borland C++Compiler5.5

for Windows95/98/NT/2000.

This program is given here as a reference when the user makes a program, and

does not assure all the operations.

You can download Borland C++Compiler5.5 from Borland Home Page.

Handling Precautions

Yamatake assumes no responsibility with regard to any trouble caused by

using this program.

Prior to running the sample program

Make sure to check the settings for communications type, station address,

transmission speed and data format of the instrument.

Running the sample program

This program is used for reading and writing data. When the program is executed,

the application layers of the instruction message and response message

communicated are indicated.

command:RS,14356W,2

result:00,0,0

command:WS,14357W,2

result:00

Sample indication of execution results

Processing of the sample program

• Communication settings

Call open() and initialize the RS-232C serial port.

• Command execution

Set a desired character string in 'command' and call AppCPL().

Chapter 7. CPL COMMUNICATIONS FUNCTIONS

Advertising