The compile message "PID function block not allowed" is a task-placement rule: a PID loop may not live in a task that runs every second. Cut the PID rung into the normal task that executes every scan, compile, then expect the update interval to drop from 1000 ms to the scan time and retune before the loop returns to auto.
On a PAC3000, the compile stops with a reason line that blames the block: PID function block not allowed. The task the compiler names is the one set to run every second. The rule behind the message is unconditional: a PID loop cannot be placed in a run-every-second task, and its only allowed home is a normal task executed every scan. The fix is quick, but it changes the loop's update interval from 1000 ms to the scan time, so the second half of the job is retuning and verifying before the loop returns to auto. This article gives the rule, the steps, the timing arithmetic and the checks that close the job out.
What does the "PID function block not allowed" compile error mean?
The message is a task-placement restriction: the compiler rejects any PID function block placed in a task configured to run every second, and it keeps rejecting the project until the block sits in a task that executes every scan.
The message carries two separate facts. Cannot compile "Run every second PID Loop" names the task where the compiler found the block, and PID function block not allowed is the reason. The reason is about location, not about the loop's gains, scaling, setpoint or wiring: changing gains or wiring leaves the error in place, because the restriction applies to the block's task assignment. No PID loop in the timed task means no compile, however well the loop is tuned.
Why is a run every second task not allowed to hold a PID loop?
The controller's documented rule gives a PID loop one allowed home, a normal task executed every scan, because PID output depends on elapsed time between updates and the controller pins that timing to the scan instead of letting the 1 s timed task own it.
A task that fires every second looks like a perfectly regular sample time, and for a slow process it would be. The rule is still unconditional. Vendors pin loop execution to a schedule the controller controls so the integral and derivative bookkeeping always works from a known interval; a timed task takes that control away. Where tasks sit in the execution order, and which logic wins when schedules overlap, is its own subject; the walkthrough on tracing PLC execution order across task layers covers it.
Which task is the PID block actually in?
Open the task configuration and check which task contains each PID rung: the error text itself names the task, Run every second PID Loop, so the block is either sitting in that 1 s timed task or in a second instance you have not found yet.
The symptoms and what each points to:
- The compile error names the run-every-second task. A PID function block is assigned to that timed task. Move it; the steps are below.
- The reason line reads
PID function block not allowed. The placement rule is firing. Gains, scaling and wiring are not part of it. - The error survives after you move one loop. A second PID instance remains in the timed task. Search the project for every PID instruction, including copies parked on unused rungs.
- The block looks like it lives in the normal task. Confirm the task assignment itself. A rung referenced from normal-task logic does not count if the block's own assignment still points at the timed task.
The check that settles it: read each task's type and interval in the task configuration. The every-scan task is the normal or scan task, and the timed task shows its interval next to its name.
How do you move the PID loop into the normal scan task?
Cut the PID rung from the run-every-second task, paste it into the normal task that executes every scan, confirm the block's task assignment actually reads the normal task, and compile again; the placement error clears with no change to gains, scaling or wiring.
- Open the task configuration in the programming software and list every task with its type and interval. Identify the normal task that runs every scan and the timed task running every 1000 ms.
- Search the project for every PID function block instance, including copies on unused rungs.
- Cut each PID rung out of the timed task and paste it into the normal task's program.
- Confirm each block now belongs to the normal task in the task configuration. A reference from normal-task logic is not an assignment.
- Leave the rest of the timed task's logic where it is; only the PID block has to move.
- Compile and confirm the placement error is gone.
Gains, alarm limits and the loop's mode are entries in the programming software's PID setup dialogs, and the move leaves those entries untouched. Retuning is a deliberate second step, covered next.
What changes when the loop updates every scan instead of every 1000 ms?
The loop's sample interval drops from 1000 ms to the controller's scan time, typically a few milliseconds on a small program, so a handful of milliseconds replaces one update per second and the gains you had no longer produce the same response.
Three things follow from the faster cadence. The integral term accumulates far more often per second, which is the change you will see first. Derivative action sees fresher samples, which exposes noise that a 1 s sample hid; use the derivative filter in the PID setup, or trim the derivative gain. And any edge-detect contact or one-shot that moved with the rung now fires per scan, the same class of behavior documented for PAC firmware edge contacts that copy data on every scan. Logic elsewhere carries the same trap: an SCL FOR loop on an S7-1200 executes fully on every scan cycle, however short the scan is.
Whether your controller's PID rescales its terms by the measured interval is a question its PID documentation answers; plan the first run in auto as a retune either way. Keep heavy logic out of the normal task as you add to it: a task that monopolizes scan time is the pattern behind a status task spin watchdog exception, and the PID's update interval slows with every millisecond the scan grows.
What does the timing change look like in a worked example?
A worked example shows the size of the change: a program whose diagnostics page reads a 5 ms scan time moves its PID from 1 update per 1000 ms to 200 updates per second, a 200-fold increase in how often the integral term adds its increment.
Scenario: a packaging-line temperature loop, tuned while the PID sat in the timed task, now relocated to the normal task. The diagnostics page reads a 5 ms scan time after the move. The arithmetic:
- Updates before: 1000 ms ÷ 1000 ms per update = 1 update per second, or 60 per minute.
- Updates after: 1000 ms ÷ 5 ms per scan = 200 updates per second, or 200 × 60 = 12,000 per minute.
- Integral action left unchanged: the old tuning moved the output 1% per second at a steady error, which at 1 update per second is 1% per update. At 200 updates per second, the same increment drives 1% × 200 = 200% of output per second, and the valve saturates on the first step.
- Starting point for the retune: 1% per update × 200 updates per second × 1/200 = 1% per second, so an integral gain one two-hundredth of the old value reproduces the old output rate. Tune from there against the step response, and leave derivative off or heavily filtered for the first auto runs.
The 5 ms reading is an illustrative number. Take the real scan time from your controller's diagnostics page before you divide.
Can I put the PID back on a 1 second cadence?
Recreating the old per-second cadence is possible only if your controller's documentation allows a gated PID rung; this controller documents one allowed home, the every-scan task, so run the block every scan and slow the loop's response with its tuning instead.
The task rule has no timed-task exception in the documented guidance, so a 1 s update comes from tuning, not placement. Sampling far faster than the process moves costs nothing physically: a temperature loop with a 30 s response time behaves the same whether the controller samples it every scan or once per second. The algorithm's bookkeeping changed, and the retune absorbs that. If the process needs slower logic around the loop, keep ramping, rate limiting or output staging in the timed task where it is allowed, and let the PID rung alone live in the normal task.
What should you check before the loop goes back to auto?
A clean compile clears the placement error and nothing else; before returning the loop to auto, verify the process-variable, setpoint and output connections, watch one step change on a trend, and compare the response against the behavior you tuned for.
- Connections: process variable, setpoint and output match the rung's design, with scaling unchanged from the version that ran before the move.
- Manual first: put the loop in manual, step the output by hand, and confirm the process variable moves in the right direction at the expected pace.
- Trend: watch the step on a trend with timestamps. If the loop shows on an HMI trend, mind the trend's own update budget, which is separate from the PID's scan cadence; the piece on why an HMI trend graph will not update every half second explains that limit.
- Operator on the loop: keep one person watching for the first auto step, with the manual station within reach, because a retuned loop can drive its output far faster than the old 1 s cadence did.
Recommendation: move every PID function block in the project into the normal every-scan task in one pass, compile until PID function block not allowed is gone, read the measured scan time from the controller's diagnostics, divide the integral gain by the update-rate ratio, and return the loop to auto only after a manual-to-auto step looks right on the trend.
Questions
How should I retune the loop after moving it?
Start in manual with the output steady, then divide the integral gain by the update-rate ratio you computed from the measured scan time; a 5 ms scan gives a factor of 200. Step the loop once, watch the trend, and adjust integral first, then proportional, keeping derivative off or heavily filtered on the first runs. Return to manual immediately if the output drives toward a limit.
Can a PID loop still fault after a clean compile?
Yes. Placement is only the first timing rule. Another controller family's documentation describes a PID that stops on a scan-time error, with recovery defined as a pulse on the Reset input of that vendor's PID_restart function block. If your controller faults its PID on timing after the move, look up its documented reset path in the controller's PID documentation and apply it under a controlled step, with the loop's output on manual standby.
How do I confirm the loop's real update interval?
Open the controller's status or diagnostics view in the programming software and read the measured scan time. The PID now updates once per scan, so a 5 ms scan is a 5 ms update interval, or 200 updates per second. Re-read it after any program edit, because added logic lengthens the scan and slows every PID update with it.
Planning information, not legal or engineering advice. Rules differ by place: check codes and permits with your local authority and your licensed trades.