IMDTouchKnowledge BaseShop main store

How-to

Why HMI touch screen portrait rotation needs two checks

HMI and touchscreens Published 7 min read

Short answer

Set the portrait orientation from the target's Display settings or run xrandr -o right or xrandr -o left on the target, with xrandr -o normal to return to landscape. Rotating the picture does not align touch by itself, so verify the portrait layout and the touch coordinate mapping as two separate acceptance tests.

On this page
  1. How do you rotate a local HMI touch screen to portrait?
  2. Is the display sideways, or is the HMI page just too wide?
  3. How do you rotate the picture from the Display settings?
  4. How do you rotate the session with xrandr at a terminal?
  5. Can the HMI application rotate the screen itself at startup?
  6. Does the portrait HMI fit the 600 × 800 workspace?
  7. How do you check touch coordinates after rotation?
  8. Does the rotation survive a restart?
  9. Questions asked

A portrait conversion of a local HMI touch screen needs two separate checks, because rotating the graphical output never adjusts the touch input path by itself. Turn the picture with the target's Display settings, or run xrandr -o right or xrandr -o left in a terminal on the target; xrandr -o normal returns the output to landscape. Where the required portrait workspace is 600 × 800 pixels, you then confirm the HMI pages fit that space and that each touch lands on the control you pressed. Treat the layout check and the touch-mapping check as two separate acceptance tests, in that order, and the usual failure modes separate cleanly instead of hiding each other.

How do you rotate a local HMI touch screen to portrait? #

Use the target's Display settings dialog when you have local desktop access, or run xrandr -o right or xrandr -o left from a terminal on the target, with xrandr -o normal as the tested way back to landscape.

Both routes change the coordinate space of the graphical desktop; neither one touches the HMI project, the PLC logic or the touch input path. That is why the commissioning order matters: rotate the output first, check that the application fits the rotated workspace, then check that touches follow the displayed controls, and only then make the rotation persistent across a restart. Mixing these steps is the usual reason a portrait conversion fails its first try on the machine: a rotated picture with an unfitted page looks like a touch fault, and a mapping error looks like a layout fault.

Is the display sideways, or is the HMI page just too wide? #

Read the whole desktop, not only the HMI page: if the desktop itself is sideways the display output needs rotation, while an upright desktop with a clipped page is an application-layout problem and an upright picture with misplaced touches is a touch-mapping problem.

Diagnose from what you see before changing any setting:

What you observe What it means What to check next
Desktop and HMI both sideways against the mounted panel The display output needs rotation The target's Display settings, or the rotation commands below
Desktop upright, HMI page too wide, controls clipped or scroll bars appearing The page layout does not fit the portrait workspace The HMI window and page dimensions in the project
Picture upright, but touches select another location Touch coordinates were not adjusted to the new orientation The touch-mapping check below
Geometry correct, but values stale or showing communication errors The tag, driver or controller path, not the orientation Communication diagnosis, handled separately

How do you rotate the picture from the Display settings? #

The Display settings dialog on the target changes the desktop orientation without adding any command to the HMI application, which makes it the fastest route during bench commissioning.

Panel-specific menus differ; the walkthrough of rotating an HMI panel screen from portrait to landscape shows the same orientation choice on another panel family, and the steps below apply to any target with a graphical desktop:

  1. Connect the intended touchscreen and open the target's Display settings.
  2. Read the active display dimensions and inspect the available orientation choices.
  3. Select the portrait direction that matches the physical mounting of the panel.
  4. Apply the change and inspect the entire desktop before launching the HMI; if you present the application without a desktop, the guide to running an HMI application touch-only in forced full screen covers the launch side.
  5. If the workspace is not the portrait size the project requires, inspect the available display modes separately, because an orientation change never selects a different resolution on its own.

Once the desktop is upright and the reported workspace matches the requirement, move on to the application fit check.

How do you rotate the session with xrandr at a terminal? #

Test the command from a terminal on the target before placing it anywhere in application logic: xrandr -o right requests a clockwise rotation and xrandr -o left the opposite, while xrandr -o normal returns the output to its normal landscape orientation.

xrandr -o right
xrandr -o left
xrandr -o normal

Run the first command, then read both the resulting picture and any error text. If the image rotates but faces the wrong way for the mounting, run the other direction. If the command cannot access the display, investigate the graphical session and the account running the command: xrandr operates on an Xorg session, so a target booted into Wayland must either switch to Xorg or be rotated through its own compositor. A process that needs to rotate the screen also needs access to the active graphical display, and success in a local terminal does not prove that a background process has the same environment or permissions. Repeatedly issuing the same command never fixes an unsupported display configuration.

Can the HMI application rotate the screen itself at startup? #

Yes, a LabVIEW application can run the already-tested rotation command itself: the System Exec VI executes command-line code from within the running application on the target machine.

Prove the command interactively in a terminal first, then place that exact command in a deliberate initialization path, not inside code that runs on every screen update. Capture the execution status and any error output so a failed rotation is distinguishable from an HMI layout fault at startup. If the application-initiated rotation behaves differently from the terminal test, compare the execution environment of the two: the display access and permissions that a logged-in terminal session has are not automatically present in the application's context. The Display dialog and the command route both meet the orientation requirement; prefer the dialog for interactive commissioning and a tested command when rotation must form part of controlled startup.

