Rockwell Automation 1771-DMC_DMC1_DMC4_DXPS Control Coprocessor User Manual User Manual

Page 200

Advertising
background image

API Library of Routines

Appendix B

DTL_READ_W_IDX

B-69

C Example

unsigned machine;

unsigned short parts[10];

unsigned iostat;

DTL_C_DEFINE (&machine, “N20:0, 1, WORD, MODIFY”);

DTL_READ_W_IDX (machine, &parts[3], &iostat, 3) /* read element N20:3 */

DTL_READ_W_IDX (machine, &parts[8], &iostat, 8) /* read element N20:8 */

BASIC Example

The BASIC function code is 20.

procedure COPRO

DIM status : INTEGER

DIM id : INTEGER

DIM iostat : INTEGER

DIM val3 : INTEGER

DIM val8 : INTEGER

.

.

.

rem * Define the data file

RUN AB_BAS (2, status, ADDR(id), “N10:0, 1, LONG, MODIFY”)

rem * Read N10:3 to val3

RUN AB_BAS (20, status, id, ADDR(val3), ADDR(iostat), 3)

rem * Read N10:8 to val8

RUN AB_BAS (20, status, id, ADDR(val8), ADDR(iostat), 8)

.

.

.

References

DTL_C_DEFINE(); DTL_WRITE_W_IDX();

Advertising