IMDTouchKnowledge BaseShop main store

Troubleshooting

Displaying Negative Drive Values and Script Writes in Vijeo Designer

HMI and touchscreens Published 5 min read

Short answer

The reverse readings failed because the Vijeo Designer variables were typed UINT, which cannot show a value below zero; set them to INT and the same drive words display negative. The script write is a separate fault: point the script's write at the setpoint variable the keypad uses, clamp the result to the drive's documented setpoint range, and verify the write on the connected panel, not in the simulator.

On this page
  1. Why reverse shows as a huge positive number
  2. Why the float attempt displayed nonsense
  3. Change the display variables to INT
  4. Why the keypad writes but the script errors
  5. Make the arrow buttons read-modify-write the setpoint
  6. Verify on the connected panel
  7. Questions asked

Reverse speeds did not display because the variables behind the numeric displays were typed UINT, a 16-bit unsigned type that stops at zero. Change them to INT and the same drive words display negative values with no change at the drive. The script write is a separate fault: reading a drive value into an internal variable proves the read path, and the error appears only when the script writes back, so the problem sits in the write target, not the arithmetic. Write the setpoint register the keypad already writes, not the feedback word, clamp the result to the drive's documented setpoint range, and confirm the result on the connected panel. This article works through both faults with the numbers to check at each step.

Why reverse shows as a huge positive number #

A Modbus holding register is a 16-bit word, and the protocol itself carries no sign; the panel decides how to read those bits. The two 16-bit types behind the numeric display are INT, signed two's complement from -32768 to 32767 as IEC 61131-3 defines it, and UINT, unsigned from 0 to 65535. The drive reports reverse as a negative word, and the same sixteen bits answer to both types.

Worked example with illustrative values, a drive output word holding -150 counts, a reverse speed in this project's scaling:

  • Read as INT: -150 counts
  • Read as UINT: 65536 - 150 = 65386, where 65536 is the full span of one 16-bit word

A display that shows plausible forward numbers and then jumps into the 65000 region on reverse is the signature of a UINT variable on a signed word. The decision for both displayed words, velocity at %MW8604 and frequency at %MW3202, is INT on the project variables. The same signed and unsigned arithmetic follows the word onto other platforms; converting signed INT to unsigned UINT in Allen-Bradley PLCs runs the identical rule on the PLC side.

Why the float attempt displayed nonsense #

A REAL variable occupies two consecutive words, and its displayed value depends on the word order between panel and controller. Type one signed drive register as REAL and the panel combines it with the next register, so the number on the screen means nothing. Signedness of a single word is an INT question, never a REAL question; the fix is INT, not a different floating-point setting. The word-order behavior behind REAL display faults is the same one behind displaying a PLC real value over Modbus on an HMI.

Change the display variables to INT #

Make the change in the variable definition, not in the display object's number format: the display object reads through its variable, so the variable's type controls the sign.

  • Open the project variable behind the velocity display, change its type from UINT to INT, and leave the address at %MW8604.
  • Repeat for the frequency variable at %MW3202.
  • Rebuild and transfer the project.
  • Run the drive forward and confirm the values read as before.
  • Run the drive in reverse and confirm both displays show negative values.

One condition on this fix: the drive must document those words as signed. If a word is documented unsigned, the direction lives elsewhere, in a sign flag or a status word, and re-typing the variable only buries that fact.

Why the keypad writes but the script errors #

The documented script access to a Vijeo Designer variable uses getIntValue() to read and write() to write, and the failing script matches that pattern:

int a = 0;
a = Lathe_Output_velocity.getIntValue();
Lathe_Output_velocity.write(a + 1);

Displaying the calculated value on an internal variable proved the read path and the arithmetic. The drive raises the error at the write, so work that boundary:

  • The script's variable must be the external device variable mapped to the drive register, not an internal copy. If Lathe_Output_velocity is internal, the write never reaches the drive; rebuild the target as an external variable, and adding a Modbus RTU driver and external variables in Vijeo Designer covers that setup.
  • The target register must accept writes. Output velocity and output frequency are feedback the panel reads; the keypad succeeds because it writes the setpoint at %MW8602, and a write back to a feedback word is the kind of write a drive refuses.
  • The value must sit inside the drive's documented range for that register.
Observed result What it proves Next check
Internal display shows a + 1 Read path and arithmetic work The write target only
Keypad entry changes the setpoint That register accepts writes from the panel Point the script at the same variable
Script write returns a drive error The drive refused this value or this register Writable register, matching type, value in range
Simulator screenshot succeeds Script logic against simulated values Repeat on the connected panel and read back

