The slave command misses because every register in the path is BCD while the multiply and divide run as binary. Convert each BCD register with BIN once, carry the ratio 22834/29558 as the integer pair 7725 and 10000, do the arithmetic in double-word binary, then convert the result back with BCD before it reaches the drive command register.
A slave drive command that comes out wrong after a multiply has a data-format problem, not a math problem. On this machine the operator enters 30 fpm, the screen scales it to 29558 and writes V400 in BCD, the adhesive drive needs 22834 in V402, also BCD, and the ratio works out to 22834 ÷ 29558 = 0.77251505. Binary multiply and divide instructions running on BCD bits scramble the number. The fix is three moves: convert each BCD register with BIN once at the calculation boundary, carry the ratio as the integer pair 7725 and 10000, and run the arithmetic in double-word binary, then convert the result back with BCD before it reaches the drive. This page gives the symptom check, the boundary test, the rungs and the tracking test that proves the slave follows the master.
Why the slave value comes out wrong
BCD stores each decimal digit in its own four-bit group, so 29558 sits in memory as the digit code 2-9-5-5-8. Read those same bits as a plain binary number and they spell 169304, about 5.7 times the value you meant. Multiply and divide instructions make exactly that misreading when they receive BCD data, and every result downstream inherits it.
Arithmetic on BCD bits has no repair path. The pattern that works is convert, calculate, convert back, and one compact PLC family documents the same conversion-first approach for BCD arithmetic worked in binary first.
The converters have documented names. BIN turns BCD into binary and BCD turns binary into BCD; BIN instruction's BCD-to-binary conversion carries that name across PLC families, while another vendor documents its converters as the pair TOD and FRD. Your programming manual's conversion table lists what your CPU has.
Nothing about the ratio, the registers or the drive wiring changes here. The conversions around the arithmetic are the whole fix.
Symptoms and what each one points to
- The slave output is several times too large and swings as the master moves. Binary arithmetic ran on BCD bits. The double word holding 29558 reads as 169304, so every product carries that error.
- The value sits one count low at the known point: 22833 where 22834 belongs. Truncated division on the 0.7725 approximation dropped the fraction that the exact quotient 22833.555 carried.
- The screen entry looks right but the drive sees garbage. A binary result landed in a BCD-format register. BCD digits stop at 9, so nibbles holding A through F turn the drive's scaling into nonsense.
- It tracked until values passed 9999. A five-digit BCD value spans two 16-bit words, so single-word moves and math garble it.
- The slave matched at 30 fpm and never moved again. V402 still holds the hand-entered constant 22834, which freezes the ratio at one speed.
Check the format at every boundary
Three boundaries carry this value, and each has its own format: the tag the screen writes, V400, and V402. On this class of machine the screen tag is a 32-bit BCD integer and both registers are BCD. Confirm yours before writing any rung.
Read the format from the tag configuration and the register monitor, never from the digits on the display. Enter the 30 fpm value at the screen so V400 holds 29558, then open the double word in the monitor: a binary view of 169304 under a screen value of 29558 means the bits are BCD. That same mismatch is what puts nonsense numbers on a screen fed from a PLC BCD analog register, and it is the diagnosis behind a numeric entry that lands wrong in a BCD analog output.
Two more checks at the same boundaries. If the screen's tag mapping already delivers binary, skip the BIN step; converting twice corrupts the value just as skipping it does. And confirm what consumes V402: this drive takes its command through a 4 to 20 mA output, so the counts-to-current mapping in the analog output configuration and the drive's input scaling sets the valid range. Keep the calculated value inside that range.
Carry the ratio as two integers
0.77251505 has no place in an integer register. Split it into a numerator and a denominator: 7725 over 10000, which equals 0.7725. The approximation sits 0.00001505 below the exact ratio, which is 0.44 counts at the reference point (29558 × 0.00001505 = 0.44). Truncated division adds the rest: the exact quotient 22833.555 loses its 0.555 fraction and lands at 22833, one count below the 22834 target. The rounding add in the worked example below recovers that count when it matters.
Order matters in the arithmetic: multiply by the numerator first, divide by the denominator second. One division then absorbs all the rounding error, which is how scaled-integer math on a PLC with no floating point stays accurate. Keep the denominator a power of ten, 10000 here, so the rounding add is half of it, a clean 5000.
Worked example: ratio 22834/29558 applied to a master command of 29558
Inputs. Master command V400 = 29558 counts, the screen's scaling of a 30 fpm entry. Matched slave command V402 = 22834 counts, the value tuned by hand to hold 30 fpm on the adhesive drive. Ratio pair 7725 over 10000, from 22834 ÷ 29558 ≈ 0.7725. Register range 0 to 65535 counts. Drive command span 4 to 20 mA. These are the machine's own commissioning values, and at this operating point the physical speed both drives share is 30 fpm.
Rule. Slave counts equal master counts × numerator ÷ denominator, evaluated in double-word binary after BIN conversion, with the quotient converted back through BCD.
Arithmetic.
- BIN turns the digit code 2-9-5-5-8 into the number 29558.
- 29558 × 7725 = 228,335,550. The product needs a double word; a 16-bit register tops out at 65,535.
- 228,335,550 ÷ 10,000 = 22833 with remainder 5550, and integer division drops the remainder, so the plain result is 22833.
- With the rounding add: 228,335,550 + 5,000 = 228,340,550, and 228,340,550 ÷ 10,000 truncates to 22834.
- BCD writes digits 2-9-5-5-8 back into V402.
Result. 22834 counts with the rounding add, 22833 without.
Decision. The rounding add reproduces the hand-tuned command exactly at the reference point. Plain truncation leaves the command one count low, 1/65535 of the span and about 0.004% of 22834. Keep plain truncation where a single count sits below the drive's resolution; add the 5000, or store the exact fraction 22834/29558 as the pair, where the drive resolves single counts. Both versions are monotonic: every distinct master value produces a distinct slave value, which is the precision a tracking drive needs.
The ladder, rung by rung
The setup rung runs once, on its SP0 condition, to store the constants:
STR SP0
LDD K7725
OUTD V410
LDD K10000
OUTD V412
V410 holds 7725 and V412 holds 10000. The calculation rung runs on the SP1 condition, or on whatever condition enables tracking on your machine:
STR SP1
LDD V400
MULD V410
DIVD V412
OUTD V402
In the instruction set these rungs use, LDD loads a double word, MULD multiplies double words, DIVD divides double words and OUTD stores a double word. Fit the pieces together in this order:
- Convert before the rung. Pass the screen tag and V400 through BIN into double-word holding registers. LDD then picks up the number 29558, never the digit code.
- Watch the product width. MULD writes a 32-bit product: 228,335,550 at the reference point, and 65,535 × 7725 = 506,257,875 at full scale. That fits a signed 32-bit double word, whose limit is 2,147,483,647. A single-word destination wraps at 65,535 and hands the divide a fragment.
- Round inside the rung. Add 5000 to the product before DIVD when a one-count error matters; the worked example above shows the arithmetic.
- Convert after the rung. Pass the quotient through BCD before it lands in V402, so the drive-facing register stays BCD end to end.
- Stay wide. Use the double-word forms the rungs show; the overflow hides in any narrower version.
The rungs are arithmetic only. The conversions in steps 1 and 4 make them correct on a BCD path; the same digits without the conversions produce the symptoms in the list above.
Prove the slave tracks before you trust it
At the reference point. Enter 30 fpm at the screen. V400 reads the matched master value and the calculated V402 reads 22834 with the rounding add, or 22833 with the plain divide. The drive's displayed command should match the hand-tuned value that held speed.
Across the range. Step the entry up and down through the increments operators actually use. Record V400, the calculated V402, the loop current and the drive's displayed speed at each step. Every distinct entry must move V402 in the same direction, every time; a flat spot or a reversal points at register width or a format slip.
What the drive can follow. Distinct counts at V402 are the PLC's half. The 4 to 20 mA path and the drive's input scaling set the rest: one count is 1/65535 of the span, and whether that step moves the motor is a number from the drive manual. Where the drive resolves coarser steps, exact tracking means monotonic output across the increments the operator can enter, and this fix meets that standard.
Retire the hand entry. Keep the manually entered 22834 in V402 only while the rung is being commissioned, because it holds the slave at one speed and hides tracking faults. Once the checks above pass across the range, the calculated value writes V402 every scan.
One wiring note: put the machine in its approved commissioning state before changing logic or wiring, and keep drive analog signals off the jumper-wire list as a shift workaround. A direct analog ratio path between drives is a legitimate design where the drives sit together; this installation has no such connection and the PLC already drives both commands, so the rungs above are the direct method.
Recommendation: Convert the screen tag and V400 with BIN into double-word registers, keep the ratio as 7725 over 10000, run the multiply and divide as double-word binary with the constants in V410 and V412, add 5000 to the product before the divide where a one-count error matters, and pass the quotient through BCD before it lands in V402. Keep the plain truncated divide only where a single count sits below the drive's resolution, and retire the hand-entered 22834 once the slave tracks across the operator's full entry range.
Questions
The register monitor shows 38232 in one word and 2 in the next. Which word holds the value?
Both are pieces of the same BCD value. The digits 2-9-5-5-8 split across two 16-bit words: the low word holds 0x9558, which reads as 38232 in binary, and the high word holds 0x0002, which reads as 2. BCD in one 16-bit word holds four digits and tops out at 9999, so a five-digit value always spans two words. Read and convert the pair as one double word and the value comes out whole.
Can the rung use the exact fraction 22834/29558 instead of 7725/10000?
Yes, with double-word math. Load the numerator 22834 and the denominator 29558 into the two constant registers, and the quotient at the reference point is exactly 22834, so the rounding add disappears. The width still checks out: the worst-case product 65535 × 22834 = 1,496,426,190 fits a signed 32-bit double word, whose limit is 2,147,483,647. The trade is larger constants in the setup rung and a slightly longer divide on some CPUs.
How fine a change can the drive actually follow?
One output count is 1/65535 of the command span. If the full count range maps to the full 16 mA span of 4 to 20 mA, one count is about 0.00024 mA. Whether that step moves the motor comes from the drive manual's input resolution, since the counts-to-current mapping is set in the analog output configuration. The practical acceptance test stays the same: monotonic tracking at the increments operators enter.
Planning information, not legal or engineering advice. Rules differ by place: check codes and permits with your local authority and your licensed trades.