PIStudio Manual
  • 1. Welcome
  • 2. Installation
  • 3. Getting Started
    • 3.1 Creating a project
    • 3.2 Configuring communication
    • 3.3 Configuring the Screens
    • 3.4 Compiling project
    • 3.5 Simulation
    • 3.6 Download project
  • 4. Software Menu
    • 4.1 Home Menu
      • 4.1.1 Project
      • 4.1.2 Edit
      • 4.1.3 Screen
      • 4.1.4 Appearance
      • 4.1.5 Tool
      • 4.1.6 Help
    • 4.2 Project menu
    • 4.3 Project screens menu
  • 5. Project Settings
    • 5.1 Project Settings
    • 5.2 HMI IP
    • 5.3 Installment
    • 5.4 Extend
    • 5.5 Security
  • 6. Object
    • 6.1 Buttons/Switchs
      • 6.1.1 Bit switch
      • 6.1.2 Bit lamp
      • 6.1.3 Word switch
      • 6.1.4 Word lamp
      • 6.1.5 Keypad switch
      • 6.1.6 Function switch
      • 6.1.7 Combination switch
      • 6.1.8 Slider Switch
    • 6.2 Input/Display
      • 6.2.1 Numeric Input/Display
      • 6.2.2 Character Input/Display
    • 6.3 Charts
      • 6.3.1 Common settings in Chart objects
      • 6.3.2 Alarm Record Display
      • 6.3.3 Data Record Display
      • 6.3.4 Recipe display
      • 6.3.5 File list
      • 6.3.6 History Trend Chart
      • 6.3.7 Trend Chart
      • 6.3.8 XY Plot
      • 6.3.9 History XY Plot
    • 6.4 Meters
      • 6.4.1 Pointer Meter
      • 6.4.2 Clock
      • 6.4.3 Bar
      • 6.4.4 Runbar
    • 6.5 Display
      • 6.5.1 Indirect window
      • 6.5.2 QR code
      • 6.5.3 Drop-Down list
      • 6.5.4 Flow component
      • 6.5.5 Picture
      • 6.5.6 Rotation picture
      • 6.5.7 Camera display
      • 6.5.8 Camera Control
      • 6.5.9 Printer
    • 6.6 Draw
      • 6.6.1 Date
      • 6.6.2 Time
      • 6.6.3 Text
      • 6.6.4 Table
      • 6.6.5 Line
      • 6.6.6 Polygon
      • 6.6.7 Cycle/ Ellipse
      • 6.6.8 Arc
      • 6.6.9 Rectangle
      • 6.6.10 Broken line
      • 6.6.11 Linear scale
      • 6.6.12 Arc scale
    • 6.7 Custom Object
    • 6.8 Common Settings
      • 6.8.1 General window
      • 6.8.2 Text
      • 6.8.3 Graphic
      • 6.8.4 Security
      • 6.8.5 Animation
  • 7. Library
    • 7.1 Shape
    • 7.2 Address Library
    • 7.3 Text library
    • 7.4 Font Library
    • 7.5 Address Mapping
  • 8. Basic Functions
    • 8.1 Address Editor
    • 8.2 Installment
    • 8.3 Data Record
    • 8.4 Alarm
      • 8.4.1 Bit alarm
      • 8.4.2 Word alarm
    • 8.5 Recipe
    • 8.6 Trend Chart
    • 8.7 History XY Plot
    • 8.8 User Permission
    • 8.9 MessagePrompt
  • 9. Scripts
    • General script
      • 9.1 Script type
      • 9.2 Script usage
      • 9.3 Script Functions List
      • 9.4 Function Description
    • Lua script
      • 9.5 Lua Editor
      • 9.6 Lua Script Interfaces
      • 9.7 Lua Shortcut Hotkey
  • 10. Advanced Functions
    • 10.1 Remote Access
    • 10.2 Camera
    • 10.3 Email
    • 10.4 Video Player
    • 10.5 Audio Player
    • 10.6 LAN Monitoring
    • 10.7 USB keyboard
  • 11. PLC Protocols
    • 11.1Allen-Bradley FreeTag Ethernet/IP (CompactLogix)
    • 11.2 Allen-Bradley MicroLogix
    • 11.3 Barcode Scanner
    • 11.4 EPSON-TM-T82II/TM-XXX
    • 11.5 Hitachi EHV Series (Ethernet)
    • 11.6 IEC60870-5 104 Client
    • 11.7 LG XGK FEnet Ethernet
    • 11.8 Mitsubishi FX1S, 1N, 2N series
    • 11.9 Mitsubishi FX5U Ethernet
    • 11.10 Mitsubishi FX5U serial port
    • 11.11 Mitsubishi L02 MELSEC (Ethernet)
    • 11.12 Mitsubishi QJ71E71 Ethernet
    • 11.13 MODBUS RTU Master
    • 11.14 MODBUS RTU Slave (All function)/(All function OneBaseAddress)
    • 11.15 MODBUS TCP Slave (All function)
    • 11.16 Omron EC55
    • 11.17 Omron NX Ethernet/IP
    • 11.18 OpenCAN
    • 11.19 SHIMADEN FP23 protocol
    • 11.20 SHIMADEN SR90 protocol
    • 11.21 SHIMADEN Standard protocol
    • 11.22 Siemens S7-200 Smart (Ethernet)
    • 11.23 Siemens S7-300
    • 11.24 Siemens S7-1200 Ethernet
    • 11.25 Siemens Logo
    • 11.26 Siemens S7-XXX Ethernet
    • 11.27 User defined protocol
    • 11.28 WECON PLC LX2V/ LX2E/ LX3V/LX3VP/LX3VE/LX3VM
    • TSPL printer protocol user manual
  • 12. HMI internal registers
    • 12.1 System special address (HUW/HUX)
    • 12.2 System special address (HSW/HSX)
  • 13.Tools
    • 13.1 Off-line
    • 13.2 On-line
    • 13.3 USB flash disk download
    • 13.4 Font Pack
    • 13.5 Address List
    • 13.6 Decompile
    • 13.7 Password Tool
    • 13.8 Download Tool
  • 14. Others
    • 14.1 Setup Menu
    • 14.2 Touch Screen Calibration
    • 14.3 Levi2PI
