Creating a VI for a LabVIEW Custom Code Generator

TestStand ATML Toolkit 2017 Help

Edition Date: June 2018

Part Number: 374205B-01

»View Product Info
Download Help (Windows Only)

You can recreate an example VI for a LabVIEW custom code generator and use the VI you create as a starting point for customizing the code generator behavior.

Note Note  When you create a VI to implement a custom code generator callback, the VI must use the same filename as the example VI that implements the same callback. For example, if you create a VI to implement the PreTranslateAction callback, the VI filename must be CodeGenerator_PreTranslateAction.vi. If you use an example VI as a starting point to implement a callback, National Instruments recommends that you copy the example VI to another location and modify the copy so that you do not modify the example the ATML Toolkit installs.

Complete the following steps to create a new VI, wire the appropriate controls and indicators, and configure the ATML TD translator to use the VI as a custom code generator.

Note Note  You can also copy an existing example custom generator VI from the <TestStand Public>\Examples\Toolkits\ATMLTDTranslator\Code Generator\LabVIEW directory and modify the copy.
  1. Create a new directory on the desktop or at another convenient location.
  2. In LabVIEW, create a new VI and save it in the directory you created in step 1. Ensure the VI name matches the name of an example custom code generator VI. For example, if you want to implement and customize the PreTranslateAction callback, save the VI as CodeGenerator_PreTranslateAction.vi.
  3. Create controls to match the example VI for the callback callback you want to implement. For example, if you are recreating the PreTranslateAction callback, you must connect the following controls:
    • TranslatorCodeGenerator—Automation Refnum control that uses the TranslatorCodeGenerator interface.
    • CodeGenerator—Automation Refnum control that uses the LVCodeGenerator interface.
    • DOMNode—Automation Refnum control that uses the MSXML DOM Node of the <Action> element.

    Complete the following steps to add the controls the VI requires:
    1. Place the Refnum»Automation Refnum control on the front panel.
    2. Right-click the control and select Select ActiveX Class»Browse from the context menu to launch the Select Object From Type Library dialog box.
    3. Select the type library that contains the object to use for the control, as the following table describes.
      Control Name Type Library to Select
      TranslatorCodeGenerator, CodeGenerator, FileGenerator, or ParameterCollection NI TestStand ATML TD Translator Type Library Version 1.0
      Sequence, Step NI TestStand version API Version 1.0
      DOMDocument, DOMNode Microsoft XML, v4.0 Version 4.0 or Microsoft XML, v6.0 Version 6.0
    4. Select the object to use for the control as indicated in the specific callback topic.
    5. Click OK to close the Select Object From Type Library dialog box
  4. Repeat step 3 to add other required controls to the VI.
  5. Place the Classic Array, Matrix, & Cluster»Error Out indicator on the front panel.
  6. Wire the controls and indicators in the same order in which they appear in the specific callback topic.
  7. Implement the code required to call the corresponding callback and generate the code modules. Refer to the VIs located in the <TestStand Public>\Examples\Toolkits\ATMLTDTranslator\Code Generator\LabVIEW directory for examples of how to implement callbacks in VIs.
  8. Save the VI.
  9. Complete the following steps to configure the ATML TD translator to call the VI you created as a LabVIEW custom code generator.
    1. In TestStand, select Tools»Configure ATML TD Translator to launch the ATML Test Description Translator Configuration dialog box.
    2. Click the Code Module Settings tab and enable the LabVIEW option.
    3. In the Directory that Contains the Custom Code Generator VIs control, enter or browse to the complete path for the directory you created in step 1.

See Also

<Action> Element

ATML Test Description Translator Configuration dialog box

Code Generator Callbacks

Example LabVIEW Custom Code Generator VIs

WAS THIS ARTICLE HELPFUL?

Not Helpful