Returns, Description, C example – Rockwell Automation 1771-DMC_DMC1_DMC4_DXPS Control Coprocessor User Manual User Manual

Page 214

Advertising
background image

API Library of Routines

Appendix B

DTL_WRITE_W

B-83

Returns

Status

Symbolic Name

Meaning

0

DTL_SUCCESS

Operation successful

15

DTL_E_R_ONLY

Data item defined as READ only

19

DTL_E_NOINIT

DEFINE table not initialized

20

DTL_E_BADID

Definition ID out of range

24

DTL_E_FAIL

I/O completed with errors

32

DTL_E_NODEF

No such data item defined

41

DTL_E_CNVT

DataĆconversion error, I/O not attempted

157

CC_E_NOTCONNECT

PLC is not connected or offline

Description

Use the DTL_WRITE_W function to write data to the PLC-5
programmable controller directly connected to the control coprocessor.

This function is synchronous. When this function is initiated, your
C application program stops until the function completes or fails.

C Example

unsigned status;

unsigned machine1;

unsigned short parts1;

unsigned iostat;

.

.

.

DTL_C_DEFINE (&machine1, “N30:0, 1, WORD, MODIFY”);

.

.

.

status = DTL_WRITE_W (machine1, &parts1, &iostat)

if (status == DTL_SUCCESS)

{

printf (“parts = %d\n”, parts1);

}

else

{

(printf (“error %d, %d on read of parts data\n”,

status,

iostat);

}

.

.

.

Advertising