Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Using External Code in LabVIEW.pdf
Скачиваний:
91
Добавлен:
29.05.2015
Размер:
1.85 Mб
Скачать

Chapter 5 Advanced Applications

in CINLoad. When you save a VI, LabVIEW creates a new version of the file, even if you are saving the VI with the same name. If the save is successful, LabVIEW deletes the old file and renames the new file with the original name. Therefore, you need to save in CINSave anything you expect to be able to load in CINLoad.

Aborting a VI

When you abort a VI, LabVIEW calls the CINAbort routine for every reference to a code resource contained in the VI being aborted. LabVIEW also calls the CINAbort routine of all actively running subVIs. If a CIN is in a reentrant VI, it is called for each CIN data space as well. CINs in VIs not currently running are not notified by LabVIEW of the abort event.

CINs are synchronous, so when a CIN begins execution, it takes control of its thread until the CIN completes. If your version of LabVIEW is single-threaded, the user cannot abort the CIN, because no other LabVIEW tasks can run while a CIN executes.

Multiple References to the Same CIN in a Single VI

If you loaded the same code resource into multiple CINs, or you duplicated a given CIN, LabVIEW gives each reference to the code resource a chance to perform initialization or deallocation. No matter how many references you have in memory to a given code resource, LabVIEW calls the CINLoad routine only once when the resource is first loaded into memory (though it is also called if you load a new version of the resource. When you unload the VI, LabVIEW calls CINUnload once.

After LabVIEW calls CINLoad, it calls CINInit once for each reference to the CIN, because its CIN data space might need initialization. Thus, if you have two nodes in the same VI, where both reference the same code, LabVIEW calls the CINLoad routine once and CINInit twice. If you later load another VI referencing the same code resource, LabVIEW calls CINInit again for the new version. LabVIEW has already called CINLoad once, and does not call it again for this new reference.

LabVIEW calls CINDispose and CINAbort for each individual CIN data space. LabVIEW calls CINSave only once, regardless of the number of references to a given code resource within the VI you are saving.

The following illustration shows an example of three CINs referencing the same code resource.

© National Instruments Corporation

5-5

Using External Code in LabVIEW

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