Communication Protocols
Copyright IXXAT Automation GmbH
124
IEM Manual, 1.5
address. For an example of accessing a local built-in Ethernet POWERLINK
variable see Figure 5-29.
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 Ethernet POWERLINK address (0x1006, 0x00)
s_service.s_address.s_epl.w_index = 0x1006;
s_service.s_address.s_epl.w_subindex = 0x00;
// 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 has to be set in callback
{
e_ret = EMI_srvServiceHandle(td_brdRef); // polling event mechanism
}
// 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 object 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-29: Accessing a built-in variable
All variables can be accessed from both the host controller and a remote
Ethernet POWERLINK device. The efficient implementation of process data
transfer imposes some restrictions on the access of Ethernet POWERLINK
variables located in the cyclic data area of the SHM. Variables located in this
area can either be written or read by the host controller respectively the re-