Communication Protocols
Copyright IXXAT Automation GmbH
87
IEM Manual, 1.5
The API 0 is automatically registered by the IEM itself, only additional user-
specific profiles have to be registered. Also, the DAP (Device Access Point)
module with the corresponding submodules (Interface, Ports) are added by
default automatically. Moreover, the user has no access to the DAP data; the
IEM manages all external requests (e.g. I&M requests) to the DAP by itself.
5.1.3 Variable access
To address the variable that shall be read or written, the protocol specific ad-
dress in the PROFINET device model has to be specified. The protocol specif-
ic address is the triple (API, slot, subslot) for cyclic process data and the quad-
ruple (API, slot, subslot, index) for acyclic data. Since all variables in
PROFINET are located either on the host controller (records) or stored in the
SHM of the IEM (process data, records), they must be registered in the IEM by
means of the “Create” service (see code example in Figure 5-2).
Note:
Before any variable could be created, a triple (API, slot, sub slot)
has to be registered in the IEM (see chapter 5.1.2).
For an example of creating a cyclic process variable in the SHM see
COM_t_BOARD_REF td_brdRef = ...
COM_e_ERROR e_ret;
COM_t_CMD_REQUEST s_cmd;
COM_t_CREATE *p_c;
COM_t_CMD_RESPONSE s_response;
UINT32 dw_reference; // variable reference
memset(&s_cmd, 0x00, sizeof(COM_t_CMD_REQUEST));
s_cmd.dw_command = COM_k_CREATE;
p_c = (COM_t_CREATE*)&s_cmd.ab_comData[0];
p_c->w_type = COM_k_COMPLEX;
p_c->w_size = 400; // size of variable
p_c->dw_offset = 0;
// location of output variable is an output IO data area of shared memory
p_c->dw_attributes = COM_k_ATTR_WRITE | COM_k_ATTR_PROCESS;
// specify PNIO address
p_c->s_address.s_pfn.dw_api = 0xABCDEF00;
p_c->s_address.s_pfn.w_slot = 1;
p_c->s_address.s_pfn.w_subslot = 1;
// register variable in output IO data area of shared memory
e_ret = EMI_cmdChannelConfigure(td_brdRef,&s_cmd,TRUE,&s_response); // blocking
// read variable reference
dw_reference = *(UINT32*)&s_response.ab_res_data[0];
Figure 5-2: Creating a cyclic process variable