# TouchWin Alarms, Events, Recipes, And Internal Objects

Use this P1 reference for TouchWin alarm display/list, real-time events, historical events, recipe download/upload, CSV import/export, HMI internal objects, and common HMI data cautions.

Source anchors:

- TouchWin manual PDF pages 84-85: `报警显示` for value limit warning.
- TouchWin manual PDF pages 167-172: `报警列表`, trigger coil, message content, CSV import/export format such as `PLC.1.M[0]`.
- TouchWin manual PDF pages 172-179: real-time/historical event display and storage notes.
- TouchWin manual PDF pages 100+ and FAQ pages 304-318: recipe download/upload concept and workflow.
- TouchWin manual PDF pages 197-201: HMI internal `PSB`, `PSW`, `PFW` objects and communication counters/settings.

## Alarm Types

| Feature | Best for | Trigger/source |
|---|---|---|
| `报警显示` | Simple numeric limit warning on one displayed value. | Register value above/below configured limit. |
| `报警列表` | Standard active alarm list. | Bit/coil trigger, default rising-edge behavior. |
| `实时事件显示` | Current event stream and operator messages. | Bit/event trigger. |
| `历史事件显示` | Stored event records with time/confirmation data. | Bit/event trigger plus HMI internal storage. |

## Alarm Display

Use `报警显示` when one value needs a visual warning:

1. Place `报警显示`.
2. Bind it to the value register.
3. Configure upper/lower limit checks.
4. Set display style and flashing behavior.
5. Use a separate alarm bit in PLC if the alarm also affects machine sequence.

Do not rely only on HMI display flashing for machine protection. PLC logic should own interlocks and safe stop behavior.

## Alarm List

Use `报警列表` for a maintenance/operator alarm page.

Recommended PLC allocation:

| Address range | Purpose |
|---|---|
| `M500~M599` | Active alarm bits. |
| `M600~M699` | Alarm acknowledge/reset commands. |
| `D500~D549` | Alarm detail values, if needed. |

TouchWin alarm message setup:

- Each alarm row maps to a trigger coil.
- Message content can include static text, variable text, and numeric display.
- The manual describes CSV import/export; address format examples include `PLC.1.M[0]` where `PLC` is the port, `1` is station, and `M[0]` is the object.

CSV use:

1. Prepare alarm rows in Excel.
2. Save as `.CSV`.
3. Import from the alarm-list message page.
4. Export after editing to keep a project-side backup.

## Real-Time And Historical Events

Use real-time events for operator prompts and historical events for traceability.

Rules:

- Define trigger edge carefully: rising edge and falling edge mean different event semantics.
- Do not overuse historical storage for high-frequency signals.
- For history storage, avoid automatic allocation when several charts/tables/events exist in the same project; manual allocation prevents data overlap.
- Use HMI internal `PSW/PFW` storage intentionally and document the address range.

## Recipes

Recipe concept: a recipe is a group of similar structured parameters stored and transferred together. TouchWin can download recipe data from HMI to PLC registers and upload PLC register values back into the HMI recipe database.

Typical use:

| Item | Example |
|---|---|
| Recipe index | `PSW40` or a user-selected HMI register. |
| PLC target range | `D1000~D1019` process parameters. |
| Download command | HMI recipe download component writes selected recipe to PLC. |
| Upload command | HMI recipe upload component reads current PLC values into HMI recipe storage. |

Workflow:

1. Define the PLC parameter block and units.
2. Reserve a continuous register range for the recipe.
3. Create recipe data in TouchWin.
4. Add `配方下载` for HMI-to-PLC transfer.
5. Add `配方上载` if operators need to save tuned PLC parameters back into recipes.
6. Add a PLC-side validation bit or checksum when bad recipe values could damage product/equipment.
7. Test with offline values first, then online simulation, then controlled machine test.

## HMI Internal Objects

Common internal objects:

| Object | Meaning |
|---|---|
| `PSB` | HMI internal bit object. |
| `PSW` | HMI internal word object. |
| `PFW` | HMI Flash/internal persistent word object. |

Useful examples from the manual:

- `PSB14`: communication shielding flag.
- `PSB15`: communication failure flag.
- `PSB30`: first scan after download.
- `PSB31`: first scan after power-on.
- `PSW1`: current screen number.
- `PSW40`: recipe index.
- `PSW60~PSW73`: communication success/failure/timeout/error counters for ports.
- `PFW20+`: communication-port parameter storage.

Do not casually write internal `PFW` communication settings in a running project. Some settings need power cycle or can affect communication behavior.

## Commissioning Checklist

- Confirm HMI port/protocol/station settings.
- Confirm alarm bit ranges and reset behavior in PLC.
- Confirm alarm CSV import addresses use the correct port and station.
- Confirm recipe register range does not overlap with live control/status registers.
- Confirm HMI write permissions/passwords for recipe pages.
- Confirm invalid recipe values are blocked by PLC range checks.
- Confirm data storage features do not exceed HMI `PFW/PSW` capacity.
