How-to
How to set up Click PLC analog input scaling
Short answer
The Click has no scaling instruction: you scale in Setup, CPU Built-In I/O Setup, Input tab, where Low Scale and High Scale write an IEEE-754 float into the assigned DF register. Ladder reads that register with compare contacts (always >= or <=, never =) and math instructions.
On this page
There is no scaling instruction in the Click instruction set, so stop looking for one. You scale a Click analog input in the programming software, under Setup, CPU Built-In I/O Setup, Input tab: the CPU converts the channel and writes a scaled 32-bit IEEE-754 float into a DF register that you assign there, for example DF251. Ladder logic then reads that DF register only with math instructions and compare contacts. This article walks the setup, the ladder, a 50-sample filter, and what to do with a 10 kΩ thermistor or a 10-180 Ω sender.
Configure the channel #
The built-in analog channels accept 0-5 V or 4-20 mA, selected to match the field wiring. Follow these steps:
- Open the project and connect to the CPU.
- Choose Setup, CPU Built-In I/O Setup, or open System Configuration and click the I/O terminal strip, then the Input tab.
- Enable the channel (AD1 or AD2, depending on CPU) and choose Voltage (0-5 V) or Current.
- Enter Low Scale and High Scale in engineering units. For a current-loop transmitter rated 0-100 PSI, enter 0 and 100.
- Note the destination DF register the dialog assigns, for example DF251. That address is the only tag your ladder and HMI ever reference.
- Click OK and write the project to the CPU.
The scaling is linear and lives entirely in this dialog; changing the range later means coming back here, not editing ladder.
Read the value in ladder #
The result is a float, so you are limited to math or compares. For a compare contact, press the = key (the equals hotkey opens the compare contact) and enter the DF register in one field and your threshold in the other. Select >= or <= as the comparison type: analog values are almost never an exact equal, so an = contact flickers or never closes. Example rung:
STR X1 ----[ > DF251 75.0 ]----( Y1 )
Output Y1 energizes whenever the scaled pressure in DF251 exceeds 75.0 PSI. For conversions, use MUL and ADD on DF registers: DF300 = DF251 * 1.8 + 32.0 converts a Celsius reading to Fahrenheit, and DF251 * 0.145038 converts PSI to bar. Pick destination registers that do not collide with the one the I/O setup owns.
Worked example #
A 0-100 PSI transmitter at 4-20 mA sits at 12 mA. The current fraction is (12 - 4) / (20 - 4) = 8 / 16 = 0.5, so the DF register reads 0 + 0.5 * (100 - 0) = 50.0 PSI. A 12-bit converter gives 4096 counts over the span, about 3.91 µA per count on the current range, so the last digit of that float is 100 / 4096, about 0.024 PSI. When you verify the setup, inject 12 mA with a calibrator and expect 50.0 in the DF register; if you read something proportional but wrong, Low Scale and High Scale are the culprits, not the wiring.
Filter it with a block copy #
A raw channel carries noise. The field-proven Click approach is a moving average built from the block copy instruction, SC5, which moves a range of DF registers to a new range:
- Each scan, copy the buffer down one register: SC5 from DF251 through DF299 into DF252 through DF300.
- The newest scaled reading arrives at DF251 on the next analog update.
- Sum the 50 registers and divide by 50.0, writing the clean value to another DF register the rest of the program reads. In the reference setup, the process code uses the value at DF300 while the raw input sits at DF251.
Latency is N scan times: at a 10 ms scan, a 50-sample filter needs roughly 500 ms to settle after a step change. That is fine for a cooling-temperature loop; use 8-16 samples for fast pressure or flow.
Thermistors and resistance senders #
The built-in scaling only works when the sensor is a linear voltage or current source. A 10 kΩ thermistor is non-linear resistance, and a 10-180 Ω oil-pressure sender is a resistance swing the voltage input cannot read correctly: no Low/High Scale pair makes either linear. For cooling temperature use a Click RTD or temperature input module, or a thermostat module for simple control; for the oil-pressure sender use a signal conditioner that converts resistance to a current signal and then scale that channel as above. Trying to linearize a thermistor with ladder math on the raw counts is possible but there is no good reason to, when an RTD module does it in the module's own configuration.
Getting the values to an HMI #
No ladder is needed for display. Point the HMI tags at the DF registers the I/O setup assigned, such as DF251 for pressure and your module's assigned register for temperature, and the HMI reads the scaled floats directly. If the same analog setup you learned on other platforms used a raw count and an SCP-style instruction, drop that habit here; the approach differs from scaling an analog current input in CPM2 ladder exactly because the Click scales in configuration only.
Decisions #
- Linear voltage or current sensor: scale it in CPU Built-In I/O Setup, read the DF register with compares and math, filter with SC5 into a 50-register buffer for slow loops.
- 10 kΩ thermistor: move it to an RTD module; do not scale it on the built-in channel.
- 10-180 Ω pressure sender: add a resistance-to-4-20 mA conditioner, then scale as a normal current input.
- HMI display: map tags straight to the DF registers; write no ladder.
Questions asked
Why does my compare contact on an analog value never go true?
You probably used the = operator. A scaled analog float almost never lands on an exact value, so an equals contact sits false or flickers with the last ADC count. Replace it with >= or <= against your threshold.
Can I scale a 10 kΩ thermistor or a 10-180 Ω sender on the built-in input?
Not usefully. Those are resistance devices, not linear 0-5 V or 4-20 mA sources, so the built-in Low/High Scale has nothing linear to span. Move them to a Click RTD or temperature input module, or to a signal conditioner that outputs a current signal, then scale that channel.
Which Click CPUs have built-in analog inputs?
Only the models whose CPU datasheet lists analog I/O built in, and the channel count and range differ by CPU. Check your exact CPU's datasheet before wiring; if the CPU has none, add an analog I/O module and scale it the same way in the module's I/O setup.
How long does a 50-sample filter take to settle?
At a 10 ms scan time the moving average needs about 500 ms (50 samples times 10 ms) to fully reflect a step change. Drop to 8-16 samples for pressure or flow loops where response matters more than smoothness.