labbCAN_CAPI_Init.cpp

labbCAN C API Initialization Procedure. The following examples shows how to initialize the labbCAN API and the labCAN bus communication properly.

//===========================================================================
// INCLUDES
//===========================================================================
//===========================================================================
// labbCAN Initialisation
//===========================================================================
TErrCode InitLabbCAN_API(void)
{
TErrCode Result;
//
// First open the labbCAN bus before any other action takes place
//
Result = LCB_Open("config/testconfig_nemaxys_rotaxys");
if (ERR_NOERR != Result)
{
// handle error properly here
return Result;
}
// now we can retrieve device handles like axis system handles or controller
// device handler
// ...
//
// Start communication and give devices some time to enter the operational
// state and to setup their communication properly
//
Result = LCB_Start();
if (Result != ERR_NOERR)
{
// handle error properly here
return Result;
}
Sleep(1000); // give devices some time to start up
// now we are ready to use our devices
return Result;
}