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.3.1 Mathematical
  • 9.3.2 Data Mover
  • 9.3.3 Process Control
  • 9.3.4 Data Transformation
  • 9.3.5 Strings
  • 9.3.6 Variable
  • 9.3.7 Bit Control
  • 9.3.8 File Operation
  • 9.3.9 Compare
  • 9.3.10 Applied Function
  • 9.3.11 Others

Was this helpful?

  1. 9. Scripts
  2. General script

9.3 Script Functions List

9.3.1 Mathematical

Function

Introduction

Get absolute value

Compute the inverse cosine value

Return the first character of the string in ASCII value

Calculate the arcsine value

Return an arctangent value,the radian ranges -pi/2 to pi/2

Return the arctangent value

Return a cosine value of an angle

Returns the power value of e (natural logarithm)

Calculate the value of the hypotenuse of a right triangle

Implement tan calculation to computing the value

Implement sin calculation to computing the value

Assign a square root value

Assign the value to [val] from address A1 which is signed integer

Assign the value to [val] from address A1 which is signed even integer

9.3.2 Data Mover

Function

Introduction

Copy data with a designated length from source address

Write the same value to designated address constantly

The key values of the keyboard are mapped so that multiple keyboard buttons perform the same function

9.3.3 Process Control

Function

Introduction

Go to the designated row unconditionally in a function body

Execute a command repeatedly for designated times

End the execution of script

If the condition is true, then all the commands before Wend in the statement will be executed and then recheck the condition, if the condition is false, the command after Wend will be executed

9.3.4 Data Transformation

Function

Introduction

Convert string A1 to hexadecimal number

Convert parameter to a float

Convert parameter to a integer

Convert parameter to a string

Convert an array

Convert binary to BCD, save the result as return value

Convert BCD to binary, save the result in return value

Convert integer parameter into correspond ASCII character, return the character string

Convert the 32 bit integer format data to float then output the result

Convert the designated value to floating then assign to variable

Output the 32-bit integer in the form of integer

Convert the angle into correspond radian, and display

Convert a 32 bit floating to integer format, and then output the result

Output a format of floating that in the type of string

Copy floating value to the address

Convert a binary(16 bit) to hexadecimals(4 bit) of ASCII

Write the 32-bit integer into the specified address

Convert all parameters to lowercase strings

Compare the value of A2 and A3, assign the greater number to A1

Compare the value of A2 and A3, assign the smaller number to A1

Convert radiant value to degree

Convert string to floating in the specified format

Exchange the high and low bytes of the parameter

Combine the high byte of the value of two consecutive addresses into a new value

Convert the unsigned Word to unsigned Dword and save the result

Convert a 16bit integer to a 32bit floating, and then save to the next word address

Convert integer word text as S1 format, and then save

9.3.5 Strings

Function

Introduction

A string of length is intercepted from A1 and converted to a single/double word integer, and then this integer is assigned to A2

Return the position of str1 in str2

Return a string of the specified length from the left side of parameter

Return the string length

Remove the left empty part of the string and return

Returns a string contain a specified characters length from a string

Return a string of the specified length from the right side of parameter

Clear the empty part on the right side of string [str], then assign the empty part to val

Return a value of an address without empty string next to it

Capitalize the string data, and then assign the value to val

9.3.6 Variable

Function

Introduction

pi = 3.14159265358979321

True

TRUE = 1

False

FALSE = 0

Operator in scripts edit window

A variable is any factor, trait, or condition that can exist in differing amounts or types

9.3.7 Bit Control

Function

Introduction

Set the bit of A1 as FALSE

The state of inverse bit

Set the bit A1 ON

9.3.8 File Operation

Function

Introduction

Data of Upload/ Download address

Copy the A3 file from the A1 directory to the A2 directory according to the format of A4 and A5

Convert db (database file) file to csv format and export it

9.3.9 Compare

Function

Introduction

IF=

Execute correspond instruction when fulfill condition. Condition will be tested during executing if. it will execute the next instruction block of then, if condition is true. Otherwise, execute the later of else. Complete the two instructions, next execute the later of End if.

IF<>

Execute correspond instruction when fulfill condition. Condition will be tested during executing if. it will execute the next instruction block of then, if condition is true. Otherwise, execute the later of else. Complete the two instructions, next execute the later of End if.

IF>

Execute correspond instruction when fulfill condition. Condition will be tested during executing if. it will execute the next instruction block of then, if condition is true. Otherwise, execute the later of else. Complete the two instructions, next execute the later of End if.

IF>=

Execute correspond instruction when fulfill condition. Condition will be tested during executing if. it will execute the next instruction block of then, if condition is true. Otherwise, execute the later of else. Complete the two instructions, next execute the later of End if.

IF<

Execute correspond instruction when fulfill condition. Condition will be tested during executing if. it will execute the next instruction block of then, if condition is true. Otherwise, execute the later of else. Complete the two instructions, next execute the later of End if.

IF<=

Execute correspond instruction when fulfill condition. Condition will be tested during executing if. it will execute the next instruction block of then, if condition is true. Otherwise, execute the later of else. Complete the two instructions, next execute the later of End if.

