Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Labview Code Interface Reference Manual.pdf
Скачиваний:
33
Добавлен:
29.05.2015
Размер:
1.13 Mб
Скачать

Chapter 2 CIN Parameter Passing

Note: You should always use #include "extcode.h" at the beginning of your source code. If your code needs to include system header files, you should include "extcode.h" , "hosttype.h", and then any system header files, in that order.

If you write a CIN that accepts a single 32-bit signed integer, the .c file indicates that the CINRun routine is passed an int32 by reference. extcode.h typedefs an int32 to the appropriate data type for the compiler you use (if it is a supported compiler); therefore, you can use the int32 data type in external code that you write.

How LabVIEW Passes Fixed Sized Data to CINs

As described in the Steps for Creating a CIN section of Chapter 1, CIN Overview, you can designate terminals on the CIN as either inputoutput or output-only. Regardless of the designation, LabVIEW passes data by reference to the CIN. When modifying a parameter value, be careful to follow the rules described for each kind of terminal in the

Steps for Creating a CIN section of Chapter 1, CIN Overview. LabVIEW passes parameters to the CINRun routines in the same order as you wire data to the CIN—the first terminal pair corresponds to the first parameter, and the last terminal pair corresponds to the last parameter.

The following section describes how LabVIEW passes fixed sized parameters to CINs. See the How LabVIEW Passes Variably Sized Data to CINs section of this chapter for information on manipulating variably sized data such as arrays and strings.

Scalar Numerics

LabVIEW passes numeric data types to CINs by passing a pointer to the data as an argument. In C, this means that LabVIEW passes a pointer to the numeric data as an argument to the CIN. Arrays of numerics are described in the subsequent Arrays and Strings section of this chapter.

Scalar Booleans

LabVIEW stores Booleans in memory as 16-bit integers. If the high bit of the integer is 1, the Boolean is TRUE; otherwise the Boolean is FALSE. This is different from the more usual convention for Booleans, in which the low bit determines whether the Boolean is TRUE or FALSE. LabVIEW passes Booleans to CINs with the same

LabVIEW Code Interface Reference Manual

2-2

© National Instruments Corporation

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]