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
  • 9.2.1 Script Access to Device
  • 9.2.2 Grammar Checking

Was this helpful?

  1. 9. Scripts
  2. General script

9.2 Script usage

Introduction

Script can make project more convenient and flexible. Script is useful in realizing complex HMI function. If the script is used improperly, it may affect the efficiency of entire project. So pay attention to the follow issues:

1) Do not use too much script loops, if the script loops that execute too many times; it might influence the efficiency of HMI.

2) In the cycle scripts, avoid using external register, due to the relatively slow serial communication, frequent access to external registers may cause the execution of scripts severely reduced, even influence the screen respond efficiently. There is fine to use internal register.

3) The maximum script length is 512 rows.

This section describes how to edit scripts and use some of the accompanying tools and features of the script editor.

9.2.1 Script Access to Device

Software script supports an efficiency way to access the device address by using symbol @.

Writing

Meaning

Examples

@B_;@b_;

Access designated bit address

@B_I0.0: access bit address I0.0

@b_HDX0.0: access bit address HDX0.0

@W_;@w_;

Access designated word address

HMI connect more than automatic control devices, "#"stands for choosing number before the symbol,":" stands for accessing the station number before symbol.

Access the first protocol without "#", access default station number1 without":".

@W_IW0: access word address IW0

@b_HDW0:access word address HDW0

@B_(the number of protocol connection)#(station number):address

@B_2#2:I0.0:access the bit address I0.0, with the connection number 2 and station number 2;

@B_I0.0:access to bit address I0.0;

The script can access with the device though: write and read.

For example

If @B_HDX0.0 = 1 then 'read the value from address HDX0.0.

@B_HDX0.0 = 0 'write 0 to address HDX0.0

Else

@B_HDX0.0 = 1 'write 1 to address HDX0.0

Endif

@W_QW0 = @W_QW0 + 1 'read data from address QW0, add 1 to this value then write to address QW0.

9.2.2 Grammar Checking

Operating procedures

2) System does not prompt grammar error if grammar is correct, or system will list all errors;

3) Check error information, and modify errors;

Error information

1) Identifier *** contains invalid characters

2) Attempt to redeclare sub ***

3) Attempt to redeclare function ***

4) Attempt to use reserved word *** as identifier

5) Attempt to use type *** as identifier

6) Unexpected ')' while parsing arguments for function ***

7) Could not parse expression (one of the arguments of function ***)

8) Could not parse arguments of ***

9) Too many arguments for function ***

10) Not enough arguments for function ***

11) '(' expected after sub name ***

12) Unexpected '(' while parsing arguments for sub ***

13) Could not parse expression (one of the arguments of sub ***)

14) Could not parse arguments of ***

15) Too many arguments for sub/function ***

16) Not enough arguments for sub/function ***

17) Could not parse expression

18) '(' expected after function name ***

19) Unexpected use of sub *** as a part of expression

20) Illegal statements preceding subs/functions declaration

21) Unexpected end of file while looking for 'endsub'

22) End of line expected after 'else'.

23) End of line expected after 'endif'.

24) End of line expected after 'next'.

25) End of line expected after 'wend'.

26) 'while', 'until' or end of line expected afte r'do'.

27) Could not parse expression after 'while'

28) Could not parse expression after 'until'

29) 'do' without 'loop'

30) Sub *** contains invalid character'@'

31) Sub *** already declared

32) Function *** already declared

33) Sub name expected after 'sub'

34) Function name expected afte r'function'

35) Variable name expected

36) Argument *** contains invalid character '@'

37) 'integer', 'floating' or 'string' expected

38) ''',' or ')' expected

39) 'endsub' without 'sub'

40) 'end function' without 'function'

41) End of line expected after 'beep'

42) 'dim' unexpected here

43) Variable name expected after 'dim'

44) 'as' expected after variable name

45) 'integer' 'floating' or 'string' expected after 'as'

46) ',' or end of line expected after type in dim statement

47) Could not parse expression after 'while'

48) End of line expected after' while' condition

49) 'while' without 'wend'

50) End of line expected after 'wend'

51) 'wend' without 'while'

52) Variable name expected after' for'

53) '=' expected after variable name

54) Could not parse expression after 'for'

55) 'to' expected

56) Could not parse expression after 'to'

57) Could not parse expression after 'step'

58) End of line expected

59) 'for' without 'next'

60) End of line expected after 'next'

61) 'Next' without 'for'

62) Could not parse expression after'if'

63) 'then' expected

64) Unexpected end of file while looking for 'endif'

65) Unexpected end of file while looking for 'else' or 'endif'

66) 'else' without ‘if'

67) 'end if' without 'if'

68) Label name expected after 'goto'

69) Unexpected end of line while looking for ')' in function call

70) ',' expected

71) Missing ')'

72) Unexpected end of line in expression

73) Unexpected end of file in expression

Previous9.1 Script typeNext9.3 Script Functions List

Last updated 5 years ago

Was this helpful?

1) Select from script tool bar;