The decision: scripts write setpoints, displays read feedback. Point the arrow logic at the same variable the numeric input writes.

Make the arrow buttons read-modify-write the setpoint #

The switch set to the word operation changed the address rather than the register contents, and that observed behavior is why value arithmetic belongs in a script. In the examples below, Setpoint is an illustrative name for your setpoint variable, the external variable mapped to %MW8602, and the local a is declared int and starts at 0.

Up-button script:

int a = 0;
a = Setpoint.getIntValue();
a = a + 1;
if (a > 600) {
    a = 600;
}
Setpoint.write(a);

Down-button script:

int a = 0;
a = Setpoint.getIntValue();
a = a - 1;
if (a < 0) {
    a = 0;
}
Setpoint.write(a);

The limits 600 and 0 are example values; substitute the minimum and maximum setpoint the drive documentation states, so repeated presses cannot command past them. Attach each script to its button's action. One safety note: every accepted write becomes a commanded speed, so test the buttons with the drive stopped or at a safe low speed before they go into production use.

Verify on the connected panel #

The simulator runs the script against simulated variables; it proves syntax and logic, and nothing about the device write. Close both faults with the panel connected:

  • Press up once from a known setpoint: the display increments by one, and a read of the setpoint register returns the new value.
  • Run the drive in reverse: velocity and frequency both display negative values.
  • If the keypad writes and the script still errors on the same variable and the same value, compare the variable types and read the panel's communication diagnostic for the rejected write.

When those checks pass, both faults are closed: INT on the display variables for the negative readings, and the setpoint register under the arrow buttons for the write.

Questions asked

Why does a reverse speed show as a number near 65000 instead of a negative value?

The 16-bit word has not changed; only its interpretation has. An unsigned reading maps the top half of the two's-complement range to 32768 through 65535. As a quick check, subtract 65536 from any unsigned reading above 32768: 65386 minus 65536 gives minus 150. If that result matches the expected reverse speed in your scaling, the variable belongs on the INT type.

Does changing the variable from UINT to INT change what the drive sends?

No. The same sixteen bits cross the link either way; the register itself carries no sign. The type only tells the panel how to interpret the word for display. That is why the fix is made once in the variable definition and needs nothing changed at the drive, and why one project can show two different numbers for the same register.

Why does the script run in the simulator but error against the drive?

The simulator runs the script against simulated variable values, so it proves syntax and arithmetic, nothing more. A device write depends on the variable's register mapping, the drive's write rules for that register, and the value staying inside the accepted range. Only a run on the connected panel that writes and then reads the register back confirms the whole path.

Which register should the arrow buttons change?

The same setpoint register the numeric input writes when you enter a value on the keypad. Output velocity and output frequency are feedback words the panel reads; drives commonly reject writes to them, which matches the error raised when the script wrote back to the velocity variable. Increment the setpoint, then read the setpoint register back to confirm the drive accepted it.

How do I keep the arrow buttons from running the setpoint past the drive limit?

Take the minimum and maximum setpoint from the drive's parameter documentation and clamp the script result before writing. With example limits of 0 and 600, the up script writes the smaller of value plus one and 600, and the down script writes the larger of value minus one and 0. Replace the example limits with the documented values for your drive.

Keep reading

  • Troubleshooting

    Displaying a PLC Real Value Over Modbus on an HMI

    An INTEGER display that reads the register proves the link, station and address, so a blank REAL display is a 32-bit mapping fault. Declare the HMI variable as a 32-bit float on the register pair (40064/40065), set the device double-word order to Low Word First to match the PLC, and give the numeric field six integer digits for 628402.0.

    HMI and touchscreens

  • How-to

    Adding a Modbus RTU Driver and External Variables in Vijeo Designer

    Add one Modbus RTU equipment driver on the HMI serial port, set the baud, parity and stop bits every slave shares, and give each device a unique slave address. Then create one external variable per value, pointing it at that device and its documented register with the matching data type. Mismatched serial settings or duplicate addresses show up as read timeouts, so commission one device at a time.

    HMI and touchscreens

  • How-to

    Displaying S7-200 Analog Inputs on a WinCC HMI

    Copy the channel word into V-memory with LD SM0.0 and MOVW AIW0,VW1000, put the CPU in RUN, then read VW1000 with a WinCC tag typed as a 16-bit integer and bind it to a numeric field. Four readings — channel word, destination word, tag, display — isolate any fault; the first one that fails names the layer to fix.

    HMI and touchscreens

Scaling a 32-bit float Modbus value in an HMI script