IMDHMIControls LibraryShop main store

Troubleshooting

Why GX Works 2 ST pulse timer TP fails with error C9009

PLC programming Published 9 min read

Short answer

Error C9009 on a structured text TP pulse timer in GX Works 2 is a compile-stage failure in device/label automatic assignment, not a broken timer. Test the unchanged FX3S project in GX Works 2 1.620W first: the same code that fails in 1.586L compiles there, so the installed build is the first suspect. Widen the automatic-assign timer range only when counted label consumption proves a real shortage.

On this page
  1. Why does my structured text TP timer fail with error C9009?
  2. Which GX Works 2 version compiles the TP instance correctly?
  3. Is the TP instance itself correct in structured text?
  4. How do I check the timer range in the device/label automatic-assign setting?
  5. How do I fix C9009 step by step?
  6. How do I verify the timer after the compile passes?
  7. When is C9009 a real timer shortage?
  8. Which C9009 fixes waste time?
  9. Questions asked

A structured text TP pulse timer that stops the build with C9009 — "Insufficient number of Timer points in device/label automatic-assign setting" — is usually not a timer problem at all. In the documented FX3S case, the identical project failed to compile in GX Works 2 1.586L and compiled untouched in 1.620W, so the installed software build is the first suspect, ahead of the declarations and ahead of the timer range. The message names a compile-stage allocation failure: the compiler could not map timer points to the timer-type labels through automatic assignment. Work it in this order — read the error for the stage it names, retest the unchanged project in a newer build, then check the automatic-assign timer range against real label consumption and widen it only by the counted deficit. IEC 61131-3 defines TP with exactly the input, preset, output and elapsed-time arguments the failing call already uses.

Why does my structured text TP timer fail with error C9009? #

C9009 is raised while the compiler performs device/label automatic assignment and finds no timer point available to give a timer-type label, so the build stops before any program image exists. It names an allocation stage, not a CPU fault, and it does not by itself prove the FX3S has run out of timers.

In a structured project, a label whose data type is a timer function block — the TP instance in this project — never receives a device number you type into the variable list. The compiler assigns a timer device to it automatically, out of the range the project opens for that purpose, and that stage is exactly what the message names. Two different causes produce the same text: the range is genuinely too small for the labels declared, or the compiler build cannot process the timer interface its own help describes. Before changing anything, record the GX Works 2 build shown on the software's version screen, the FX3S target, the full message text, and the current automatic-assign settings; that record is what makes the version test in the next section decisive.

Which GX Works 2 version compiles the TP instance correctly? #

The documented comparison is GX Works 2 1.586L versus 1.620W: the identical FX3S project with one TP instance fails the compile in 1.586L and compiles without a single edit in 1.620W, which makes the installed build the deciding variable.

Test it with the project unchanged: same code, same target, same automatic-assign settings. Open a copy in 1.620W or a newer build obtained through the vendor's documented software channel, accept only the project conversion the newer build requests, and compile with no other edit. If C9009 disappears with zero source changes, stop editing — the build was the cause and the code stands.

The mismatch is visible inside the older tool itself: the help that 1.586L displays describes a TP interface the same build refuses to compile. The most plausible reading of that pair of results is that between the two builds the timer interfaces were brought in line with the standard-shaped interface the help already showed, while the older installation kept its earlier behavior and its earlier documentation. That is why the tempting edits miss: renaming the instance or its arguments does not touch resource resolution, adding a ladder-style timer device changes the programming model instead of the build, and widening the range can clear a real shortage but cannot teach an older compiler a newer interface. Record the working build beside the project file so the next rebuild uses one that handles this timer interface.

Is the TP instance itself correct in structured text? #

Yes — the failing project's declaration pattern is already correct: a global instance of data type TP with a Boolean input, a Time preset, a Boolean output and a Time elapsed value, called with named arguments, and no device number typed into the instance.

The call and the global declarations are:

TP_1_Inst(IN:=TP_1_I, PT:=TP_1_PT, Q:=TP_1_Q, ET:=TP_1_ET);
  • TP_1_Inst, data type TP, the function-block instance
  • TP_1_I, data type Bit, the input
  • TP_1_PT, data type Time, the preset
  • TP_1_Q, data type Bit, the output
  • TP_1_ET, data type Time, the elapsed value

