Appendix 1 Functions for Script

In this section, you can find functions and subroutines to be used in scripts. A subroutine is a command expression that operates a certain action without returning any value, unlike functions that have a return value.

Within an XpanelDesigner script, you can use the functions and subroutines listed in this document. When you use scripts, please beware of the following cautions:

When you use functions with a return value, a variable to store the return value must be declared beforehand.

This manual is based on XpanelDesigner 2. 53 Ver. Software. Note that some features may differ depending on the version of XpanelDesigner.

Function List

The functions are listed in the table as shown below.

Command

Description

 

 

 

 

Trigonometric Function

Function

Acos(number)

Computes the Arc Cosine value.

Function

Asin(number)

Computes the Arc Sine value.

Function

Atan(number)

Computes the Arc Tangent value.

Function

Atan2(number1, number2)

Computes the Arc Tangent value of number1/number2.

Function

Cos(number)

Computes the Cosine value.

Function

Cosh(number)

Computes the Hyperbolic Cosine value.

Function

Sin(number)

Computes the Sine value.

Function

Sinh(number)

Computes the Hyperbolic Sine value.

Function

Tan(number)

Computes the Tangent value.

Function

Tanh (number)

Computes the Hyperbolic Tangent value.

 

 

 

Mathematic Function

Function

Abs(number)

Returns the absolute value.

Function

Ceil(number)

Returns the ceiling of a value.

Function

Floor(number)

Returns the floor of a value.

Function

Fmod(number1, number2)

Returns the floating-point remainder.

Function

Log (number)

Computes the natural logarithm.

Function

Log10(number)

Computes the base-10 logarithm.

Function

Rand()

Generates the pseudorandom number.

Function

Sqrt(number)

Computes the square root.

The special functions listed in the table shown below are categorized, starting from section 1.4.

 

 

 

 

 

 

 

 

 

Special Function

Subroutine

AddMessage(Message ID, Added Message)

Adds a new message to the scroll message window.

Subroutine

AddMessageEx(Message ID, Added Message,Level)

Adds a new message to the scroll message window with a level.

Subroutine

AlarmCsvWr(AlarmGroup, “CSVFileName”, TimeDisplay, PrintOption, Location)

Saves the alarm messages as a CSV file.

Subroutine

AlarmPrint(AlarmGroup, Messages,TimeDisplay, FontSize, PrintOption)

Prints the alarm messages with the printer.

Subroutine

ClearAlarmLog(AlarmGroup)

Deletes the entire alarm log of the assigned alarm group.

Subroutine

ClearDataLog()

Removes all logs from the data logging model.

Subroutine

ClosePort(PortNo)

Closes the serial port.

Subroutine

EnableDriver(“DeviceName”, “StationName”, Enable/Disable)

Controls the selected station’s communication.

Subroutine

ExitXpanel()

Terminated Xpanel runtime.

Subroutine

FrameOpen(“FrameFile”)

Opens the frame file.

Function

GetExplorerPath(PathType)

Returns the recently selected file’s path.

Function

GetCommStatus(“DeviceName”, “StationName”)

Checks the selected station’s communication status.

Function

GetLength(Tag)

Returns the number of characters in a string tag.

Function

GetRcpDnGroup(“Model Name”)

Returns the recipe group name which has downloaded recently.

Function

GetRcpGroupname(“Model Name”, Group Number)

Returns the recipe group name.

Function

GetRcpItemName(“Model Name”, Data item number)

Returns the name of recipe data.

Function

GetScheduleState(Schedule Index)

Obtains the active state of a certain schedule.

Function

GetScheduleSysMem(Schedule Index, Starting Address of SYSTEM MEMORY)

Obtains the time data of a certain schedule.

Function

GetSecurity()

Returns the current security level.(0 – 10)

Function

GetSysMem(System Memory Address)

Returns the system memory value.

Function

GetSysMemString(Target system memory offset, Number of Word)

Converts ASCII code in the system memory into the string value.

Function

GetTime(Value Type)

Returns the current time value.

Subroutine

HardCopy()

Prints out the runtime screen of Xpanel.

Function

IsDirectory(“File or Folder Name”)

Checks if the file or folder exists in the Xpanel.

Subroutine

LcdBacklight(ON/OFF)

Turns on or off the LCD Backlight.

Subroutine

LcdBrightDown()

Dims the LCD light.

Subroutine

LcdBrightUp()

Brightens the LCD light.

Subroutine

LogOff()

Logs out the current user.

Subroutine

LogOn(“UserID”, “Password”)

Logs on with the user information.

Subroutine

LogOnWin()

Brings up the User Log On window.

Subroutine

MakeCsv(“LogModelName”, BlockNumber)

Saves the data block to the SD/MMC memory in CSV file format.

Subroutine

MakeLogCsvEx(Header”, “LogModelName”, BlockNumber, Location)

Saves the data block in CSV file format and stores the header name at cell A1.

Subroutine

MakeCsvUsb(“LogModelName”, BlockNumber)

Saves the data block to the USB storage in CSV file format.

Subroutine

MakeLogCsv(“LogModelName”, BlockNumber, Location)

Saves the data block to the assigned location in CSV file format.

Subroutine

MakeLogCsvEx(“Header”, “LogModelName”, BlockNumber, Location)

Saves the data block in CSV file format and stores the header name at cell A1.

Subroutine

MakeSysMemCsv(“Header”, Starting address of System Memory, number of memories, number of Columns, Location)

Saves the system memories in CSV file format.

Function

NumToStr(TargetValue, Value Type, Format)

Converts the numeric value to the string.

Function

NumToAsc(Decimal value)

Converts a decimal value to an ASCII code value.

