PIStudio Manual
Search…
⌃K

9.3 Script Functions List

9.3.1 Mathematical

Function
Introduction
Abs
Get absolute value
Acos
Compute the inverse cosine value
Asc
Return the first character of the string in ASCII value
Asin
Calculate the arcsine value
Atan
Return an arctangent value,the radian ranges -pi/2 to pi/2
Atan2
Return the arctangent value
Cos
Return a cosine value of an angle
Exp
Returns the power value of e (natural logarithm)
Hypot
Calculate the value of the hypotenuse of a right triangle
Tan
Implement tan calculation to computing the value
Sin
Implement sin calculation to computing the value
Sqr
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
BMOV
Copy data with a designated length from source address
FILL
Write the same value to designated address constantly
SetKeyMap
The key values of the keyboard are mapped so that multiple keyboard buttons perform the same function

9.3.3 Process Control

Function
Introduction
GOTO
Go to the designated row unconditionally in a function body
FOR
Execute a command repeatedly for designated times
END
End the execution of script
while
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
A2H
Convert string A1 to hexadecimal number
Convert parameter to a float
AsInteger
Convert parameter to a integer
AsString
Convert parameter to a string
B2W
Convert an array
BCD
Convert binary to BCD, save the result as return value
BIN
Convert BCD to binary, save the result in return value
Chr
Convert integer parameter into correspond ASCII character, return the character string
D2F
Convert the 32 bit integer format data to float then output the result
D2Float
Convert the designated value to floating then assign to variable
D2Int
Output the 32-bit integer in the form of integer
DegToRad
Convert the angle into correspond radian, and display
F2D
Convert a 32 bit floating to integer format, and then output the result
F2S
Output a format of floating that in the type of string
Float2D
Copy floating value to the address
H2A
Convert a binary(16 bit) to hexadecimals(4 bit) of ASCII
Int2D
Write the 32-bit integer into the specified address
LCase
Convert all parameters to lowercase strings
MAX
Compare the value of A2 and A3, assign the greater number to A1
MIN
Compare the value of A2 and A3, assign the smaller number to A1
RadToDeg
Convert radiant value to degree
S2F
Convert string to floating in the specified format
SWAP
Exchange the high and low bytes of the parameter
W2B
Combine the high byte of the value of two consecutive addresses into a new value
W2D
Convert the unsigned Word to unsigned Dword and save the result
W2F
Convert a 16bit integer to a 32bit floating, and then save to the next word address
W2S
Convert integer word text as S1 format, and then save

9.3.5 Strings

Function
Introduction
A2I
A string of length is intercepted from A1 and converted to a single/double word integer, and then this integer is assigned to A2
InStr
Return the position of str1 in str2
LEFT
Return a string of the specified length from the left side of parameter
Len
Return the string length
LTrim
Remove the left empty part of the string and return
Mid
Returns a string contain a specified characters length from a string
Right
Return a string of the specified length from the right side of parameter
RTrim
Clear the empty part on the right side of string [str], then assign the empty part to val
Trim
Return a value of an address without empty string next to it
UCase
Capitalize the string data, and then assign the value to val

9.3.6 Variable

Function
Introduction
Pi
pi = 3.14159265358979321
True
TRUE = 1
False
FALSE = 0
Operator
Operator in scripts edit window
Variable
A variable is any factor, trait, or condition that can exist in differing amounts or types

9.3.7 Bit Control

Function
Introduction
ClrB
Set the bit of A1 as FALSE
InvB
The state of inverse bit
SetB
Set the bit A1 ON

9.3.8 File Operation

Function
Introduction
Data of Upload/ Download address
CopyFile
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
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
beep
Enable buzzer
whether a parameter is floating, return TRUE if it is floating, otherwise return FALSE
IsInteger
whether a parameter(A1) is integer, return TRUE if the parameter is integer, otherwise return FALSE
Log
Log function: return the natural logarithm of the value
Log10
Log function: return the natural logarithm of the value
MSeconds
Display the current microseconds of system
NewNoAddr
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
Power
The value of [expr2] to the power of [expr1] will be assigned to Var
Rand
Generate a random number
ReadAddr
Assign the value in the specified address to [word]
SleepA
Wait time T(ms)
WriteAddr
Assign the value from A2 to address A1

9.3.11 Others

Function
Introduction
Declare a variable
do
Condition determent instruction
Function
Differ from internal function, need to declare the name, parameter, code of the function
Sub
Declare the name, parameters and codes of the Sub (sub function)
PrintText
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