Working with Source Code Files

NetLinx Studio distinguishes between two types of Source Code files; the Master Source Code file and System Source Code files:

    • Master Source Code f ile - The Source Code that is sent to a NetLinx Master. The Master Source Code file defines all of the devices in the System and sets any global parameters for the System.
    • Source Code f iles - NetLinx Source Code files that are sent to specific NetLinx devices on the bus. You can have as many Source Code files in the Source Code System folder as is required for the System.

Source Code files are stored in the Source folder (in the Workspace tab of the Workspace Bar).

You can create new Source Code files in NetLinx Studio, or add existing Source Code files to a System. Source Code files are created and/or edited in the Editor windows. Source Code files are stored in the Source folder in the Workspace tab of the Workspace Bar (FIG. 71).

FIG. 71 Workspace tab - Source Folder

Adding a New Source Code File to a System

NetLinx Studio provides a set of dialogs that step you through the process of creating a new Source Code (*.axs) file and add it to a specific System in the Workspace:

  1. Click to select (highlight) a System in the Workspace tab of the Workspace Bar and expand the view to show the System File folders (Source, Include, Module, User Interface, IR and Other).
  2. Right-click on the Source folder to access the Source File Folder context menu, and select Add New Source File to open the File Template dialog (FIG. 72).

FIG. 72 System Folder context menu - Add New Source File

    • Alternatively, you can also either select File > New or click the New toolbar button, and select Source File (in the New

dialog).

    • Note that the new file will be added to the selected System, even if it is not the currently active system.
  • The first File Template dialog prompts you to either use a template to create the new file, or to create an empty AXS file not based on a template (see FIG. 80 on page 50).

    • If you select Yes, click Next to proceed to the next File Template dialog (see Step 4).
    • If you select No, click Next to proceed to the New File Location dialog (see Step 5).
  • In this dialog, select a template to use to create the file (NetLinx Standard Template or User-Def ined Template), and click Next

to proceed (see FIG. 81 on page 50).

    • If you select to use the NetLinx templates, the new Source Code file will include all of the sections and headings (i.e. DEFINE_DEVICE, DEFINE_CONSTANT, DEFINE_TYPE, etc.) that differentiate the various sections contained in a typical Source Code file for the indicated system type.
    • If you select User Defined Template, then enter the file path for the AXS, AXI, AXB (or other) file to be used as the file template. Use the Browse (...) button to locate and select the file via the Open dialog.
  • In this File Template dialog, enter a file name for the new file.

If this file is to be the Master Source Code file for the System, then check the Make this the Master Source Code File check box.and click Next to proceed (FIG. 73).

FIG. 73 File Template dialog

  1. In the New File Location dialog, specify a target directory for the file.
    • By default, the target directory is the NetLinx Studio directory.
    • Use the Browse (...) button to navigate to another folder if necessary. (see FIG. 83 on page 51).
  2. Click Next to proceed to the final File Template dialog, which notifies you that the file was created (see FIG. 84 on page 51 ).
  3. Click Finish to close the File Template dialog.

The new Source Code file is opened in an Editor window for editing. Also, the new file should now appear in the Source folder under the selected System.

If Make this the Master File Source Code File was checked (in step 5), then the file icon will feature the letter "M" in the Workspace tab to indicate that it is the Master Source Code file (FIG. 74).

FIG. 74 Source folder indicating a Master Source Code file

Adding an Existing Source Code File to a System

To add an existing Source Code file to a System in the Workspace:

  1. Click to select (highlight) a System in the Workspace tab of the Workspace Bar.
  2. Right-click on the Source folder to access the Source File Folder context menu, and select Add Existing Source File (FIG. 75).

FIG. 75 System Folder context menu - Add Existing Source File

  1. In the Add Existing Source File dialog, locate and select the Source (.AXS) file that you want to add to the selected System. Use the Recent tab to quickly access recently used files (FIG. 76).

