X hits on this document

98 views

0 shares

0 downloads

0 comments

35 / 37

MODBUS Communications Driver - Functions

Word

Input Value

Integer

Values

Output Array

Integer Array

void MB WordToArray(short Word, short Values[]);

_

DESCRIPTION

This command splits an integer into its 16 component bits. It stores the bits in the first sixteen elements of the target array. Bit 0 (the least significant bit) is assigned to element 0 of the array.

SYNOPSIS

WordToArray: Break Word into Array

EXAMPLE

short bits[16];

MB_WordToArray(0xCC55, bits);

char wrk[32]; char *p = wrk;

short *vp = bits + 15;

for (int n=15; n>=0; n--) { *p++ = (*vp--) ? '1' : if (!(n & 7)) *p++ = ' if (!(n & 3)) *p++ = '

'0'; '; ';

// Add digits // Add spacing // Add spacing

}

*p = 0;

MessageBox(NULL, wrk,

" 0 x C C 5 5 a s B i n a r y i s . . . " , M B O K ) ;

_

Revision 2.210

June 6, 1998

Page 27

Document info
Document views98
Page views100
Page last viewedThu Dec 08 12:28:52 UTC 2016
Pages37
Paragraphs781
Words6172

Comments