Table Of Contents

C Node Overview

Last Modified: September 23, 2016

Use the C Node to write and execute C code. You can call functions from the following libraries in the C Node:

  • ANSI C Library
  • Analysis Library

In addition, the C Node includes functions, macros, and variables that are specific to the C Node.

When you begin typing in the C Node, a drop-down list of elements that you can use appears. If you select a function or macro, the C Node displays the prototype and context help to assist you in writing code.

The following image shows the components that make up the C Node:

Function—Enter the name of a built-in function. Press <Ctrl-Space> inside the node to get an overview of all available functions.
Wire—Data from your graphical program flows into input terminals and out of output terminals that you create on the C Node.
Input terminal/Name of input terminal—To use data from your graphical program in your C code, add an input terminal by right-clicking the node frame and selecting Create»Input. Then use the name of the input terminal as a variable in your code. You do not need to declare this variable in your C code.
Output terminal/Name of output terminal—To use the value of a variable in your C code outside the C Node, add an output terminal by right-clicking the node frame and selecting Create»Output. You do not need to declare this variable in your C code.
Output values—You can use the values that the C Node outputs in the rest of your graphical program.
Input/output terminals—These terminals are values that serve as both an input and an output of the C Node. To use these terminals, create an input and output terminal and use the same terminal name for both. As is the case with other variables, you do not need to declare them in the C code.

The Errors & Warnings pane lists any errors or warnings that occur when you compile your code. The C Node also underlines any compile errors and warnings in the C code.

The Output pane displays standard output from the C Node. Call cnode_printf to print output.

Your C code runs in the same process as the LabVIEW environment. Thus, you must carefully manage memory in your C code to avoid impacting the LabVIEW environment. For example, if you allocate memory and do not free it, running the VI repeatedly can cause LabVIEW to run out of memory. You can use the C Resources pane to look for resources that you have allocated and not freed.


Recently Viewed Topics