> For the complete documentation index, see [llms.txt](https://help.qtech.co.nz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.qtech.co.nz/datran/datran-vi-scada/datran-dlp-ide/compile-and-load.md).

# Compile and load a DLP into the RTU

Build a DLP, connect to the RTU, load, start, stop or clear the DLP, read it back, set the clock, and test it with the Watch List.

When your DLP is written, you build (compile) it into a DLP file, load it into the RTU over a serial cable, start it, and test it with the Watch List.

## Build the DLP

* Press **F9**, or use the **Build** menu.
* For a ladder file, the **Build** menu builds the currently displayed ladder. This internally converts the ladder to ASM code. It then builds the DLP file.
* **Auto save source on build** (in **Tools > Editor Options**) saves the ASM file before the DLP file is built.
* **Show build result message** pops up a message when the build has completed successfully or failed.

If the build fails, see [My DLP won't build](https://help.qtech.co.nz/datran/datran-vi-scada/datran-dlp-ide/troubleshooting/wont-build.md).

## Connect to the RTU

1. Plug one end of the RS232 serial cable to the serial port of your computer and plug the other end to the DIAG (diagnostic) port of the RTU.

If it won't connect, see [The DLP IDE can't connect, or the Watch List doesn't update](https://help.qtech.co.nz/datran/datran-vi-scada/datran-dlp-ide/troubleshooting/cant-connect.md).

## What you can do from Module Connectivity

These options are available in the right click popup menu of the **Module Connectivity** pane:

| Command                            | What it does                                                                                                                        |
| ---------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
| Upload DLP                         | Upload a compiled DLP to the module.                                                                                                |
| Download DLP                       | Download the DLP from the module.                                                                                                   |
| Clear DLP                          | Erase the DLP in the module.                                                                                                        |
| Enable DLP                         | Run the DLP in the module.                                                                                                          |
| Disable DLP                        | Stop the DLP in the module.                                                                                                         |
| Synchronize RTC                    | Synchronize the attached module's real time clock (RTC) to this computer's time and date.                                           |
| Set RTC                            | Manually set the attached module's real time clock (RTC).                                                                           |
| Automatically Set Master Notionals | Automatically change the master notional configuration based on the current DLP.                                                    |
| Manually Set Master Notionals      | Manually change the master notional configuration.                                                                                  |
| Set Message Timeout                | Set the interval to wait (in seconds) for a response to a message.                                                                  |
| Stay On Top                        | Set the Module Connectivity to always stay on top of the editor. This only applies when the Module Connectivity pane is not docked. |

## Load and start a DLP

1. Build the DLP.
2. Connect to the RTU.
3. Right-click **Module Connectivity** and select **Upload DLP**.
4. Right-click again and select **Enable DLP**.

The initialisation section is only ever executed once at start-up. The main body of the DLP is executed sequentially the whole time the RTU is turned on.

{% hint style="warning" %}
The `NCOSMASK` command is only supported in firmware version v5.20 and above. If a DLP containing the `NCOSMASK` command is transmitted into an RTU with a lower version of firmware, the DLP will be rejected by the RTU. The RTU must be running firmware version 7.0 or greater to support the extended `COSMASK` syntax. See [The RTU rejects my DLP, or DATRAN keeps sending it](https://help.qtech.co.nz/datran/datran-vi-scada/datran-dlp-ide/troubleshooting/rtu-rejects-dlp.md).
{% endhint %}

## Stop or clear a DLP

* **To stop it:** right-click **Module Connectivity** and select **Disable DLP**. **Enable DLP** starts it again.
* **To remove it:** select **Clear DLP**.

## Read a DLP back from an RTU

1. Connect to the RTU.
2. Right-click **Module Connectivity** and select **Download DLP**.

To save an existing DLP file as Ladder (LDR), see [Open an existing DLP as ladder](https://help.qtech.co.nz/datran/datran-vi-scada/datran-dlp-ide/ladder-editor.md#open-an-existing-dlp-as-ladder).

## Set the RTU's clock

* **To match the PC:** right-click **Module Connectivity** and select **Synchronize RTC**.
* **To set it by hand:** select **Set RTC**.

## Send a DLP from DATRAN VI

[DATRAN VI](https://help.qtech.co.nz/datran/datran-vi-scada/datran-vi.md) can also send a site's DLP to the RTU. Any DLP/ASM files are normally found in `Datran\ASM` and/or `Datran\DLP`. In DATRAN Supervisor, the DLP panel shows the DLP state of the site: **OK**, **NO DLP** or **Transmitting** if the DLP is being sent to the RTU. Use the **Transmit DLP** button or the **Alt+D** key to send or resend the DLP to the site. See the site's comms object in [Sites, channels and RTUs](https://help.qtech.co.nz/datran/datran-vi-scada/datran-vi/sites-and-rtus.md#the-sites-comms-object), and the site buttons in [Monitor sites and channels](https://help.qtech.co.nz/datran/datran-vi-scada/datran-supervisor/sites-and-channels.md#site-buttons).

## Test with the Watch List

Use the Watch List to debug your DLP. It allows you to keep an eye on the following types of I/O in realtime.

![The Watch List, showing digital and analogue points with their values and when they were last read and written](https://3621580088-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa5hMAUl7E1cWeN5Rghg0%2Fuploads%2FXpxNyjai9W3e6NUoqxOR%2Fdlp-ide-watch-list.png?alt=media)

It can watch these register types: real, telemetry and notional digital inputs and outputs (`RDIN`, `RDOUT`, `TDIN`, `TDOUT`, `NDIN`, `NDOUT`), and real, telemetry and notional analogue inputs and outputs (`RAIN`, `RAOUT`, `TAIN`, `TAOUT`, `NAIN`, `NAOUT`).

### Add points to watch

1. The ASM or LDR file must be compiled first (press the **F9** key) to get a full list of I/O. Otherwise, only the native I/O identifiers (non-equated I/O identifiers) will be available.
2. Right-click the Watch List and select **Add Watch**.
3. Click **\[...]** and select the points. You can select several with **Ctrl** or **Shift**, or use **Select All**.
4. Choose the display mode, and click **OK**.

![The Watch Properties dialog, with several points selected](https://3621580088-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa5hMAUl7E1cWeN5Rghg0%2Fuploads%2F0RMAfYi8yzksJ0VlSHZg%2Fdlp-ide-watch-properties.png?alt=media)

| Display mode | Shows analogue values as                                                                                                                                                                                                          |
| ------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| ADC Value    | The original register value in the module (0 - 65535)                                                                                                                                                                             |
| Percentage   | Value shown in percentage format (0.00 % - 100.00 %)                                                                                                                                                                              |
| mA (0 - 20)  | Value shown in milli amps (0.00 mA - 20.00 mA)                                                                                                                                                                                    |
| Custom       | Value is shown using the custom scaling. **Scale Min** defines the minimum value of the scale, **Scale Max** defines the maximum value of the scale, and **Units** defines the units that is added to the end of the watch value. |

### Change a value

* **Digital:** right-click and select **Toggle Watch Value**. Alternatively, left click on the watch value itself or press **0** or **1** on the keyboard.
* **Analogue:** right-click and select **Change Watch Value**. Alternatively, left click on the watch value itself or press any of the numeric, decimal point or minus keys.

### What the columns show

| Column            | What it shows                                                                                                                                                                                                                                                 |
| ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Icon              | This displays the type of I/O whether analogue or digital, equated or non-equated, enabled or disabled. If there is no icon, that means this I/O type is not one of the types listed above or the watch name is an identifier that is not equated in the DLP. |
| Watch Name        | This is the identifier of the I/O.                                                                                                                                                                                                                            |
| Value             | This is the current value of the I/O. This will display **not accessible** if this I/O type is not one of the types listed above or you are currently not connected to a module (RTU).                                                                        |
| Last Time Read    | This is the latest time stamp of the current value.                                                                                                                                                                                                           |
| Last Time Written | This is the last time you changed the value of this I/O.                                                                                                                                                                                                      |
| I/O Number        | This is the I/O number.                                                                                                                                                                                                                                       |
| Display Mode      | This is the display mode of the watch. If the display mode is custom, it will display the current scale min/max and units used.                                                                                                                               |
| Enabled           | This shows whether this watch is currently enabled or disabled.                                                                                                                                                                                               |

### Other Watch List options

Right-click the Watch List for these:

* **Edit Watch**, **Delete Watch** and **Delete All Watches**
* **Enable Watch** and **Disable Watch**, and **Enable All** and **Disable All Watches**: after a watch is disabled you will no longer get any updates from the module for this I/O
* **Copy Watch Value** and **Copy Watch Name**
* **Save Watch List** and **Open Watch List**. The current watch list will be erased before the watch list from the file is added. If you want to use the current watch list in the future, save it first.
* **Show Column Headers** and **Stay On Top**