IF AND=0

Execute correspond instruction when fulfill condition. Condition will be tested during executing if. it will execute the next instruction block of then, if condition is true. Otherwise, execute the later of else. Complete the two instructions, next execute the later of End if.

IF AND<>0

Execute correspond instruction when fulfill condition. Condition will be tested during executing if. it will execute the next instruction block of then, if condition is true. Otherwise, execute the later of else. Complete the two instructions, next execute the later of End if.

IF=

Execute correspond instruction when fulfill condition. Condition will be tested during executing if. it will execute the next instruction block of then, if condition is true. Otherwise, execute the later of else. Complete the two instructions, next execute the later of End if.

IF<>

Execute correspond instruction when fulfill condition. Condition will be tested during executing if. it will execute the next instruction block of then, if condition is true. Otherwise, execute the later of else. Complete the two instructions, next execute the later of End if.

IF>

Execute correspond instruction when fulfill condition. Condition will be tested during executing if. it will execute the next instruction block of then, if condition is true. Otherwise, execute the later of else. Complete the two instructions, next execute the later of End if.

IF>=

Execute correspond instruction when fulfill condition. Condition will be tested during executing if. it will execute the next instruction block of then, if condition is true. Otherwise, execute the later of else. Complete the two instructions, next execute the later of End if.

IF<

Execute correspond instruction when fulfill condition. Condition will be tested during executing if. it will execute the next instruction block of then, if condition is true. Otherwise, execute the later of else. Complete the two instructions, next execute the later of End if.

IF<=

Execute correspond instruction when fulfill condition. Condition will be tested during executing if. it will execute the next instruction block of then, if condition is true. Otherwise, execute the later of else. Complete the two instructions, next execute the later of End if.

IF AND=0

Execute correspond instruction when fulfill condition. Condition will be tested during executing if. it will execute the next instruction block of then, if condition is true. Otherwise, execute the later of else. Complete the two instructions, next execute the later of End if.

IF AND<>0

Execute correspond instruction when fulfill condition. Condition will be tested during executing if. it will execute the next instruction block of then, if condition is true. Otherwise, execute the later of else. Complete the two instructions, next execute the later of End if.

ELSE

Execute correspond instruction when fulfill condition. Condition will be tested during executing if. it will execute the next instruction block of then, if condition is true. Otherwise, execute the later of else. Complete the two instructions, next execute the later of End if.

ENDIF

Execute correspond instruction when fulfill condition. Condition will be tested during executing if. it will execute the next instruction block of then, if condition is true. Otherwise, execute the later of else. Complete the two instructions, next execute the later of End if.

9.3.10 Applied Function

Function

Introduction

Compare the designated length of two character strings

Enable buzzer

whether a parameter is floating, return TRUE if it is floating, otherwise return FALSE

whether a parameter(A1) is integer, return TRUE if the parameter is integer, otherwise return FALSE

Log function: return the natural logarithm of the value

Log function: return the natural logarithm of the value

Display the current microseconds of system

At the basic of source address A2, offset designated length, obtain a new address A1

At the basic of source address A2, offset the designated length, to obtain a new station A1.

Compare whether the designated length of two strings is the same, return 1 to A1 if yes, otherwise return 0

The value of [expr2] to the power of [expr1] will be assigned to Var

Generate a random number

Assign the value in the specified address to [word]

Wait time T(ms)

Assign the value from A2 to address A1

9.3.11 Others

Function

Introduction

Declare a variable

Condition determent instruction

Differ from internal function, need to declare the name, parameter, code of the function

Declare the name, parameters and codes of the Sub (sub function)

Output the contents to the printer for printing

Write the starting time in the set address as a 32-bit integer

Calculate the number of seconds from January 1, 1970 to the current time

Convert string to hexadecimal number

Previous9.2 Script usageNext9.4 Function Description

Last updated 5 years ago

Was this helpful?

.

Abs
Acos
Asc
Asin
Atan
Atan2
Cos
Exp
Hypot
Tan
Sin
Sqr
SignedInt16
SignedInt32
BMOV
FILL
SetKeyMap
GOTO
FOR
END
while
A2H
Asfloating
AsInteger
AsString
B2W
BCD
BIN
Chr
D2F
D2Float
D2Int
DegToRad
F2D
F2S
Float2D
H2A
Int2D
LCase
MAX
MIN
RadToDeg
S2F
SWAP
W2B
W2D
W2F
W2S
A2I
InStr
LEFT
Len
LTrim
Mid
Right
RTrim
Trim
UCase
Pi
Operator
Variable
ClrB
InvB
SetB
HmiRegOperator
CopyFile
DbToCsvFile
IF... THEN GOTO..
IF
AddrStringCompare
beep
IsFloating
IsInteger
Log
Log10
MSeconds
NewNoAddr
NewStatAddr
NStringCompare
Power
Rand
ReadAddr
SleepA
WriteAddr
Dim...as...
do
Function
Sub
PrintText
PI_GetTickCount
StAndFtChange
GetServerDelayInfo