Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This chapter lists the API functions that are provided by GOAL CCLIEFB. See the applications provides in appl/goal_ccliefb for a demonstration. For further details please refer to the Reference Manual.

The function goal_cclIeFbNew creates a handle that represents the stack instance. All functions with the exception of goal_cclIeFbInit and the configuration functions require this handle as a parameter.

In order to use these functions the header goal_ccl_ie_fb.h must be included.

goal_cclIeFbInit

Register the GOAL CC-Link IE Field Basic stack in GOAL. Returns a GOAL_STATUS_T value as result. This function must be called within the function appl_init().

No parameters required.

Code Block
languagec
res = goal_cclIeFbInit();

goal_cclIeFbNew

Create a new GOAL CC-Link IE Field Basic stack slave instance with the given id and register an application callback handler. Returns a GOAL_STATUS_T value as result. This function must be called within the function appl_setup().
Returns a GOAL_STATUS_T value as result.

Table: goal_cclIeFbNew parameters

Parameter

Description

GOAL_CCLIEFB_HANDLE_T **ppCfb

GOAL CCLIEFB instance reference

uint32_t id

instance id

GOAL_CCLIEFB_FUNC_CB_T pFunc

GOAL CCLIEFB callback function

Code Block
languagec
res = goal_cclIeFbNew(&pCfbHdl, GOAL_CCLIEFB_INSTANCE_DEFAULT, appl_cclfbCb);

goal_cclIeFbAppStopSet

This function is used to indicate the stop status to the Master station. If the application is stopped process data is neither sent nor received until the application is started again. Here a GOAL_BOOL_T flag is passed, GOAL_TRUE means the application is stopping, GOAL_FALSE means, that the application is starting (again). This flag is sent in the cyclicData response messages of the slave.
Returns a GOAL_STATUS_T value as result.

Table: goal_cclIeFbAppStopSet parameters

Parameter

Description

GOAL_CCLIEFB_HANDLE_T *pCfb

GOAL CCLIEFB handle

GOAL_BOOL_T stop

application stop flag

Code Block
languagec
res = goal_cclIeFbAppStopSet(&pCfbHdl, BOOL_TRUE);

goal_cclIeFbAppErrorCodeSet

This function is used to indicate the stop status to the Master station. This can be used to indicate the reason of an stopped application. These error bytes are sent in the cyclicData response messages of the slave.
Returns a GOAL_STATUS_T value as result.

Parameter

Description

GOAL_CCLIEFB_HANDLE_T *pCfb

GOAL CCLIEFB handle

uint16_t errCode

application error code

uint32_t errDetails

additional information

Table: goal_cclIeFbAppErrorCodeSet parameters

Code Block
languagec
res = goal_cclIeFbAppErrorCodeSet(&pCfbHdl, 1, 17);

goal_cclIeFbIoAccessStart

This function is used to get access to the I/O data. This function must be used before any goal_cclIeFbOutputGet and goal_cclIeFbInputSet call corresponding to one process data image to lock internal resources to ensure consistency of I/O data across multiple read and write operations.
Returns a GOAL_STATUS_T value as result.

Parameter

Description

GOAL_CCLIEFB_HANDLE_T *pCfb

GOAL CCLIEFB handle

Table: goal_cclIeFbIoAccessStart parameters

Code Block
languagec
res = goal_cclIeFbIoAccessStart(pCfbHdl);

goal_cclIeFbIoAccessEnd

This function is used to return access to the I/O data. This function must be used after all goal_cclIeFbOutputGet and goal_cclIeFbInputSet calls corresponding to one process data image to unlock internal resources to ensure the correct update of I/O data.
Returns a GOAL_STATUS_T value as result.

Table: goal_cclIeFbIoAccessEnd parameters

Parameter

Description

GOAL_CCLIEFB_HANDLE_T *pCfb

GOAL CCLIEFB handle

Code Block
languagec
res = goal_cclIeFbIoAccessEnd(pCfbHdl);

goal_cclIeFbOutputGet

This function is used to get the output data from the master belonging to one of the link devices RY or RWw. It is possible to read more than one station at once. Further it is possible to get a part of the cyclic data only by addressing using an offset. Between two different read commands it may be possible, that the stack updated the cyclic data.
Returns a GOAL_STATUS_T value as result.

Table: goal_cclIeFbOutputGet parameters

Parameter

Description

GOAL_CCLIEFB_HANDLE_T *pCfb

GOAL CCLIEFB handle

GOAL_CCLIEFB_LINK_DEV_ID_T devId

link device Id

uint8_t *pBuf

write buffer

uint16_t bufLen

write buffer length

uint16_t offset

offset within link device

Code Block
languagec
uint8_t ry0;                                /* first byte from RY Link device */
res = goal_cclIeFbOutputGet(pCfbHdl, 
                            GOAL_CCLIEFB_LINK_DEV_RY, 
                            &ry0, 
                            sizeof(uint8_t), 
                            0);

goal_cclIeFbInputSet

This function is used to get the output data from the master belonging to one of the link devices RX or RWr. It is possible to write more than one station at once. Further it is possible to write a part of the cyclic data only by addressing using an offset. Between two different write commands it may be possible, that the stack sent the new data already.
Returns a GOAL_STATUS_T value as result.

Table: goal_cclIeFbInputSet parameters

Parameter

Description

GOAL_CCLIEFB_HANDLE_T *pCfb

GOAL CCLIEFB handle

GOAL_CCLIEFB_LINK_DEV_ID_T devId

link device Id

uint8_t *pBuf

new data

uint16_t bufLen

data length

uint16_t offset

offset within link device

Code Block
languagec
uint8_t rx0 = 0;                     /* first byte from RX Link device */
res = goal_cclIeFbInputSet(pCfbHdl, 
                           GOAL_CCLIEFB_LINK_DEV_RX, 
						   &rx0, 
						   sizeof(uint8_t), 
						   0);

goal_cclIeFbVersionGet

Get the version of the GOAL CCLIEFB stack.
Returns a GOAL_STATUS_T value as result.

Table: goal_cclIeFbVersionGet parameters

Parameter

Description

GOAL_CCLIEFB_HANDLE_T *pCfb

GOAL CCLIEFB handle

const char *pVersion

version string

Code Block
languagec
const char *pVersion;                       /* GOAL CCLIEFB version string */
res = goal_cclIeFbVersionGet(pCfbHdl, &pVersion);
if (GOAL_RES_OK(res)) {
    goal_logInfo("started CC-Link IE Field Basic stack, version %s", pVersion);
}

Table of Contents