X hits on this document

101 views

0 shares

0 downloads

0 comments

24 / 37

MODBUS Communications Driver - Functions

status

Error Return

Integer

Address

Destination Address

Integer

Start

Starting Point No.

Long Integer

Count

Count

Integer < 1950

Values

Data

Integer Array

short status = MB_ForceMultipleCoils(short Address, long Start, short Count, short Values[]);

DESCRIPTION

This command is the converse of the Read Output Status command. It writes new values onto "Count" consecutive coils (address 0xxxx) starting at the Starting Point Number (Start). Like the Read Output Status command, the Data array, which contains the new values for the coils, is "packed". This is, each 16-bit word in the Data array corresponds to 16 Output coils, beginning with the LSb of array element 0 and continuing upwards toward Bit 15.

SYNOPSIS

ForceMultipleCoils: Write (Force) Multiple Coils

EXAMPLE

short bits[10];

// Value array

bits[0] = 0x27CD; bits[1] = 127;

// Set up bit values

short status = MB ForceMultipleCoils(11, 144, 23, bits);

_

if (status != 0) MessageBox(NULL, MB ErrorString(status),

"ForceMultipleCoils Error",

_

MB_OK);

This sample will write a total of 23 coil values.

The least significant bit of bits[0] will

determine the new value of Coil 144, Bit 1 of bits[0] corresponds to Coil 145, and so on, through Bit 7 of bits[1], which corresponds to Coil 166.

Page 16

June 6, 1998

Revision 2.210

Document info
Document views101
Page views103
Page last viewedFri Dec 09 06:28:48 UTC 2016
Pages37
Paragraphs781
Words6172

Comments