Rockwell Automation 6001-F2E AB STANDARD DRIVER SFTW User Manual

Page 16

Advertising
background image

Writing Your Own Application Program

Chapter 4

4-3

Refer to Appendix B for each of the available Application Library
routines.

Table 4.C
Appl_StdDrv() Message Block Data Structure

Variable

Type

Description

DHP_MSG.dev = device;

char

The device variable indicates to the Standard Driver the communication
interface and its channel. Set this variable to KR:0.

DHP_MSG.stat = &io_stat[0];

unsigned int

The io_stat variable serves two purposes. When Application Library routines
are called, they return status before any type of reply is received from the
remote device.

When the Appl_StdDrv() successfully initiates a request to send a message
(status = 1), io_stat[0] is reset to 0. When a reply message is received or a
reply timeout occurs that matches the original request, io_stat[0] is set to a
value greater than 0. Normal completion is 1. If io_stat[0] is normal,
io_stat[1] will contain the length of the reply data buffer.

If io_stat does not equal 1, an error occurred. The format is as follows:
The low byte (EXT STS) of io_stat[0] contains local errors, such as timeout.
The High byte (STS) of io_stat[0] contains DH-485 errors. If the high byte of
io_stat[0] equals F0 Hex (indicating the extended DH-485 status), the low
byte if io_stat[0] will contain the extended DH-485 status value. See
appendix D for more information on error messages. See table 4.F for
examples of STS and EXT STS bytes in io_stat[0].

DHP_MSG.L_R = Loc_Rem;

int

Set this variable to 0.

DHP_MSG.dst = &destination;

unsigned char The DH-485 destination address. The destination variable is the DH-485

address where you want your message to be sent on the DH-485 network.

DHP_MSG.dta = &dt_addr

unsigned int

The data table address. Depending on the routine, the dt_addr variable is a
two byte value or string describing the data table address where data is to be
read from or written to.

DHP_MSG.len = size;

int

When reading data, the size variable indicates how many data bytes are to
be read. When writing data, the size variable indicates how many bytes
should be copied from the data buffer and written to the remote station.

DHP_MSG.buf = &d_buff[0];

unsigned char
or
int

The application data buffer. The application data may take on several
formats. If you are using byte values, d_buff may be defined as a char array,
the size variable is defined as a one-to-one relationship. If you are using
signed integers, data is automatically stored in byte swapped format, the size
value is defined as a two-to-one relationship.

DHP_MSG.TO = timeout;

unsigned int

The timeout variable is the number of seconds that you want to wait for a
reply.

Important: If you are communicating to an SLC-500 using the
unprotected read or unprotected write commands, create Data File 9 in the
SLC-500. The SLC-500 uses this file for DH-485 communication. The
data table address (defined as dt_addr in the Appl_StdDrv() function) will

Advertising