Channel API for C
This topic lists the NI-CAN functions and describes the format, purpose and parameters.
Unless otherwise stated, each NI-CAN function suspends execution of the calling thread until it completes. The functions in this topic are listed alphabetically.
Section Headings
The following are section headings found in the Channel API for C functions.
Purpose
Each function description includes a brief statement of the purpose of the function.
Format
The format section describes the format of each function for the C programming language.
Input and Output
The input and output parameters for each function are listed.
Description
The description section gives details about the purpose and effect of each function.
Data Types
The following data types are used with functions of the NI-CAN Channel API for C.
Data Type | Purpose |
---|---|
i8 | 8-bit signed integer |
i16 | 16-bit signed integer |
i32 | 32-bit signed integer |
u8 | 8-bit unsigned integer |
u16 | 16-bit unsigned integer |
u32 | 32-bit unsigned integer |
f32 | 32-bit floating point number |
f64 | 64-bit floating point number |
str | ASCII string represented as an array of characters terminated by null character ('\0'). This type is used with output strings. |
cstr | ASCII string represented as an array of characters terminated by null character ('\0'). This type is used with input strings. |
nctTypeTaskRef | Reference to an initialized task. Refer to nctInitStart for more information. |
nctTypeStatus | Status returned from NI-CAN functions. Refer to ncStatusToString in the Frame API for more information. |
nctTypeTimestamp | Timestamp. Refer to nctReadTimestamped for more information. |
List of Functions
The following table contains an alphabetical list of the NI-CAN Channel API for C functions.
Function | Purpose |
---|---|
nctClear | Stops communication for the task and then clears the configuration. |
nctConnectTerminals | Connects terminals in the CAN hardware. |
nctCreateMessage | Creates a message configuration and associated channel configurations within the application. |
nctCreateMessageEx | Creates a message configuration and associated channel configurations within the application. nctCreateMessageEx allows you to create normal CAN channels and mode dependent channels. For more information, refer to Mode Dependent Channels. |
nctDisconnectTerminals | Disconnects terminals in the CAN hardware. |
nctGetNames | Gets an array of CAN channel names or message names from MAX or a CAN database file. |
nctGetNamesLength | Gets the required size for a specified list of channels to allocate an array for the ChannelList input of nctGetNames. |
nctGetProperty | Gets a property for the task, or a single channel within the task. |
nctInitialize | Initializes a task for the specified channel list. |
nctInitStart | Initializes a task for the specified channel list, then starts communication. |
nctRead | Reads samples from a CAN task initialized with Mode of nctModeInput. Samples are obtained from received CAN messages. |
nctReadTimestamped | Reads samples from a CAN task initialized with Mode of nctModeTimestampedInput. |
nctSetProperty | Sets a property for the task, or a single channel within the task. |
nctStart | Starts communication for the specified task. |
nctStop | Stops communication for the specified task. |
nctWrite | Writes samples to a CAN task initialized as NctModeOutput. Samples are placed into transmitted CAN messages. |