Powered by GitBook
On this page
  • Initialize
  • Close
  • Timing
  • Trigger bit
  • Background Function

Was this helpful?

  1. 9. Scripts
  2. General script

9.1 Script type

Introduction

Script is applied to realize complex control functions. HMI compile software provide powerful function, simple operation, reliable script system, the features of script are list as follow:

1) Similar to BASIC grammatical structure;

BASIC work as the first computer language for the general public, it is easy and efficient to use.

2) Support all of program logic control structures;

Software script supports three logic control structures: order, condition, loops. It could realize complexity procedures.

3) Powerful function; Functions of script are divided into two types: system and custom function.

  • System function: the functions that system has been predefined for users.

  • Custom function: users could define a function and apply to all scripts.

  1. Support variety of data format;

Script supports integer, floating, BCD code, byte, string and etc.

Scripts have two types of running

1) Background script: Run independently during start project, screen updates have no influence and valid of all scripts.

2) Screen script: Only run under the designated screen. Screen script start running until screen is closed or switched.

And both screen and background have four modes for script

Property

Description

Initialize

The script would be executed once during loading project.

Close

The script would be run once during closing HMI project.

Timing

The script would run under certain conditions after the HMI is started, until the condition ends.

Bit trigger

Script would be repeat executed when meet the condition of bit trigger.

Initialize

Introduction

Initialize script divided into screen initialize script and background initialize script. Screen initialize script runs once during the initialization of screen; background initialize script runs during the loading of project.

Operating procedures

  1. Click [Background script] in project manager to enter script editor screen, or click [Screen script] in right click menu of screen to enter script editor screen;

  1. Double click [initialize] to open script edit window, as below shows;

  1. Enter scripts in edit window;

