X hits on this document

81 views

0 shares

0 downloads

0 comments

27 / 37

MODBUS Communications Driver - Functions

Loopback: Loopback Test

SYNOPSIS

status

Error Return

Integer

Address

Destination Address

Integer

DiagCode

Test to run

Integer (by reference)

Info

Test parameter

Integer (by reference)

DESCRIPTION

short status = MB Loopback(short Address, short *Diagnostic, short

_

*Info);

Runs a diagnostic on the MODBUS device. The DiagCode parameter specifies which diagnostic to run; the Info parameter may be used by some diagnostic operations and ignored by others. Some diagnostic functions will return information via the Info parameter.

The specific diagnostics available vary from device to device, but diagnostic 0, the Loopback test, is always implemented. This test simply sends back the Info value unchanged (so Info should be the same before and after the call).

Returns 0 for success or an error code.

EXAMPLE

short dcode, dval;

dcode = 0; dval = 1234;

// Run the the basic Loopback test // Test value for loopback

short status = MB Loopback(3, &dcode, &dval);

_

if (status != 0)

MessageBox(NULL, MB_OK); else MessageBox(NULL,

MB ErrorString(status),

"Loopback Error",

_

(dval == 1234) ? "Device 3 Loopback OK" :

"Device 3 Loopback failed!", "Loopback", MB_OK);

Revision 2.210

June 6, 1998

Page 19

Document info
Document views81
Page views83
Page last viewedSat Dec 03 12:38:40 UTC 2016
Pages37
Paragraphs781
Words6172

Comments