Does the portrait HMI fit the 600 × 800 workspace? #

Rotation transposes the same panel pixels rather than creating new ones: an 800 × 600 landscape panel becomes a 600 × 800 portrait workspace with an unchanged diagonal, because 600² + 800² = 360,000 + 640,000 = 1,000,000 and the square root of 1,000,000 is 1000 px.

The pixel budget is therefore the same in both orientations; what changes is how much width and height the page has to work with. Window borders, title bars and desktop elements reduce the usable client area below the monitor dimensions, so inspect the application's actual presentation instead of trusting the panel specification:

  • Open every page and look for clipped labels, hidden buttons, overlapping objects and unexpected scrolling.
  • Check navigation controls, alarm displays, entry dialogs and any pop-up windows used during operation.
  • Confirm the application's presentation mode, since a windowed runtime offers less area than a full-screen one.

Portrait layouts can also produce rendering artifacts on some headless HMI runtimes; the guide on resolving portrait-mode graphical artifacts on a headless HMI shows what those look like and how they differ from a genuine layout problem. If the picture fits but content is clipped, revise the page layout in the project; never fix a layout problem by moving or resizing touch targets on the machine side.

How do you check touch coordinates after rotation? #

After xrandr -o right, a touch driver that still reports native panel coordinates lands at portrait position (600 − y, x): a press the driver reports at native (200, 150) must appear at (450, 200) on the rotated screen.

Rotation command Portrait position for a native report (x, y) Example: native (200, 150)
xrandr -o right (600 − y, x) (450, 200)
xrandr -o left (y, 800 − x) (150, 600)

Run the corner test with machine actions inhibited or in an approved test state. Touch controls near each corner and at the center, and compare each visible target with the location that actually receives the input. When the mapping is correct, the touch origin (0, 0) sits at the top left of the portrait display. If presses land displaced, mirrored or rotated, correct the mapping through the applicable input configuration; some touch controller drivers expose their own orientation setting instead, for example a call like setRotation(1) in an Arduino-style driver, set to match the display direction. Do not move HMI buttons to compensate for an input-coordinate error — that relocates the symptom, not the fault.

Does the rotation survive a restart? #

A terminal command or a Display-settings change lasts only for the current graphical session, so a power cycle returns the output to landscape until you make the rotation persistent.

An X configuration file is the usual persistent route mentioned for this kind of target, but its file location and contents depend on the installed graphical environment, so use the target's own documentation before editing that configuration. If rotation belongs to the application instead, keep the tested command in the startup path described above. Accept persistence with a real restart test: restart the target, confirm the orientation before anything else, reopen the HMI and repeat both the page-fit check and the corner-and-center touch check, because a restart can clear a session-only fix that the bench test never exposed. Keep xrandr -o normal in the commissioning notes as the tested return path while you work.

Questions asked

Does rotating the display change anything in the PLC program?

No. Orientation is a presentation change on the panel; tag addresses, controller logic and communication settings are untouched. What does change is the page geometry: any HMI page designed for a landscape workspace needs its layout reviewed so labels, buttons and alarm objects fit the portrait workspace without clipping or unexpected scroll bars.

Why does xrandr fail on some targets?

The xrandr tool operates on an Xorg graphical session. A target that boots into Wayland or another compositor rejects the command or ignores it. Switch the session to Xorg where the target offers that choice, or use the running compositor's own rotation setting. A success in a local desktop terminal also does not guarantee the same result from a background process, which may lack the display access or permissions.

Do I need to recalibrate the touchscreen after rotation?

If touches land where the screen shows them after rotation, no. If presses land displaced, mirrored or rotated, correct the input coordinate mapping first, through the input configuration's coordinate transform or the touch driver's own rotation setting. Recalibrating before that fix bakes the rotation error into the calibration data, and the error returns at the next orientation change.

Keep reading

  • How-to

    How to Rotate a 3D Object on a Touch Panel With Drag Input

    Leave the camera fixed and rotate the object: map each drag to a rotation delta at 0.3 degrees per pixel and compose it onto the object's current orientation as a quaternion, around a pivot at its center. Only the object transform changes per drag, so no camera up-vector or translation is ever recalculated.

    HMI and touchscreens

  • Troubleshooting

    Why HMI Screens Fill With Question Marks After a Return Goto

    Question marks filling a screen after a return Goto mean the display's objects cannot resolve their tag values. The usual cause after adding a return button is a parameterized display opened without its parameters. Compare the failing route with a known-good route to the same display before touching communications.

    HMI and touchscreens

  • Troubleshooting

    HMI Text Runs Off the Screen After Downloading the Project

    The panel and the project are both fine: the engineering PC's Windows display scaling is above 100%, so the downloaded layout lands past the panel edge even though the editor and offline simulation look correct. Set the scale to 100%, restart the PC, then redownload.

    HMI and touchscreens

Why touch input jumps to a second HDMI monitor