> For the complete documentation index, see [llms.txt](https://www.opal-rt.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.opal-rt.com/docs/op8666/demo-project/run-and-debug-the-model-on-the-op8666.md).

# Run and Debug the Model on the OP8666

## Connect the USB cable <a href="#connect-the-usb-cable" id="connect-the-usb-cable"></a>

* Connect the **USB cable** between the **PC** and the **OP8666 ICP port**.
* The USB cable will directly connect to the JTAG integrated into the OP8666.

<figure><img src="https://1188700823-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqSz7qPxQbRFCsCnF5Xtl%2Fuploads%2Fcak6iPUdMp37udEL5GPT%2Fimage.png?alt=media&amp;token=c608ab0a-7f67-4095-85b8-b8888106729e" alt="" width="375"><figcaption></figcaption></figure>

## Configure the project properties <a href="#configure-the-project-properties" id="configure-the-project-properties"></a>

* Go to **CCStudio**.
* **Right-click** on the **project name** created before.
* Click on **Properties**.

<figure><img src="https://1188700823-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqSz7qPxQbRFCsCnF5Xtl%2Fuploads%2FC2dRSssafVWAqVtcTiFq%2Fimage.png?alt=media&amp;token=445e2260-1352-4e33-be24-0c453f1cba4c" alt="" width="452"><figcaption></figcaption></figure>

* Configure in the project properties the **Build →** **C2000 Linker** → **Basic Options**.
* Set the “**Specify output file name**” as **Demo\_gain.out**.
* Also set the “**Link information (map) listed into \<file>**” as **Demo\_gain.map**.
  * It should be **under the Demo\_gain\_ert\_rtw** **folder**.

<figure><img src="https://1188700823-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqSz7qPxQbRFCsCnF5Xtl%2Fuploads%2Ffh0ft59OruUxTlBEtDpR%2Fimage.png?alt=media&amp;token=f7037e5c-1a7f-41f0-8eb5-0f350a1ad093" alt=""><figcaption></figcaption></figure>

## Configure the debug settings <a href="#configure-the-debug-settings" id="configure-the-debug-settings"></a>

* Click on the button **Debug** → **Debug Configurations...**

<figure><img src="https://1188700823-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqSz7qPxQbRFCsCnF5Xtl%2Fuploads%2FcIGH6kPKBVhIuEWYB0CA%2Fimage.png?alt=media&amp;token=f65ccf9d-03c4-4fa3-adba-41357faf7d83" alt=""><figcaption></figcaption></figure>

* Select your project **Gain\_Project** in the left pane.
* Go to the **Program tab**.
* In the **Program field**, browse to **Demo\_gain.out**.

<figure><img src="https://1188700823-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqSz7qPxQbRFCsCnF5Xtl%2Fuploads%2FMzXA3wE6k7yoyjnpKEMN%2Fimage.png?alt=media&amp;token=c815d1bb-5577-41d8-bd29-8b97a80444ad" alt=""><figcaption></figcaption></figure>

* Click **Apply**.

## Debug the code <a href="#debug-the-code" id="debug-the-code"></a>

* Click **Debug**.
* The code is **loading** in the **OP8666**.

<figure><img src="https://1188700823-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqSz7qPxQbRFCsCnF5Xtl%2Fuploads%2FIHnsyEP3x2eTIaJm2zYt%2Fimage.png?alt=media&amp;token=91feb390-ffeb-4960-afa1-a97fc8a22d0c" alt="" width="375"><figcaption></figcaption></figure>

* The interface in CCStudio changes to a **Debug window**.

<figure><img src="https://1188700823-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqSz7qPxQbRFCsCnF5Xtl%2Fuploads%2FvChX6T8rLYPcA2WGf3Ec%2Fimage.png?alt=media&amp;token=ff8f6503-752e-4070-bd25-4f520cc8be87" alt=""><figcaption></figcaption></figure>

* In the **View menu**, click on **Expressions**.

<figure><img src="https://1188700823-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqSz7qPxQbRFCsCnF5Xtl%2Fuploads%2FSfMo1mna8SCMnLZvRp9L%2Fimage.png?alt=media&amp;token=03d5c23c-f0fd-480e-a0a8-8af49c21f6a7" alt="" width="461"><figcaption></figcaption></figure>

* Click on the **Expressions tab**,
* Add the variables:
  * input
  * output
  * gain

<figure><img src="https://1188700823-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqSz7qPxQbRFCsCnF5Xtl%2Fuploads%2F4Mh9kfyW9VlzRbnV8Jc0%2Fimage.png?alt=media&amp;token=86742f29-c193-474e-92c7-c1e240e35bd5" alt=""><figcaption></figcaption></figure>

* Press **Play** to **run the code**.

<figure><img src="https://1188700823-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqSz7qPxQbRFCsCnF5Xtl%2Fuploads%2FBrPNzfGP0jgcPEmATCdU%2Fimage.png?alt=media&amp;token=2ab21983-01f6-48e0-a155-3659f52800eb" alt="" width="375"><figcaption></figcaption></figure>

* Select **Continuous Refresh**.

<figure><img src="https://1188700823-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqSz7qPxQbRFCsCnF5Xtl%2Fuploads%2FWxSiKW7zsxghrinn4JIf%2Fimage.png?alt=media&amp;token=0446cff5-70fb-495e-81fb-ead067c24068" alt="" width="375"><figcaption></figcaption></figure>

* **Change** the **input variable** **value** to **see the change** in the **output**.

<figure><img src="https://1188700823-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqSz7qPxQbRFCsCnF5Xtl%2Fuploads%2FOkFP4CYgX3yTEiSGdLVq%2Fimage.png?alt=media&amp;token=f80b01f3-7798-4807-a873-b118b93bde2b" alt="" width="563"><figcaption></figcaption></figure>

* To **track the variable** value **graphically**:
  * **Right-click** on the **variable**.
  * Select **Graph**.

<figure><img src="https://1188700823-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqSz7qPxQbRFCsCnF5Xtl%2Fuploads%2FObSRMpr9zymO7bAppH7u%2Fimage.png?alt=media&amp;token=9e64a1a7-2e5e-4dde-8568-df6f48536a66" alt="" width="375"><figcaption></figcaption></figure>

* **Change** the **input variable value** again to **see the change** **graphically**.
  * Remember to **enable** **Continuous Refresh** for graphs as well.

<figure><img src="https://1188700823-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqSz7qPxQbRFCsCnF5Xtl%2Fuploads%2F5AIePjg0lNV4ffFRMuOm%2Fimage.png?alt=media&amp;token=406f88c9-22fa-460f-9edd-68949e63e6fd" alt="" width="563"><figcaption></figcaption></figure>

* You can **pause** and **stop** the **debugging**.

<figure><img src="https://1188700823-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqSz7qPxQbRFCsCnF5Xtl%2Fuploads%2FgkirKfrPM6juzgcFjbtN%2Fimage.png?alt=media&amp;token=cfe4d8c1-98ae-4437-95b2-1618ec091b53" alt="" width="282"><figcaption></figcaption></figure>

* You can also use debug to step through the generated code.

<figure><img src="https://1188700823-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqSz7qPxQbRFCsCnF5Xtl%2Fuploads%2FGHOgSC82AjGPH57pFiUi%2Fimage.png?alt=media&amp;token=a4984929-6ee1-44ef-9380-5f65f6b9994d" alt="" width="372"><figcaption></figcaption></figure>

<figure><img src="https://1188700823-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqSz7qPxQbRFCsCnF5Xtl%2Fuploads%2FGIODbNM3pZtwOhJK7ehN%2Fimage.png?alt=media&amp;token=ae716da5-eca7-4d43-88fd-6e415bec9b0d" alt="" width="563"><figcaption></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://www.opal-rt.com/docs/op8666/demo-project/run-and-debug-the-model-on-the-op8666.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
