Company Events Academic NI Developer Zone Support Solutions Products & Services Contact NI MyNI

Passing Parameters to CINs

LabVIEW 8.5 Help
August 2007

NI Part Number:
371361D-01

»View Product Info

LabVIEW passes parameters to the CINRun routine. The parameters correspond to each of the wires connected to the CIN. You can pass any data type to a CIN you can construct in LabVIEW. CINs do not have a limit to the number of parameters you can pass to and from them.

Parameters in the CIN .c File

When you right-click a CIN on a block diagram and select Create .c File from the shortcut menu, LabVIEW creates a .c file in which you can enter your CIN code.

Note   (Windows) LabVIEW does not pad data, so you should set padding in the CIN code.

The CINRun function and its prototype are given. CINRun function parameters correspond to the data types being passed to the CIN on the block diagram.

The .c file created is a standard C file, except LabVIEW gives the data types unambiguous names. C does not define the size of low-level data types, for example, the int data type might correspond to a 16-bit integer for one compiler and a 32-bit integer for another compiler. The .c file uses names that are explicit about data type size, such as int16, int32, float32, and so on. In the labview\cintools directory, LabVIEW includes a header file, extcode.h, that contains type definitions that associate LabVIEW data types with the corresponding data type for the supported compilers of each platform.

extcode.h defines some constants and types whose definitions might conflict with the definitions of system header files. The labview\cintools directory also contains hosttype.h, which resolves the differences between definitions in extcode.h and definitions in system header files. hosttype.h also includes many of the common header files for a given platform

Note  Always use #include "extcode.h" at the beginning of your source code. If your code needs to make system calls, also use #include "hosttype.h" immediately after #include "extcode.h", and then include your system header files. hosttype.h includes only a subset of the .h files for a given operating system. If the .h file you need is not included in hosttype.h, you can include it in the .c file for your CIN after you include hosttype.h.

If you write a CIN that accepts a single 32-bit signed integer, the .c file indicates the CINRun routine is passed as int32 by reference. extcode.h defines an int32 to the appropriate data type for the LabVIEW-supported compiler you use. Therefore, you can use the int32 data type in external code you write.


Resources


 

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
Add Comments 1 2 3 4 5 submit