Rockwell Automation 1771-DMC_DMC1_DMC4_DXPS Control Coprocessor User Manual User Manual

Page 248

Advertising
background image

API Library of Routines

Appendix B

TAG_DEFINE

B-117

Returns

Value

Symbolic Name

Meaning

0

CC_SUCCESS

Operation successful

131

CC_E_TOOBIG

Data item is greater than maximum allowed

175

CC_E_BADTAG

Invalid TAG name

177

CC_E_TAGFULL

TAG table is full

184

CC_E_DUP

Duplicate TAG

186

CC_E_BADACC

Bad value for TAG access

Description

Use TAG_DEFINE to place a TAG name entry into the TAG table. The
TAG name is a symbolic reference to the user’s designated data area. The
TAG_DEFINE routine also returns a handle with which the calling task
can refer to the TAG area on subsequent TAG_ calls. This handle is an
offset into the TAG table. This makes subsequent access to the table faster
than doing a symbolic name search.

When a process defines a TAG name, a pointer referencing the tagged
memory is stored in the TAG table. If the process that defined the TAG
aborts or is terminated, the memory referenced by the TAG pointer is
returned to the free memory pool. The TAG pointer still exists in the TAG
table, but that memory no longer addresses the TAG and may contain
invalid data.

ATTENTION: A process that creates any TAG
must not terminate if that TAG is to remain valid.
To correctly remove a TAG, use the TAG_UNDEF
or TAG_GLOBAL_UNDEF function or reset the
coprocessor module.

C Example

unsigned off;

unsigned fred;

unsigned status;

status = TAG_DEFINE

(&off,&fred,“Fred”,sizeof(fred),TG_MODIFY);

Advertising