Перейти до вмісту

Watch program variables on an MC252

Цей контент ще не доступний вашою мовою.

You need the editor, admin, or owner role. Open Setup → Endpoints, open the MC252, select the Programs tab, and select the program. Under the editor, select Variables. HMI reads the program’s state from the device about once a second while the tab is shown, and stops when you switch to another tab, leave the page, or hide the browser window.

The device must run the program: deploy it first (see Deploy programs to an MC252). Otherwise the tab says the device does not run it.

  • The line at the top shows when the device was last read, and the task’s Period and Run time: the shortest, average, and longest time between two runs and of one run, in milliseconds, since the device last loaded its programs. The device counts up to 60 000 ms, and the average follows about the last 128 runs.
  • Variable lists every variable with its value, a whole number. An array shows its size and its values in one line; select it to list each item.
  • Condition lists every condition as True or False.
  • A variable or condition the program has not set yet, or that its last run left unknown, shows unknown, never 0.

Names are the ones in the program source, in upper case, in the order the device numbered them. LASTERROR is the error code of the last failed command in the current run; the device sets it to unknown at the start of each run.

  • Right after a deploy or a reload on the device, items show as Variable 3 or Condition 1 for a moment, with a note that names follow. HMI reads the names from the device after each reload and shows them only for the programs the device runs now, so a name always matches the source the device compiled.
  • The device reports the state of its first five programs in load order, and of their first 250 variables and 1000 conditions. A note counts what it does not report; move a program you debug earlier in the load order, or split it.
  • While the device loads programs, or when it cannot be reached, the tab says so and tries again.
  • If the device’s own Modbus server is turned off, the device cannot report program state. Turn it on in the device’s Modbus settings.