IEC 61131-3 defines TP with exactly those formal parameters, so the argument list needs no correction, and all five labels sit in the global variable list as VAR_GLOBAL with the device and address columns empty — which is correct for label-based use. This is function-block syntax: you call the instance and wire its named arguments; you do not attach a ladder-style timer device to it. The mapping from label to physical timer happens in the compiler's automatic-assignment stage, which is why a textually correct declaration can still die there with C9009. Renaming any of the five labels changes nothing about that stage.

How do I check the timer range in the device/label automatic-assign setting? #

Open the project's parameter settings where device ranges are opened to label-based automatic assignment and read the timer range: if it is empty or already consumed by other labels, C9009 is a genuine shortage and widening it is the correct fix.

The GX Works 2 Version 1 operating manual for structured projects states the mechanism: timers are assigned automatically to timer-type labels, and where a label is to resolve to a 10 ms timer or a retentive timer, the corresponding device range has to be defined in that setting. The range therefore decides both capacity and timer type. Read four things before editing: how many timer-type label instances the project declares, which timer types those labels need, how many timer points the configured range covers, and how many timer devices ladder logic already binds by explicit number. If the range holds free points of the type the labels need, allocation has capacity, and the error points back to the compiler build rather than the configuration.

How do I fix C9009 step by step? #

Fix it in this order: save a copy, record the failing environment, confirm the timer range is genuinely short, keep the structured text interface intact, retest the untouched project in a newer GX Works 2 build, and widen the range only when counted label consumption proves the shortage.

  1. Save a recoverable copy of the project exactly as it stands, producing C9009, before any parameter or version change.
  2. Record the environment: the GX Works 2 build from the version screen, the FX3S target, the full message text, and the current automatic-assign timer range.
  3. Count consumption: every timer-type label instance in the project, plus every timer device ladder logic binds by explicit number.
  4. If consumption exceeds the range, widen or free the range by exactly the counted deficit and recompile.
  5. If the range is not short, open a copy of the untouched project in GX Works 2 1.620W or a newer build, accept only the requested conversion, and compile with no other edit.
  6. If the compile passes, the build was the cause: record that build with the project and leave the code as it stands.
  7. If C9009 survives on the newer build, return to step 3 and recount, because the same message also reports a genuine shortage.

One safety note: this fix ends in a download, and a download is a change to the machine's control program — transfer first to a stopped system or a bench copy and follow your site's change procedure before the machine runs.

How do I verify the timer after the compile passes? #

A passing compile proves only that the TP interface was accepted and timer points were assigned, so verify the pulse at runtime: drive the input false to true and watch the preset, output and elapsed labels while the machine is safe to run.

Put the controller online, monitor the four labels, drive TP_1_I from false to true, and watch TP_1_Q hold true for the preset duration while TP_1_ET counts toward TP_1_PT. TP is the standard's pulse timer: one rising edge starts one output pulse of the preset length, and the pulse ends when the preset elapses even if the input has already dropped. If the pulse length is wrong or the edge never arrives, that is runtime logic and a separate fault, not a return of C9009.

Behavior diverging between a timer as written and the same timer at runtime shows up in other environments too; the closest analogue is the CODESYS case where a TON works in structured text but not ladder. This CPU family has its own structured-text trap, a TON that trips an alarm immediately in an FX CPU. A compile pass clears the software stage only; if the project then refuses to transfer, work from the write-up on resolving a project that compiles but will not upload to the PLC.

When is C9009 a real timer shortage? #

Treat C9009 as a real shortage when declared timer-type label consumption exceeds the timer points left in the automatic-assign range, and size the widening to the deficit you counted rather than to a round number.

Worked example with example numbers: suppose the automatic-assign setting opens a timer range of 16 points for labels. The first program revision declares five timer-type labels — the TP instance plus four TON labels — so consumption is 5 of 16 and the range cannot be the cause of any C9009 there. A later revision adds nine timer labels for a running total of 14 against 16, still inside. The next addition, one more TP instance for a new interlock, takes the count to 14 + 1 = 17 against 16 — a deficit of 17 − 16 = 1 point — and that revision is exactly the one that would report C9009, correctly, because this time the range really is short.

