> 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/rt-lab/simulink-blocks-reference/rt-lab-library/opsharedmemorywrite.md).

# OpSharedMemoryWrite

## Description

<figure><img src="https://96827845-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNRdpSk8kjn20gXAexnt6%2Fuploads%2Fgit-blob-9710a04e5f84f217a1ce1ef0437e18c60565aa98%2FRTL_opshared_memory_write_block.png?alt=media" alt=""><figcaption></figcaption></figure>

The **OpSharedMemoryWrite** block, located in the **RT-LAB/Communication/SharedMemory** library, is used in a Master or Slave subsystem with the OpSharedMemoryCtrl block to write data to shared memory.

## Mask parameters

<figure><img src="https://96827845-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNRdpSk8kjn20gXAexnt6%2Fuploads%2Fgit-blob-c503dcf1845b37e8be28ad14417d0608b89134b3%2FRTL_opshared_memory_write_mask.png?alt=media" alt="" width="329"><figcaption></figcaption></figure>

<table><thead><tr><th width="221">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><strong>Controller ID</strong></td><td>Specifies the controller ID of the OpSharedMemoryCtrl block used by this block.</td></tr><tr><td><strong>Offset</strong></td><td>Specifies the starting memory offset in the global shared memory space for this block.</td></tr><tr><td><strong>Memory access size</strong></td><td>Specifies the size of each write access to memory:</td></tr><tr><td><strong>Write enable</strong></td><td>Adds an Enable input to control when data is written to shared memory. Writing is active for input values greater than or equal to 1 and disabled for 0. If not selected, the block writes each time it is called.</td></tr></tbody></table>

| Memory access size      | data read            |
| ----------------------- | -------------------- |
| byte                    | 8 bits integer data  |
| word                    | 16 bits integer data |
| long word               | 32 bits integer data |
| float single precision  | 32 bits float data   |
| double double precision | 64 bits float data   |

## Inputs

<table><thead><tr><th width="220.99993896484375">Input</th><th>Description</th></tr></thead><tbody><tr><td><strong>Data</strong></td><td><p>Writes the input data to shared memory at the address computed as the controller base address plus the offset. Use a Demux to specify the number of input signals to write.</p><p>Memory access size in long word format:</p></td></tr><tr><td><strong>Enable</strong></td><td>Enables the write process. Writing is active for values greater than or equal to 1 and disabled for 0. This input is available only when the Write enable parameter is selected.</td></tr></tbody></table>

## Outputs

This block has no outputs.

## Characteristics and limitations

| Characteristic       | Value |
| -------------------- | ----- |
| Direct Feedthrough   | N/A   |
| Discrete sample time | Yes   |
| XHP support          | Yes   |
| Work offline         | No    |


---

# 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/rt-lab/simulink-blocks-reference/rt-lab-library/opsharedmemorywrite.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.
