RegisterCallbackEx
Registers a function that the KINGSTAR Subsystem will call every cycle when new data comes in. The function will run on the selected processor core.
Syntax
KsError RegisterCallbackEx(
AppCallback callback,
PVOID context,
int IdealProcessor,
int Priority
);
Parameters
callback: pointer to the callback function that will be called every cycle. See the AppCallback type.
context: pointer passed to the callback function if you need it.
IdealProcessor: configures which core the KINGSTAR Subsystem runs on. All threads of the Subsystem run on the given processor. Core Zero is always for Windows. Other cores can be assigned to the Subsystem depending on your settings. By default, IdealProcessor is set to zero, meaning KINGSTAR will use the ideal processor configured in the instance configuration table (Control Panel > Runtime Settings > General Settings). If the table lacks settings for the given instance, the Subsystem may run on any core available to RTX64. If you set it to another number, such as two, the Subsystem will take the Core Two.
Priority: the priority of a thread for the registered function after RegisterCallbackEx is called.
Return value
If the function succeeds, it returns errNoError, otherwise an error code. For more information about the error code, see the KsError list.
Remarks
- Registering a callback is optional. You can have your own cyclic thread in your application.
- RegisterCallback can be used only in RT interface, because it is a real-time functionality. Calling it in other interfaces will get an
errWrongEnvironmenterror.
Usable EtherCAT states
ecatOP
Example
N/A
Requirements
| RT | Win32 | |
|---|---|---|
| Minimum supported version | 4.3 | 4.3 |
| Header | ksapi.h | ksapi.h |
| Library | KsApi_Rtss.lib | KsApi.lib |
See also