PROFINET Device4.2.0
 
Loading...
Searching...
No Matches

◆ PN_API_IOD_getLastApduStatus()

uint32_t PN_API_IOD_getLastApduStatus ( PN_API_IOD_Handle_t *const  pnHandle,
const uint32_t  arNum,
uint32_t *const  apduStatus 
)

Gets the Application Protocol Data Unit (APDU) status of the output data.

If the user application reads output data from the IO controller using standard PN_API_IOD_initiateDataRead(), the corresponding 4-Byte long APDU status is stored within Profinet stack. Using the function, the user application can read this value which contains: Cycle counter normalized to the base value of 32.25 us (bytes 0 & 1) (see note below), APDU status (see PN_API_IOD_ApduStatusByteMask_t) and transfer status (byte 3).

Note
When the cycle counter of two consecutive PN_API_IOD_initiateDataRead() calls differs by 64, the time interval between these IO data is 2 ms, calculated as (64 * 31.25 us = 2 ms).
Parameters
[in]pnHandleProfinet API Handle.
[in]arNumAR number.
[in]apduStatusAPDU status.
Returns
result of the operation as uint32_t.
Return values
PN_API_OKSuccess.
PN_API_ERR_PARAMInvalid parameter.
Example
#include "pn_api_iod_data.h"
PN_API_IOD_Handle_t* pnHandle = NULL;
uint32_t status, arNum = 1, apduStatus = 0;
pnHandle = PN_API_IOD_new();
//Implement PN_API_IOD_dataReadCbf in the user application
...
//Register callback functions
...
status = PN_API_IOD_initiateDataRead(pnHandle);
status = PN_API_IOD_getLastApduStatus(pnHandle, arNum, &apduStatus);
uint32_t PN_API_IOD_initiateDataRead(PN_API_IOD_Handle_t *const pnHandle)
Initiates data read in Profinet stack and Performs one-time exchange of IO output data between the us...
uint32_t PN_API_IOD_getLastApduStatus(PN_API_IOD_Handle_t *const pnHandle, const uint32_t arNum, uint32_t *const apduStatus)
Gets the Application Protocol Data Unit (APDU) status of the output data.
PN_API_IOD_Handle_t * PN_API_IOD_new(void)
Creates Profinet API handle.
struct PN_API_IOD_Handle PN_API_IOD_Handle_t
API handle instance which holds IO device's info.
Definition pn_api_iod_types.h:61