Close

Introduction

Close script divided into screen close script and background close script. Screen close script runs once During the destroying of screen because of closing or switching; background close script runs during the closind of project (such as restart HMI, into HMI setup).

Operating procedures

  1. Click [Background script] in project manager to enter script editor screen, or click [Screen script] in right click menu of screen to enter script editor screen;

  2. Double click [Close] to open script edit window;

  3. Enter scripts in edit window;

Timing

Introduction

The script would run for a designated time interval.

Operating procedures of creating one

1) Click [Background script] in project manager to enter script editor screen, or click [Screen script] in right click menu of screen to enter script editor screen;

2) Double click [Timing], it would pop-up below setting window;

Property

Description

Cycle

Script runs at designated time interval, unit is 10 ms.

Ok

Script created.

Cancel

Cancel the current script setting.

3) Enter scripts in edit window;

Operating procedures of editing

1) Click [Background script] in project manager to enter script editor screen, or click [Screen script] in right click menu of screen to enter script editor screen;

3) Double click selected [Timing] to open editing window;

Operating procedures of deleting

1) Click [Background script] in project manager to enter script editor screen, or click [Screen script] in right click menu of screen to enter script editor screen;

3) Select [Yes] to execute operation or select [No] to cancel operation;

✎Note:

The maximum number of timing script for each screen or background is 32.

Trigger bit

Introduction

Trigger control script is that software will check whether the designated bit meet trigger condition every 20ms. Script execute once condition is met until project closed.

Operating procedures of creating one

1) Click [Background script] in project manager to enter script editor screen, or click [Screen script] in right click menu of screen to enter script editor screen;

2) Double click [Trigger bit], it pops-up below setting window;

Bit address: It sets trigger address for script;

Condition: detailed information as below shows;

Condition

Description

TRUE

Script execute once the bit value is TRUE, it checks trigger bit every 20 ms;

FALSE

Script execute once the bit value is FALSE, it checks trigger bit every 20 ms;

Bit changed

Execute once the trigger bit switches state;

Rising

Script execute once the bit value from FALSE to TRUE, it checks trigger bit every 20 ms;

Falling

Script execute once the bit value from TURE to FALSE, it checks trigger bit every 20 ms;

3) Set trigger bit and condition, click [OK] to open editing window;

Operating procedures of editing

1) Click [Background script] in project manager to enter script editor screen, or click [Screen script] in right click menu of screen to enter script editor screen;

3) Double click selected [Trigger script] to open editing window;

Operating procedures of deleting

1) Click [Background script] in project manager to enter script editor screen, or click [Screen script] in right click menu of screen to enter script editor screen;

3) Select [Yes] to execute operation or select [No] to cancel operation;

✎Note:

The maximum number of trigger script for each screen or background is 32.

Background Function

Introduction

Global function is a collection of codes; it can be called in any script. The method reference system function;

Operating procedures

1) Double click [Background function] in project manager;

2) Set parameters;

Property

Description

Function name

Function name could not be the same as existing.

Return type

None, string, integer, float.

Parameter 1

The name of parameter 1.

Operating procedures of editing

1) Click [Background function] in project manager to enter script editor screen;

3) Double click selected [Trigger script] to open editing window;

Operating procedures of deleting

1) Click [Background function] in project manager to enter script editor screen;

3) Select [Yes] to execute operation or select [No] to cancel operation;

✎Note:

The maximum parameters for each function are 4, and parameter name can't be unique;

PreviousGeneral scriptNext9.2 Script usage

Last updated 5 years ago

Was this helpful?

2) Select [Timing], and click [] to modify the script execution interval;

2) Select [Timing], and click [] to change interval of script, it pops-up above window

2) Select [Trigger script], and click [] to change trigger bit and condition;

2) Select [Trigger script], and click [] to change interval of script, it pops-up below window

2) Select Function name, and click [] to change parameters;

2) Select Function name, and click [] to change interval of script, it pops-up below window