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

Chapter 1 CIN Overview

1. Place the CIN on a Block Diagram

Select the Code Interface Node function from the Advanced palette of the Functions palette, as shown in the following illustration.

2. Add Input and Output Terminals to the CIN

A CIN has terminals with which you can indicate which data passes to and from a CIN. Initially, the CIN has one set of terminals, and you can pass a single value to and from the CIN. You add additional terminals by resizing the node or by selecting Add Parameter from the CIN terminal pop-up menu. Both methods are shown in the following illustration.

LabVIEW Code Interface Reference Manual

1-6

© National Instruments Corporation

Chapter 1 CIN Overview

You can resize the node to add parameters,

or use the pop-up menu to add a parameter.

Each pair of terminals corresponds to a parameter that LabVIEW passes to the CIN. The two types of terminal pairs are input-output and output-only.

Input-Output Terminals

By default, a terminal pair is input-output; the left terminal is the input terminal, and the right terminal is the output terminal. As an example, consider a CIN that has a single terminal pair. Assume a 32-bit integer control is wired to the input terminal, and a 32-bit integer indicator is wired to the output terminal, as shown in the following illustration.

© National Instruments Corporation

1-7

LabVIEW Code Interface Reference Manual

Chapter 1 CIN Overview

When the VI calls the CIN, the only argument LabVIEW passes to the CIN object code is a pointer to the value of the 32-bit integer input. When the CIN completes, LabVIEW then passes the value referenced by the pointer to the 32-bit integer indicator. When you wire controls and indicators to the input and the output terminals of a terminal pair, LabVIEW assumes that the CIN can modify the data passed. If another node on the block diagram needs the input value, LabVIEW may have to copy the input data before passing it to the CIN.

Now consider the same CIN, but with no indicator wired to the output terminal, as shown in the following illustration.

If you do not wire an indicator to the output terminal of a terminal pair, LabVIEW assumes that the CIN will not modify the value you pass to it. If another node on the block diagram uses the input data, LabVIEW does not copy the data. The source code should not modify the value passed into the input terminal of a terminal pair if you do not wire the output terminal. If the CIN does modify the input value, nodes connected to the input terminal wire may receive the modified data.

Output-Only Terminals

If you use a terminal pair only to return a value, make it an output-only terminal pair by selecting Output Only from the terminal pair pop-up menu. If a terminal pair is output-only, the input terminal is gray, as shown in the following illustration.

For output-only terminals, LabVIEW creates storage space for a return value and passes the value by reference to the CIN the same way that it passes values for input-output terminal pairs. If you do not wire a control to the left terminal, LabVIEW determines the type of the output parameter by checking the type of the indicator wired to the output terminal. This can be ambiguous if you wire the output to two

LabVIEW Code Interface Reference Manual

1-8

© National Instruments Corporation

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