Mingcedar

Product: Mingcedar Studio DESIGNER

Write Tag Bit | Mingcedar Studio

Set, reset or toggle a selected bit of an integer Tag on click. Configure the parent Tag, bit index and action; the runtime platform performs the write.

Published Updated

<div class="manual-doc-article manual-doc-article-section"><h2 id="write-tag-bit">Interactions: Write Tag Bit</h2>

Set, reset or toggle a selected bit of an integer Tag on click. Configure the parent Tag, bit index and action; the runtime platform performs the write.

<div class="doc-card-list">

<article class="doc-card">

<h3 id="write-tag-bit-item-1">Overview</h3>

<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>

<ul class="doc-related-links">

<li><a href="/en/ppt/manual/recipe-template-bit-write/">Practice: Bit writing and bit display</a></li>

</ul>

</article>

<article class="doc-card doc-card-warn">

<h3 id="write-tag-bit-item-2">Field configuration</h3>

<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>

<div class="manual-code" data-code-language="text"><div class="manual-code-toolbar"><span>Text</span><span class="manual-code-tools"><small>Text</small><button type="button" data-copy-code data-copied="Copied" data-failed="Select and copy the code" aria-label="Copy code: Text">Copy code</button><span class="manual-code-status" role="status"></span></span></div><pre tabindex="0" class="docs-code-block shiki github-light" style="background-color:#fff;color:#24292e" tabindex="0"><code><span class="line"><span>Target Tag: PLC_LINE01.PUMP01.CTRL_WORD</span></span>

<span class="line"><span>Bit Index: 3</span></span>

<span class="line"><span>Bit Action: Toggle</span></span>

<span class="line"><span>Condition: ReadTagBoolean("PLC_LINE01.PUMP01.REMOTE", false)</span></span></code></pre></div>

</article>

<article class="doc-card">

<h3 id="write-tag-bit-item-3">When to use it</h3>

<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 class="doc-card doc-card-warn">

<h3 id="write-tag-bit-item-4">Limitations and troubleshooting</h3>

<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 manual-doc-image-grid">

<figure class="docs-note-card manual-doc-image-card" id="write-tag-bit-image-1">

<img src="/WEB_img/HQPPT/current/write/bit-normal.png" alt="Write Tag Bit behavior editor" loading="lazy" decoding="async" />

<figcaption>

<strong>Figure 1: 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>

</div>