IMDHMIControls LibraryShop main store

Explainer

Why CODESYS CFC takes no inline value entry on unconnected pins

PLC programming Published 6 min read

Short answer

An unconnected CFC input pin is monitor-only: the CODESYS CFC editor has no inline value entry there, while the Ladder editor opens one by double-click. The fix is to declare a commissioning variable of the pin's exact type, connect it, download, and write it through the online variable view.

On this page
  1. Why does CFC take no inline value entry on an unconnected pin?
  2. What does Ladder do differently on the same pin?
  3. How do you confirm the pin is unconnected and not fed elsewhere?
  4. What is the fastest fix in CFC?
  5. How do you bind a variable to an ENUM or STRUCT input?
  6. How do you verify the fix and hand the machine back safely?
  7. When should you keep the poke in Ladder instead?
  8. Questions asked

You can watch the value on an unconnected CFC input pin all day, but you cannot type into it. The CODESYS CFC editor exposes that pin for monitoring only, while the Ladder editor opens inline value entry on the same pin by double-click. That is an editor capability difference, not a broken tag, block, or connection. The fix in CFC is to declare a commissioning variable with the pin's exact data type, connect it, download the change, and write it through the online variable view. This page explains why the two editors behave differently, how to confirm the pin really is unconnected, and how to build and verify the binding.

Why does CFC take no inline value entry on an unconnected pin? #

Because the CFC editor gives an unconnected input pin a monitoring display only: the value you see is a read from the controller, and the editor offers no write control at that pin, no matter how healthy the online session is.

Monitoring needs a read path; online modification needs an editor command and a writable target. CFC ships the first at an unconnected pin and not the second, so repeated double-clicks, zoom changes, or re-inserting the block will not create one. With nothing wired to the pin, the block executes on the input's declared initialization value, which is what the monitor shows. A displayed value therefore proves a read path exists, never that the object is writable.

What does Ladder do differently on the same pin? #

In Ladder, double-clicking an unconnected input of an existing block while online opens a value-entry box right in the editor, with no variable assigned and no watch list, and ENUM or STRUCT inputs give you a typed dropdown of valid values.

The runtime and the data type are identical in both editors, so a successful Ladder entry proves the controller and session can carry the write. The difference is purely the editor surface, and each language surface has to be judged on its own, the same way a CODESYS TON can work in structured text but not ladder for editor-specific reasons. A successful entry in Ladder does not activate the missing interaction in CFC.

Editor Unconnected pin while online Direct entry at the pin
Ladder monitored live opens by double-click, typed dropdown for ENUM and STRUCT
CFC monitored live not offered; bind a commissioning variable instead

How do you confirm the pin is unconnected and not fed elsewhere? #

Follow the input line back from the block: a pin with no wire to a variable, a constant, or another block's output is unconnected, and a pin that has one is already writable at that variable instead.

If a variable feeds the input, diagnose the variable, not the pin: select the pin display does not select the variable that owns the value, so open the connected variable through the project's normal online variable view and observe it there. If the value moves elsewhere immediately after you write it, a cyclic assignment in the executing logic is overwriting your one-time write on a later scan, and the writer has to be found and gated before any pin-level test means anything.

What is the fastest fix in CFC? #

Declare a commissioning variable of the pin's exact data type, connect it to the input, download the change, and write the value through the online variable view — that reproduces, in one explicit step, what Ladder's inline entry does implicitly.

  1. Read the declared data type off the unconnected input.
  2. Declare a commissioning variable with that same type, for example tTestPreset : TIME := T#5S; for a timer preset input.
  3. Connect the variable to the pin in the CFC chart.
  4. Build and download through your project's change procedure, then log in to the running application.
  5. Open the variable in the online view, write the value, and watch the pin monitor follow on the next scan.

Worked example: a TON placed in a CFC chart with its preset input left unconnected, type TIME. Declare tTestPreset : TIME := T#5S; and wire it to the pin. After download and login, the pin monitor reads T#5S, which is also the preset the timer is actually running on. Write T#10S to tTestPreset in the online view; from the next scan the pin monitor reads T#10S and the timer times against 10 seconds instead of 5. The declaration itself is illustrative — the type must match whatever the block declares for that input. Where variables live and how they bind into code is the same job in both languages, covered in the article on CODESYS I/O mapping for ladder and structured text use.