FIG. 76 Add Existing Source File dialog

  1. With one or more AXS files selected, click Open to access the File Properties dialog, where you can view/edit general file information for the selected file(s) (FIG. 77).

FIG. 77 File Properties dialog

NOTE: If you select multiple f iles to add to the System, the program will prompt you to edit the f ile properties for each f ile before adding them.

  1. Edit the file information (if necessary) for each file being added to the System.

If this file is to be the Master Source Code file for the System, then check the Master File check box.

  1. Click OK to add the file to the selected System.

The file should now appear in the Source folder, under the selected System. Double-click the file to open it in an Editor window.

If the Master File option was checked (in step 5 above), then the file icon will feature the letter "M" in the Workspace tab to indicate that it is the Master Source Code file (FIG. 78).

FIG. 78 Source Folder - New Source Code file

Creating a New Source Code File (Outside of a System)

To create a new Source Code file (that is not associated with a System).

  1. Click File > New, and select Source File in the New dialog (FIG. 79).

FIG. 79 New dialog

  1. Click OK to close this dialog and open the File Template dialog (FIG. 80).

FIG. 80 File Template dialog

  1. Select Yes (default) or No, and click Next to proceed:
    • If you select Yes, click Next to proceed to the next File Template dialog (see Step 4).
    • If you select No, click Next to proceed to the New File Location dialog (see Step 6).
  2. In the File Template dialog, select a template to use to create the file (NetLinx Module Template or User-Def ined Template), and click Next to proceed. (FIG. 81).

FIG. 81 File Template dialog

    • If you select to use the NetLinx template, the new Source Code file will include all of the sections and headings DEFINE_DEVICE, DEFINE_CONSTANT, DEFINE_TYPE, etc.) that differentiate the various sections contained in a typical Source Code file for the indicated system type.
    • If you select User Defined Template, then enter the file path for the AXS, AXI, AXB (or other) file to be used as the file template. Use the Browse (...) button to locate and select the file via the Open dialog.
  • In this File Template dialog, enter a file name for the new Source Code file, and click Next to proceed (FIG. 82).

FIG. 82 File Template dialog

  1. In the New File Location dialog, specify a target directory for the file.
    • By default, the target directory is the NetLinx Studio directory.
    • Use the Browse (...) button to navigate to another folder if necessary. (FIG. 83).

FIG. 83 New File Location dialog

  1. Click Next to proceed to the final File Template dialog, which notifies you that the file was created (FIG. 84).

FIG. 84 File Template dialog

  1. Click Finish to close the File Template dialog.

The new Source Code file is opened in an Editor window for editing.

Designating the System's Master Source Code File

Each System must have a Master Source Code file, and only one Source Code file in the System can be designated as the Master Source Code File. There are two ways to designate the Master Source Code file for a System:

    • You can designate a Source Code file as the Master Source at the time that it is added to the System via the Master File

option in the File Properties dialog (FIG. 85).

FIG. 85 File Properties dialog - Master File option

    • Alternatively, you can designate any Source Code file in the System as the Master Source by right-clicking on a Source Code file (in the Workspace tab of the Workspace Bar), and selecting Set As Master from the Source Code File context menu.
    • In the Workspace tab, the file icon will feature the letter "M" to indicate which Source Code File is designated as the Master Source Code file (FIG. 86).

FIG. 86 Source folder indicating a Master Source Code file

Compiling Source Code Files

There are several ways to compile individual Source Code files:

    • Right-click on a Source Code file (in the Workspace tab of the Workspace Bar), and select Compile from the Source Code File context menu.
    • In the Build menu, select Compile <f ilename.axs>.
    • To specify the compiler to use, double-click to open the file in an Editor window, and select Compile As NetLinx from the Build menu.

The status and results of the build are displayed in the Status tab of the Output Bar. See the

Building and Debugging Source

Code section on page 106

for details.

results matching ""

    No results matching ""