Rockwell Automation 6001-F2E AB STANDARD DRIVER SFTW User Manual

Page 18

Advertising
background image

Writing Your Own Application Program

Chapter 4

4-5

Parameters for Send_StdDrv()

Assign the parameters in Table 4.D:

Table 4.D
Assigning Parameters to Send Data

Parameter

Type

Description

device[] = “KR:0” char

The device parameter should coincide with the same device used in the Open_StdDrv()
function (Set this value to KR:0.)

io_stat[2];

unsigned int

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

When the Standard Driver 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 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].

cmd_buff[...]

unsigned char The cmd_buff parameter is the buffer containing your message to be sent to the remote

station. Use the following format:

LEN TYP DST SRC CMD STS TNS TNS DATA

The LEN field contains the entire packet length, including LEN. The TYP field is the
message type. Set this value to 0 or 5, depending on the message type. The DST field is the
DH-485 destination where your message is sent. The SRC field is the local 1784-KR DH-485
address. This field can be set to 0. See appendix B for definitions of each field.

pass_thru = 1;
pass_thru = 0;

int

The pass_thru parameter is a reply option for the Standard Driver. When pass_thru is set to
1, the entire reply message (the header and the data you requested) is placed in your buffer.
When the pass_thru parameter is set to 0, only the data you requested (not the header) is
placed in your buffer. The length is returned in io_stat[1].

reply_buff[...];

unsigned char The reply_buff parameter tells the driver where to put a reply message to your application.The

reply message is copied into your buffer using the following format:

LEN TYP DST SRC CMD STS TNS TNS DATA

timeout = 5;

unsigned int

The timeout parameter is the number of seconds your application waits for a reply message.

0, 0

N/A

Parameters 7 and 8 are not used, but you still need to include them in the function call. Type
in a zero for both parameters.

See Appendix D for return

status

values for the Send_StdDrv()

function.

Advertising