Subroutine

OpenConfigSub(Function)

Brings up the Xpanel Config. window or its subfeatures.

Subroutine

OpenConfigWin()

Brings up the Xpanel Config. window.

Function

OpenPort (PortNo, BaudRate, Parity, Databit, Stopbit)

Opens the serial port.

Subroutine

PageOpen(“PageName”)

Opens the page.

Subroutine

PlayWave(WavFileLocation, Path, Sync/Async)

Executes the WAV file in the assigned path.

Subroutine

PrePage()

Moves to the previous page.

Subroutine

PrePageEx()

Moves to the previous base page.

Subroutine

RcpConfig()

Displays the recipe settings window in Xpanel runtime.

Subroutine

RcpCsvRd(“Model Name”, “CSV File Name”, CSV file directory)

Reads recipe model group data (*.csv file) and saves it in the memory.

Subroutine

RcpCsvWr(“Model Name”, “CSV File Name”, CSV file directory)

Saves model group data in the memory as a CSV file format.

Subroutine

RcpDownload(“Model Name”, Group Number)

Downloads model group data to the PLC.

Subroutine

RcpFileRead(“Model Name”, Group Number)

Reads PLC data and saves it to the recipe file.

Subroutine

RcpFileStore(“Model Name”, Group Number)

Saves the model group data in the recipe file.

Subroutine

RcpGetSysMem(“Model Name”, System Memory Address)

Copies one block of system memory to Xpanel memory.

Subroutine

RcpMemDown(“Model Name”)

Downloads the model group data from Xpanel to PLC.

Subroutine

RcpMemUp(“Model Name”)

Receives the data from PLC and saves it at the model group data in Xpanel.

Subroutine

RcpNewGroupName (“Model Name”, Group number, “New group name”)

Changes the recipe group name.

Subroutine

RcpSetSysMem(“Model Name”, System Memory Address)

Copies data in Xpanel memory and pastes it to the system memory.

Subroutine

RcpStop(“Model Name”)

Stops and terminates the Recipe.

Subroutine

RcpUpload(“Model Name”, Group Number)

Reads PLC data and saves it to the recipe file.

Subroutine

ReceiveByte(PortNo, Data)

Receives data with the selected port.

Subroutine

RemoveLastAlarms()

Remove contents except for current alarms from the alarm summary.

Subroutine

RemoveMessage(MessageID)

Removes the scroll message which is added by the AddMessage() function.

Subroutine

ResetTrend(“YT Trend Name”, Pen number)

Resets min/max values of the pen to the default value in the YT trend.

Subroutine

RunApp(“ProgramName”, “ProgramParameter”)

Executes the external program.

Subroutine

ScheduleConfig()

Displays the schedule list dialog box in the Xpanel runtime.

Subroutine

ScrCapture(“SeedName”, Location)

Saves the Xpanel screen in the BMP file.

Function

SendByte(PortNo, Data)

Sends byte data with the selected port.

Function

SendString(PortNo, Data)

Sends string data with the selected port.

Subroutine

SetDate(Year,Month,Date)

Changes the date of Xpanel.

Subroutine

SetScheduleState(Schedule Index, Active State)

Changes the active state of a certain schedule.

Subroutine

SetScheduleSysMem(Schedule Index, Starting Address of SYSTEM MEMORY)

Modifies the schedule directly without using the schedule setting window.

Subroutine

SetSpeed(Acc./Dec.)

Controls the processing time of the script module.

Subroutine

SetSysMem(System Memory Address, Set Value)

Sets the system memory value.

Subroutine

SetSysMemString(Target system memory offset, Source string tag, Number of word)

Converts the string value into ASCII code and stores it in the system memory.

Subroutine

SetTime(Hour, Minute, Second)

Changes the time of Xpanel.

Subroutine

SetTrendRatio(“YT Trend Name”, Pen number, Min value ratio to set, Max value ratio to set)

Changes min/max values ratio of the pen in the YT trend.

Subroutine

SetTrendZoom(“YT Trend Name”, Pen number, Min value to set, Max value to set)

Changes min/max values of the pen in the YT trend.

Subroutine

ShowAudioMixer()

Opens up a volume mixer in Windows touch PC.

Subroutine

ShowTouchKeyboard(X coordinate, Y coordinate, Pin/Unpin)

Opens up a touch keyboard in touch PC above Windows 8.1.

Subroutine

Sleep(Delay)

Delays the script program.

Subroutine

SoftKeyboard(Show/Hide, X Coordinate, Y Coordinate)

Opens or closes the virtual keyboard.

Subroutine

StaticBeepCtrl(ON/OFF)

Controls the Beep output (On/Off)

Function

StringTable(Group Number, String Number)

Gets string data from the string table.

Function

StrToNum(Target String, Numeral System)

Converts the string to the numeric value.

Subroutine

SysMemFill(System Memory Address, Data, Number of data)

Fills the block of system memory with the assigned value.

Subroutine

SysMemMove(Current Address, Target Address, Number of Data)

Moves the data block in the system memory.

Subroutine

TimeStr(Acquired Value, “Format”)

Generates the time-displaying string.

Subroutine

TouchCalib()

Brings up the touch calibration screen.

Subroutine

TrendCsvWr(“TrendName”, Location)

Saves the Trend in CSV format.

Subroutine

TrendGetPenVal(“YT Trend Name”, Pen number, Set value)

Returns set value from the min/max value of the pen in the YT trend.

Subroutine

WindowsExplorer(“Path”, “Extension”, X Coordinate, Y Coordinate)

Brings up the Windows Explorer at the assigned position.

Subroutine

XpanelReset()

Restarts the Xpanel Runtime.