Communication Protocols
Copyright IXXAT Automation GmbH
94
IEM Manual, 1.5
cessed by means of their protocol specific address. For an example of access-
ing a local built-in EIP variable see Figure 5-5.
COM_t_BOARD_REF td_brdRef = ...
COM_e_ERROR e_ret;
COM_t_SERVICE_DATA s_request;
COM_t_REQUEST_REF s_reqRef;
COM_t_SERVICE_HEADER *ps_h =(COM_t_SERVICE_HEADER*)&s_request.ab_comData[0];
COM_t_GET_VALUE s_service;
COM_t_SERVICE_DATA *ps_response;
COM_t_SERVICE_HEADER *ps_hr;
COM_t_GET_VALUE_R *ps_service;
UINT32 dw_value;
memset(&s_request, 0x00, sizeof(COM_t_SERVICE_DATA));
s_request.w_service_com = COM_k_GET_VALUE;
ps_h->pb_data = (UINT8*)&s_service; // link to service command
s_service.dw_reference = 0; // protocol specific variable
// specify EIP address (0xF6, 1, 6)
s_service.s_address.s_eip.w_class = 0xF6;
s_service.s_address.s_eip.dw_instance = 1;
s_service.s_address.s_eip.w_attribute = 6; // Interface Control attribute
// enqueue GET_VALUE service request
e_ret = EMI_srvreqSend(td_brdRef, 0, &s_request, &s_reqRef, NULL);
// send request and wait for response (signalled via callback)
while (!received) // global variable received is set in callback
{
e_ret = EMI_srvServiceHandle(td_brdRef);
}
// read response
e_ret = EMI_srvrespQuery(&s_conRef, s_reqRef, NULL, &ps_response);
// evaluate response
ps_hr = (COM_t_SERVICE_HEADER*)&ps_response->ab_comData[0];
ps_service = (COM_t_GET_VALUE_R*)ps_hr->pb_data;
// read EIP attribute value from response
MEMCPY(&dw_value,&ps_service->ab_parameter[0],4);
// deallocate dynamic memory of response
e_ret = EMI_srvrespServiceCompleted(s_reqRef);
Figure 5-5: Accessing a built-in variable
All variables can be accessed from both the host controller and a remote EIP
device. The efficient implementation of process data transfer imposes some
restrictions on the access of EIP variables located in the cyclic data area of the
SHM. Variables located in this area can only either be written or read by the
host controller respectively the remote device.
Using both the
Set_Attribute_Single and the Get_Attribute_Single service for the same
variable is only possible if the variable is located on the host controller
or in the acyclic data area of the SHM.
Figure 5-6 gives an overview about