Decide the widening from that count: raise the range by the deficit plus the labels already known to be coming; if the next revision plans two more timers, widen by 3 in one edit instead of three visits. Two limits frame the number: the range cannot exceed the FX3S's documented timer device count, which comes from the CPU's own manual, and free points only serve a label when the range holds the timer type that label needs, so 10 ms and retentive labels need their own ranges defined.

Which C9009 fixes waste time? #

The wasted moves are rewriting the timer as ladder, binding an arbitrary timer device to force an address, renaming the instance or any argument, and changing code, range, target and software version in one test — none of them touches the mechanism C9009 reports.

  • Rewriting the timer in ladder: the structured-text call compiled unchanged in the newer build, so the source was never at fault; a rewrite trades a version problem for a programming-model change.
  • Binding an arbitrary timer device: it can overlap a device the rest of the logic already uses, and it hides whether the build or the range was the real cause.
  • Renaming the instance or its arguments: automatic assignment resolves by label class and data type, not by name.
  • Changing code, range, target and build in one test: the clean version comparison is what isolated the cause; scramble the variables and you lose it.
  • Treating every C9009 as a version fault: the identical message reports a genuinely consumed range, so the consumption count still decides.

The decision, case by case: if the unchanged project compiles in the newer build, the installed version was the fault — record the build, keep the code, manage versions instead of timers. If it still fails there, count declared timer labels against the configured range, widen by the counted deficit plus planned labels, and confirm with a recompile before any download.

Questions asked

Does error C9009 affect a PLC that is already running?

No. C9009 is raised at compile time and stops the build before any download, so the program already running in the FX3S is untouched. The risk sits in what you change while chasing it: binding an arbitrary timer device to force a compile pass can overlap a device the running logic already uses. Keep every change inside the counted, verified path.

Do ladder timers and structured text timer labels draw on the same timer devices?

They land on the same physical timer devices in the CPU, by different routes: a ladder timer names its device explicitly, while a timer-type label such as the TP instance receives a device automatically from the configured range. Keep the range open to automatic assignment clear of any device your ladder logic binds by number, and take the FX3S's total timer count from the CPU's own manual rather than from memory.

What does TP do differently from TON at runtime?

TP is the pulse timer: one rising edge at its input starts a single output pulse that lasts exactly the preset time, and the pulse ends on schedule even if the input has already dropped. TON holds its output TRUE only while its input stays TRUE and the elapsed time has reached the preset. Choose TP when the output length must not depend on how long the input stays on, and TON for a delay-on signal that follows its input.

Can a timer range have free points and still cause C9009?

Yes, when the free points are the wrong timer type for the label. The structured-project operating manual states that timers are assigned automatically to timer-type labels, and that where a label is to resolve to a 10 ms timer or a retentive timer, the corresponding device range has to be defined in the automatic-assign setting. Free points of another type cannot feed those labels, so the compiler still reports timer points as insufficient.

How do I stop the same mismatch from returning on the next machine?

Record the GX Works 2 build that compiled the project next to the project file itself, and rebuild only with that build or a newer one, recompiling to confirm. When an archive is reopened years later on an older installation, the recorded build is the first thing to compare, before anyone edits timer labels, ranges or code.

Keep reading

  • 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

  • Troubleshooting

    Why a structured text TON trips an alarm immediately in an FX CPU

    The instant alarm comes from a timer preset that never receives a value: a TON whose PT input is empty meets its finish condition on the first scan, so Q drives Alarm before the stroke has run at all. Assign the preset a real TIME value, call every timer instance once per scan so none freezes with stale state, and replace the interlocked flags with a CASE state machine so Alarm has exactly one writer.

    PLC programming

  • Explainer

    How a REPEAT loop runs in PLC structured text

    In IEC 61131-3 structured text, a REPEAT loop executes its body first and evaluates the UNTIL condition after it, so the body always runs at least once and the whole loop completes inside one task invocation. With i := 0 and UNTIL i >= 10, the body runs 10 times and i ends at exactly 10; the test position is what explains the off-by-one cases and when WHILE fits better.

    PLC programming