Skip to content

Tags

Name a robot signal once and reuse it across every control.

A tag is a name for one robot signal. Instead of every control referring to DO[5], you declare a tag called clamp_closed once and controls refer to that.

When a signal moves to a different address, changing the tag updates every control that refers to it.

Tags live in the document, so a document carries its own bindings — export it, import it on another controller, and the names come with it.

Kind What it is Direction
DI / DO Digital input / output read / write
RI / RO Robot input / output read / write
AI / AO Analog input / output read / write
GI / GO Group input / output read / write
F Flag write
R Numeric register write
SR String register write
TIMER TP timer, in seconds read
LPOS Cartesian position component — X, Y, Z, W, P, R read
JPOS Joint position component — J1 to J6 read
KAREL A variable inside a KAREL program, by program and variable name. See KAREL variables. read / write
LOCAL A scratch value that lives only in the HMI and never reaches the controller write
  1. Open the Tags panel and press + Add tag.
  2. Choose the kind and index — DO and 5 for DO[5].
  3. Give it a name. A new tag is named after its signal (DO[5] becomes do_5) so it is never nameless; rename it to what the signal does.

Names are what labels interpolate and what expressions reference.

A new tag pointed at a signal or register the controller has a comment on is named from the comment: DI[1] commented “Part present” becomes di_part_present. That happens only while the name is still the placeholder the tag started with; a name you have typed is never replaced.

Letters, digits and underscores, starting with a letter or an underscore: part_present, do_5, Cycle2.

Spaces, &, - and other punctuation are not accepted. A name has to be usable as {name} in label text, and a name with a space in it cannot be — the placeholder would appear on the screen exactly as written.

A document written before this rule can still contain such a name. It keeps working for bindings, and the Validation panel reports it.

Two tags cannot point at the same signal. Save stays off while the kind and index match another tag, and the message names the tag that already has the address; change the index, or use the existing tag. For a KAREL tag the address is the program and variable. A CSV import skips a row whose address is taken and lists it under Skipped rows. A document that arrives with two tags on one address, by import, shows them in the Validation panel.

A KAREL tag reads and writes a variable inside a KAREL program. Instead of an index it takes three things:

  1. Program — the KAREL program that owns the variable.
  2. Variable — the variable’s name.
  3. Type — INT, REAL or STRING. The tag’s declaration decides how the variable is read and written, so it must match the declaration in the KAREL source.

With a controller connected, both fields are pickers — the programs and their variables are listed, and picking a variable fills in its type. Type a name… switches to a text field for an array element or structure field, or when authoring away from the cell.

Both names use letters, digits and underscores, starting with a letter or an underscore. The variable must be declared at program level in the KAREL program — a routine-local variable cannot be reached. The variable is a path: an array element by its subscript (byteval[1]) and structure fields by dots (struct.array[1].foo[2].bar), as long as the value at the end of the path is an INT, REAL or STRING. A whole array or structure cannot be read, and a multi-dimensional subscript ([1,2]) is not supported. INT tags also read SHORT and BYTE variables; the controller wraps an out-of-range write to them silently (256 into a BYTE becomes 0), so Validation flags a button value outside the variable’s range.

A tag whose program is not loaded on the controller, or whose variable does not exist or has never been assigned, reads as no value — controls show their empty state. When the editor is connected to the controller, the Validation panel checks each KAREL tag against it and reports a missing program, a missing variable, or a declared type that does not match the variable’s real one.

A STRING value written from a screen cannot contain &, %, +, =, ; or characters outside ASCII, and is limited to 200 characters. A value longer than the variable’s declared length is silently cut short — the controller reports no error — so declare a STRING variable the screen writes to at least as long as anything it will be sent; STRING[254] makes that impossible to hit. Validation also checks a button’s literal value against the variable: a value that is not a number cannot be sent to an INT or REAL, and text longer than the variable’s declared length is flagged before it ever runs.

Bind a control to a tag in its Inspector, reference it in an expression as {tag_name}, or interpolate it into a label the same way. The Tag button beside label and expression fields inserts the braces for you — on the pendant keyboard they are two pages deep.

A read-only kind cannot be a write target: the tag pickers for a slider, a number input or a button’s write action only offer tags that can actually be written.