Dtl_get_word – Rockwell Automation 1771-DMC_DMC1_DMC4_DXPS Control Coprocessor User Manual User Manual
Page 180

API Library of Routines
Appendix B
DTL_GET_WORD
B-49
Gets a word from a byte array.
C Syntax
#include <copro.h>
short DTL_GET_WORD (in_buf)
unsigned char *in_buf;
Parameters
in_buf
Use to specify an array of two bytes containing programmable-
controller data.
Returns
Variable
Value
word_val
(short)
word_val is the value generated by combining the two bytes into one word.; the
bytes are assumed to have been read into the data area using the RAW qualifier
Description
Use the DTL_GET_WORD function to extract two bytes from a byte array
in programmable-controller format (raw) and returns a word (short) value
in control-coprocessor format.
C Example
short word_val;
unsigned char untyped_data[50];
unsigned machine;
unsigned iostat;
.
.
.
DTL_C_DEFINE (&machine, “N7:0,25,RAW,READ”);
if (DTL_READ_W (machine, untyped_data, &iostat)==DTL_SUCCESS)
{
word_val = DTL_GET_WORD (&untyped_data[11]);
}
DTL_GET_WORD