nctClear

NI-CAN

nctClear

Purpose

Stops communication for the task and then clears the configuration.

Format

nctTypeStatus nctClear(
nctTypeTaskRef TaskRef);

Inputs

TaskRef

Task reference from the previous NI-CAN function. The task reference is originally returned from nctInitStart, nctInitialize, or nctCreateMessage.

Outputs

Return Value

The return value indicates the status of the function call as a signed 32-bit integer. Zero means the function executed successfully. A negative value specifies an error, which means the function did not perform the expected behavior. A positive value specifies a warning, which means the function performed as expected, but a condition arose that may require attention.

Use the ncStatusToString function of the Frame API to obtain a descriptive string for the return value. The ncStatusToString and ncGetHardwareInfo functions are the only Frame API functions that can be called within a Channel API application.

Description

The nctClear function must always be the final NI-CAN function called for each task. If you do not use the nctClear function, the remaining task configurations can cause problems in execution of subsequent NI-CAN applications.

If the cleared task is the last running task for the initialized Interface (refer to nctInitStart), the nctClear function also stops communication on the CAN controller of the interface and disconnects all terminal connections for that interface.

Because this function clears the task, TaskRef cannot be used with subsequent functions. To change properties of a running task, use nctStop to stop the task, nctSetProperty to change the desired property, and then nctStart to restart the task.