Mingcedar

Product: Mingcedar Studio DESIGNER

Write Tag and Write Tag Bit | Mingcedar Studio

Click to submit a Tag value for start, stop, setpoint or reset requests. Verify the host write result after submission.

Published Updated

<section id="write-tag" class="docs-block docs-block-intro docs-block-current"> <span class="section-kicker">Interactions</span> <h2>Write Tag and Write Tag Bit</h2> <p>Click to submit a Tag value for start, stop, setpoint or reset requests. Verify the host write result after submission.</p> <div class="docs-detail-list"> <article id="write-tag-item-1" class="docs-detail-row"> <strong>Overview</strong> <p>Write Tag submits a value to Mingcedar, which checks permissions, confirmation and write handling. Editor preview does not write devices. Use Write Tag Bit for one bit of an integer.</p> </article><article id="write-tag-item-2" class="docs-detail-row"> <strong>Field configuration</strong> <p>Bind Write Tag and set Target Tag and Value. Configure Setup Script, Condition and appearance options as needed.</p> <ul> <li>Target Tag: the tag-name expression to write to. Enter the tag name directly, or use a template placeholder for reuse; the hint reads &quot;Use Bit Index for bit writes.&quot;</li><li>Value: the value to write. Use a single expression or JavaScript that returns a value. The initial value is 1.</li><li>Setup Script: optional; prepare shared variables or helper logic for Value to use.</li><li>Condition: controls whether the behavior can run; it defaults to true. A false result prevents this behavior from running.</li><li>Options: Show hand cursor when enabled, Use bold border when enabled, Hide when disabled.</li> </ul> <pre class="docs-code-block"><code>// Setup Script

var nextSetpoint = 1200;

// Target Tag

PLC_LINE01.PUMP01.SPEED_SETPOINT

// Value (submit the setpoint)

nextSetpoint</code></pre> </article><article id="write-tag-item-3" class="docs-detail-row"> <strong>When to use it</strong> <p>Use for click-triggered start, stop, setpoint or reset requests. Collect operator values with Input and choose the submission behavior or Click Script.</p> </article><article id="write-tag-item-4" class="docs-detail-row"> <strong>Limitations and troubleshooting</strong> <p>Submission does not confirm success; check the host result.</p> <ul> <li>Target Tag holds a tag-name expression, not necessarily a quoted string; just enter the tag name as the editor expects.</li><li>If Value is multi-line script, it must end with return, otherwise nothing is written.</li><li>The write may not take effect immediately: the host may run permission checks, a confirm dialog, an async write, or reject it; host write handlers may return a Promise.</li><li>Do not hand-assemble an integer here just to flip one bit. Use Write Tag Bit for that.</li> </ul> </article><article id="write-tag-item-5" class="docs-detail-row"> <strong>Overview</strong> <p>Set makes the bit 1, Reset makes it 0, and Toggle reverses it. The runtime computes an integer from the current value and submits it with the bit index and action. Concurrent changes depend on host and device write handling. Add State Color or Tag Text to display the bit.</p> </article><article id="write-tag-item-6" class="docs-detail-row"> <strong>Field configuration</strong> <p>The editor has General, Interaction Setup and Options sections:</p> <ul> <li>Behavior Name: a label for this behavior so you can recognize it later.</li><li>Component Name: the current shape name; read-only, cannot be edited.</li><li>Setup Script: optional. Prepare variables or helper logic here, or leave it empty.</li><li>Target Tag: enter the parent integer tag that holds the bits; do not add a bit subscript here. A plain tag name needs no quotes; use expression form for a variable.</li><li>Bit Index: which bit to change, 0-31. Bit 0 is the least significant (right-most) bit.</li><li>Bit Action: Set (force to 1) / Reset (force to 0) / Toggle (flip 0 and 1); pick one.</li><li>FORCE writes are unavailable. When opening an older project, review the write settings and save the behavior again.</li><li>Condition (Enabled): acts as a gate; runs the action when it evaluates to true, skips this click when false.</li><li>Options: Show hand cursor when enabled, Use bold border when enabled, Hide when disabled.</li> </ul> <pre class="docs-code-block"><code>Target Tag: PLC_LINE01.PUMP01.CTRL_WORD

Bit Index: 3

Bit Action: Toggle

Condition: ReadTagBoolean(&quot;PLC_LINE01.PUMP01.REMOTE&quot;, false)</code></pre> </article><article id="write-tag-item-7" class="docs-detail-row"> <strong>When to use it</strong> <p>Typical case: one control-word integer packs several command bits.</p> <ul> <li>Start/Stop button: use Toggle to flip the run bit in the control word, so one button starts and stops it.</li><li>Reset an alarm-acknowledge bit: use Reset to clear a bit, or use Set to raise an enable bit to 1.</li><li>When you need to gate the click, put a check in Condition (e.g. only allow the flip in remote mode).</li> </ul> </article><article id="write-tag-item-8" class="docs-detail-row"> <strong>Limitations and troubleshooting</strong> <p>Check these settings:</p> <ul> <li>Tag must be the parent integer tag that holds the bits; do not append [bit] to the tag name. The bit is set separately by Bit Index (the [0..31] subscript form is for reads, not bit writes).</li><li>Bits are zero-based. Choose a bit supported by the parent Tag: 0–7 for 8-bit, 0–15 for 16-bit, or 0–31 for 32-bit values. The editor range does not validate the device width. This write path rejects 64-bit integer parents.</li><li>A write is not guaranteed to be immediate: the host may add permission checks, confirmation, reason input, or async processing, so never assume &#39;clicked means succeeded and synchronous&#39;.</li><li>An empty Condition is treated as true (the action runs).</li> </ul> </article> </div> <div class="docs-note-grid"> <figure id="write-tag-image-1" class="docs-note-card manual-doc-image-card"> <img src="/WEB_img/HQPPT/current/write/write-normal.png" alt="Write Tag behavior editor" loading="lazy" decoding="async"> <figcaption> <strong>Write Tag editor</strong> <p>Enter the target tag and the value to write; on click it writes to that tag, and the host decides whether the write succeeds.</p> </figcaption> </figure><figure id="write-tag-image-2" class="docs-note-card manual-doc-image-card"> <img src="/WEB_img/HQPPT/current/write/bit-normal.png" alt="Write Tag Bit behavior editor" loading="lazy" decoding="async"> <figcaption> <strong>Write Tag Bit editor</strong> <p>Select the parent integer Tag, Bit Index and Set / Reset / Toggle action, then verify the write result in Mingcedar.</p> </figcaption> </figure> </div> </section>