# TouchWin Screen Switching And Animation Use this P1 reference for TouchWin page switching, PLC-controlled page changes, current-screen reporting, button controls, indicator buttons, and moving/rotating animation. Source anchors: - TouchWin editing manual v1.2 PDF page 38: system settings `交互`, `控制画面变换`, `报告当前画面号`. - TouchWin manual PDF pages 80-81: `4-3-7 画面跳转`, password/permission and enable/display control. - TouchWin manual PDF pages 65-68: `4-2-10 平移动画`, `4-2-11 旋转动画`, material/visibility behavior. - TouchWin manual PDF page 56: object animation can move X/Y position by register value. - TouchWin manual PDF pages 75-77: button and indicator-button operation; avoid PLC direct `OUT` to an HMI-operated bit. ## Page Switching Methods | Method | Best for | Notes | |---|---|---| | `画面跳转` component | Operator button changes page on HMI. | Can set target screen number, password mode, display control, enable control, and delay. | | System setting `交互 -> 控制画面变换` | PLC controls HMI page. | HMI reads a register; value equals target screen number. After jump, TouchWin clears the register to `0`. | | `交互 -> 报告当前画面号` | PLC knows current HMI page. | HMI writes current screen number to a register, useful for sequence/diagnostics. | | Function key/function area | Multi-action button behavior. | Use when a button needs several HMI actions, but keep PLC writes explicit and documented. | ## PLC-Controlled Screen Switching Recommended allocation: | Address | Direction | Purpose | |---|---|---| | `D100` | PLC -> HMI | Screen command register; value is target page number. | | `D101` | HMI -> PLC | Current screen report register. | | `M100` | HMI/PLC command | Request page change, edge driven. | | `M101` | PLC internal | One-shot or transition lock. | TouchWin steps: 1. Open system settings for the HMI project. 2. Enter the `交互` page. 3. Enable `控制画面变换`. 4. Set the object/register to the chosen PLC register, for example `D100`. 5. Enable `报告当前画面号` and set a different register, for example `D101`. 6. Download and test with offline/online simulation where available. PLC-side rule: - Write the target page number with an edge/event, not every scan. - Expect TouchWin to clear the screen command register to `0` after the jump. - Do not use the same register for command and current-screen report. Example ladder plan: | Network | Logic | |---|---| | Page request | HMI/PLC event sets `M100`. | | One-shot | `M100` rising edge writes `K10` to `D100` for page 10. | | Clear request | Reset `M100` after command or after `D101 = K10`. | | Timeout alarm | If `D101` does not become `K10` within a timeout, set an HMI communication/screen alarm bit. | ## Manual HMI Button Page Jump Use `部件 -> 操作键 -> 画面跳转` or the component toolbar: 1. Place the `画面跳转` component. 2. Set `跳转画面号`. 3. Choose password mode if the page is maintenance/parameter/safety related. 4. Use display/enable control when access depends on mode, alarm, or user permission. 5. Name the button by destination: `主画面`, `参数`, `报警`, `手动`, `维护`. ## Button And Indicator Button Control | Component | Use | Caution | |---|---|---| | `按钮` | Write/toggle/set/reset a bit. | It does not display final bit state by itself. | | `指示灯按钮` | Operate one bit and display a bit state. | Operation object and monitor object can be separated; prefer separating command and status. | | `指示灯` | Display a bit/register state. | Use for actual PLC status, not command request alone. | Important rule from the TouchWin manual: when the HMI operates a lower-device bit, avoid using a direct PLC `OUT` instruction on the same bit. Use a command bit from HMI and a separate PLC-controlled status/output bit. ## Moving Object Animation Use either object X/Y animation or a `平移动画` component. ### Object X/Y movement by register Some objects expose animation settings: - `横向移动`: display X coordinate = original X + register value. - `纵向移动`: display Y coordinate = original Y + register value. Recommended for simple cart/tank/slider motion: | Address | Meaning | |---|---| | `D200` | X offset in pixels or engineering-scaled display units. | | `D201` | Y offset if needed. | | `M200` | Animation enable. | | `M201` | Reset animation position. | PLC pattern: 1. Use a timer pulse to increment/decrement `D200`. 2. Clamp `D200` between minimum and maximum display offsets. 3. Reset `D200` to zero on homing/reset or page entry. 4. Use separate real machine position when animation reflects actual equipment; do not let display animation become the control source. ### `平移动画` Use when the object should follow a drawn path. 1. Place/draw the visible object or image. 2. Add `平移动画`: `部件 -> 动画 -> 平移动画`. 3. Draw the path; double-click to finish. 4. Select the object and animation path, then group them. 5. Configure duration/cycle time. 6. Configure `许可信号`, `复位信号`, and `重复` as needed. ### `旋转动画` Use for fan/motor/agitator-style display: 1. Add `旋转动画`. 2. Add images/materials for the rotation frames. 3. Set cycle time. 4. Use a coil enable so the animation runs only when the corresponding PLC run status is ON. 5. Use reset/visibility control for fault or stopped state. ## Cart Animation Template | PLC/HMI address | Purpose | |---|---| | `M300` | Cart run command. | | `M301` | Cart moving right status. | | `M302` | Cart moving left status. | | `M303` | Cart home sensor status. | | `M304` | Cart fault status. | | `D300` | Cart displayed X offset. | | `D301` | Cart actual position or simulated position. | HMI: - Bind the cart image horizontal animation to `D300`. - Display run/fault status with indicator lights. - Add manual jog buttons writing command bits, not direct output bits. PLC: - If real position is available, scale actual position into `D300`. - If only demonstration animation is needed, increment `D300` while moving and reset at ends. - Add limit checks; never use the HMI animation value as the only safety limit. ## Verification Checklist - Offline simulate screen jump buttons. - Online simulate PLC register-driven page jump if supported. - Confirm command register clears to `0` after page jump. - Confirm current-screen register updates correctly. - Confirm animation enable/reset bits work. - Confirm HMI command bits are not also driven by PLC `OUT`. - Download to HMI, verify PLC communication, then test alarms/permissions.