Skip to content

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.

Interaction behaviorsInteractionsDocumentation revised: 2026-10-21
Interactions

Write Tag and Write Tag Bit

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

Overview

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.

Field configuration

Bind Write Tag and set Target Tag and Value. Configure Setup Script, Condition and appearance options as needed.

  • Target Tag: the tag-name expression to write to. Enter the tag name directly, or use a template placeholder for reuse; the hint reads "Use Bit Index for bit writes."
  • Value: the value to write. Use a single expression or JavaScript that returns a value. The initial value is 1.
  • Setup Script: optional; prepare shared variables or helper logic for Value to use.
  • Condition: controls whether the behavior can run; it defaults to true. A false result prevents this behavior from running.
  • Options: Show hand cursor when enabled, Use bold border when enabled, Hide when disabled.
// Setup Script
var nextSetpoint = 1200;

// Target Tag
PLC_LINE01.PUMP01.SPEED_SETPOINT

// Value (submit the setpoint)
nextSetpoint
When to use it

Use for click-triggered start, stop, setpoint or reset requests. Collect operator values with Input and choose the submission behavior or Click Script.

Limitations and troubleshooting

Submission does not confirm success; check the host result.

  • Target Tag holds a tag-name expression, not necessarily a quoted string; just enter the tag name as the editor expects.
  • If Value is multi-line script, it must end with return, otherwise nothing is written.
  • 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.
  • Do not hand-assemble an integer here just to flip one bit. Use Write Tag Bit for that.
Overview

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.

Field configuration

The editor has General, Interaction Setup and Options sections:

  • Behavior Name: a label for this behavior so you can recognize it later.
  • Component Name: the current shape name; read-only, cannot be edited.
  • Setup Script: optional. Prepare variables or helper logic here, or leave it empty.
  • 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.
  • Bit Index: which bit to change, 0-31. Bit 0 is the least significant (right-most) bit.
  • Bit Action: Set (force to 1) / Reset (force to 0) / Toggle (flip 0 and 1); pick one.
  • FORCE writes are unavailable. When opening an older project, review the write settings and save the behavior again.
  • Condition (Enabled): acts as a gate; runs the action when it evaluates to true, skips this click when false.
  • Options: Show hand cursor when enabled, Use bold border when enabled, Hide when disabled.
Target Tag: PLC_LINE01.PUMP01.CTRL_WORD
Bit Index:  3
Bit Action: Toggle
Condition:  ReadTagBoolean("PLC_LINE01.PUMP01.REMOTE", false)
When to use it

Typical case: one control-word integer packs several command bits.

  • Start/Stop button: use Toggle to flip the run bit in the control word, so one button starts and stops it.
  • Reset an alarm-acknowledge bit: use Reset to clear a bit, or use Set to raise an enable bit to 1.
  • When you need to gate the click, put a check in Condition (e.g. only allow the flip in remote mode).
Limitations and troubleshooting

Check these settings:

  • 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).
  • 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.
  • A write is not guaranteed to be immediate: the host may add permission checks, confirmation, reason input, or async processing, so never assume 'clicked means succeeded and synchronous'.
  • An empty Condition is treated as true (the action runs).
Write Tag behavior editor
Write Tag editor

Enter the target tag and the value to write; on click it writes to that tag, and the host decides whether the write succeeds.

Write Tag Bit behavior editor
Write Tag Bit editor

Select the parent integer Tag, Bit Index and Set / Reset / Toggle action, then verify the write result in Mingcedar.

Click the image again or press Esc to close