How do you bind a variable to an ENUM or STRUCT input? #

Use the pin's own declared type: an ENUM-typed commissioning variable so the engineering interface lists the valid symbolic values, or the matching STRUCT with a check of every member, and never an unrelated scalar substituted just to make the pin writable.

A mismatched type shows up as members or accepted values that do not fit the block input, and a STRUCT write overwrites the whole structure, so review every member before applying it. Unconnected structured inputs cause other documented traps in CFC-family editors as well; the fix for the Siemens CFC UDT unconnected input compile error covers the sibling case on that platform.

How do you verify the fix and hand the machine back safely? #

Confirm the written value reaches the block and stays there, then remove or formalize the binding before production: place the process in an approved commissioning state first whenever the block can start motion, because a value written at that pin is a live command to the running logic.

Verify in this order: unrelated live values update, so the session is healthy; the pin monitor follows the written value from the next scan; the value persists over several scans, so no other writer is replacing it. Know which operation you used. A write applies once and normal logic may change it later; a force holds against the logic until you release it — read the command label and the force-status indication before trusting either, and clear every force after the test. If neither editor permits entry at all, the fault lies with login state, application identity, or access restrictions, not the pin.

When should you keep the poke in Ladder instead? #

For a one-off commissioning test on a block you can call in a Ladder routine, Ladder's inline entry is faster because it needs no added variable and no download; for a point you will tune repeatedly or document, the CFC variable binding is the right choice.

The decision by case: throwaway test that survives one session — use Ladder inline entry and change nothing in the project. Logic that must stay in CFC, or a value you will touch again — declare the typed commissioning variable and write it online, because the write target stays explicit, searchable, and removable under change control. A value that belongs in production — give it a proper variable fed from your normal setpoint path, and treat the editor poke as commissioning only. If you want the CFC behavior changed, that is a vendor feature decision: submit it through the official channel with your exact engineering and runtime versions, and keep the binding as the working method until a release says otherwise.

Questions asked

What value does a CFC block use on an input with nothing connected?

It runs on that input's declared initialization value for its data type, and the pin monitor shows that value online. That is why a chart can behave sanely while the pin looks empty, and why writing the pin in CFC needs a connected variable rather than a double-click.

Why does my written value snap back after one PLC scan?

Something else in the executing logic assigns that variable every cycle, and the cyclic writer wins over a one-time online write. Search the project for every other write to the variable, stop or gate that writer under your approved test procedure, then write the value again.

Is writing a variable online the same as forcing it?

No. A write puts the value in once and normal logic may change it on any later scan; a force holds the value against the logic until you release it. Check the force-status indication before you trust either, and clear every force before the machine returns to production.

Can I get inline entry added to CFC in a future release?

That is a vendor feature decision. Submit the request through the vendor's official channel with your exact engineering and runtime versions so it lands against the right build. Until a release changes the editor, plan on the commissioning-variable binding as the working method.

Keep reading

  • How-to

    How to read Factory I/O REAL and INT tags in CODESYS Modbus TCP

    Factory I/O multiplies each Float sensor value by 100 and sends it as a 16-bit Word, and its Int tags cross as 32-bit values. In CODESYS, receive the Word, convert it to REAL, divide by 100.0, and declare each Int tag as a DInt; BOOL tags pass straight through the Modbus TCP slave mapping you already have.

    PLC programming

  • How-to

    Program startup, flasher and digital-use analog inputs on an M172

    Declare a BOOL, set it TRUE in an ST program assigned to the Init Task, compute the flasher as x1Sec := TO_BOOL((sysTimer/1000) MOD 2) in cyclic code, and convert each of AI5-AI8 with TO_BOOL before ladder accepts it as a contact. The object not found error means the example names were never declared.

    PLC programming

  • Troubleshooting

    When a CODESYS TON works in structured text but not ladder

    The structured text routine counts because its four statements run in sequence inside one scan; the ladder version fails when the reset network clears Timer.Q before the addition samples it, or an unconditional reset restarts the timer every cycle. Put the call, the Q test, the addition and the reset of the same TON instance in one ladder network, left to right in that order, and it counts exactly one B per interval.

    PLC programming