T b23 7 e ScreenWorks T (Macro)
T b23 7 e ScreenWorks T (Macro)
Macro Manual
Operation Manual
FOREWORD
Thank you very much for purchasing our ScreenWorks-T.
■ For safety use of this product, read carefully this manual and other related individual instruction
manuals. Furthermore, keep these manuals at an easily accessible place so as to be ready for
reading any time as necessary.
■ Distributor or dealer of this product is kindly requested to hand over this manual to end user
without fail.
■ This product is protected by Japanese copyright laws. It is strictly prohibited to use or copy the
whole or a part of this software without the permission of the manufacturer.
■ The specifications of this software and the topics described in this manual are subject to change
without notice.
Point
The supplementary information about operation, description, and a setup is described.
Point
Note
When using a product, in order that a user may ensure safety, the cautions about handling have described
the required item.
The important information about operation, description, and a setup is described.
Note
i
FOR SAFETY OPERATION
When using ScreenWorks, read the manual included with each product as well as any related
manuals described therein. Observe all safety precautions when using ScreenWorks.
The safety precautions described herein are ranked as "Cautions".
Product Application
・ This product is neither designed nor manufactured for the purpose of being used in devices or
systems in life-threatening situations.
・ Ask our customer service any questions regarding special usage of this product in devices or systems,
including but not limited to the following fields: vehicle, medical equipment, aerospace related,
nuclear related, electric power generation and relays stations of a sub-marine cable.
・Although this product was manufactured under strict quality standards, safety devices must be
installed when it is used in conjunction with other equipment and when a malfunction could lead to
a severe accident and serious damage.
ii
Revision history of instruction manual
The revision code of the instruction manual is described as a part of the control number on the
back cover of the instruction manual.
T - B23 - * - E
N:Japanese , E:English
Series No. Revision code
iii
CONTENTS
・ Introduction
・ Notes for Safe Use
・ Instruction manual revision history
・ Related manuals
C-1
1. Macro Functions: An Overview
This chapter describes an overview of basic instructions and settings of macro programming.
A single macro can contain up to 1024 characters or numbers. A linefeed is counted as two characters.
There is no limit on the number of lines you can have.
Example:
Macro execution
Description
condition
When Loading a Project Executes immediately before opening the project and loading the initial
screen.
When Unloading a Executes immediately before exiting the project.
Project
Fix cycle Executes in specified intervals. The interval range is between 100msec
and 600,000 sec (10 min.) in units of 100msec.
Fix cycle from the Starts executing at a specified time in specified intervals. Specify the hour
specified time and minutes for the time. The interval range is between 1 minute to 1,440
minutes (24 hours), adjustable in units of 1 minute.
Alarm/Event ON Timing Executes when an alarm occurs.
Alarm/Event OFF Timing Executes when an alarm is deactivated.
1-1
Note
The operation of large processes such as displaying or communication can disrupt and lengthen
the intervals of the [Fix cycle] or [Fix cycle from the specified time] options of the execution
condition.
Therefore, perform processes that require short and precise intervals in external devices or other
applications.
Executed
Macro function
Executed
Other task
1-2
Execution conditions for screens
The following are the macro execution conditions available for a screen.
Select an execution condition and create a macro from the [Macro] tab of the [Screen Properties] in the
[Settings] menu.
For details on how to do this, refer to “Registering to a Screen” under “6-1 Registering Macros” in the
ScreenWorks BUILDER manual.
Macro Execution
Description
Condition
When Loading a Screen Executes immediately before opening and displaying the screen.
When Unloading a Screen Executes immediately before closing the screen and switching a page.
Fixed Cycle Executes in specified intervals. The interval range is between 100msec
and 600,000 msec (10 min.), adjustable in units of 100msec.
1-3
The following are the execution conditions available for each functional object.
Before inputting
string/numeral
string/numeral
string/numeral
Before writing
selected
selected
Timing
Functional object
ON/OFF Button − − − − − − −
Word Button − − − − − − −
Command Button − − − − − − −
Bit Lamp − − − − − − − −
Word Lamp − − − − − − − −
Numeral Display&Input − − − − −
String Display&Input − − − − −
Thumbwheel Switch − − − − −
Label − − − − − − − − −
List Selection − − − − − − − −
Level Meter − − − − − − − − −
Broken-line Graph − − − − − − − − −
Bitmap − − − − − − − − −
Analogue Meter − − − − − − − − −
Date − − − − − − − − −
Time − − − − − − − − −
Data Log Display − − − − − − − − −
Data Block Table − − − − −
Data Block Selector − − − − − − − −
Data Block Field − − − − − − −
Data Block Command − − − − − − −
[Alarm/Event Objects]
When pressing When selecting
Functional Object
a display area an Alarm/Event
Alarm/Event Display −
Alarm/Event Summary&History −
The execution timing for each functional object is described below.
1-4
Macro executions for write button type functional objects
• ON/OFF Button
• Word Button
Stops macro and
object write
processes when
macro function
RETURN is
executed with an
argument value
other than zero.
∗1:A local address is any address other than those for shared memory, such as the address for
an external device.
1-5
Macro executions for process button type functional objects
Command Button
Data Block Command
Stops macro and
object write
processes when
macro function
RETURN is
executed with an
argument value
other than zero.
Stops object
processes when
input is cancelled
or when there is
an input error.
1-6
Macro execution timings for numeral/string input type functional objects
• Numeral Display&Input
• String Display&Input
• Data Block Field
• Data Block Table
Executes
Executes the write
macro Executes process Executes
“before “Before when “After
inputting” writing” specifying writing”
macro. macro. shared macro.
memory for
the address.
Turns on the
write Executes
Displays Opens the Checks
Displays communica-ti the write
Click the
password input input range
write on request communi
functional
input dialog keyboard. (for inputting
confirmation flag when ca-tion of
object.
box. numeral)
dialog box specifying a the local
local address.
address for
the address.
1-7
Macro execution timings for value/string monitor type functional objects
• Bit Lamp
• Word Lamp
• Numeral Display&Input (When changing values)
• String Display&Input (When changing values)
• Thumbwheel Switch (When changing values)
Executes
“When
Changing
Value” macro.
Compares
Executes previous values Updates display Executes
communication for each with the read communication
(read). functional value. (read).
object.
Nothing
happens if the
value does not
change.
Point
As for the "When Changing Value" macro, only the screen where the corresponding object is placed
becomes effective.
When executing "When changing Value" macro on the multi-screen which are placed in the sheet
screen, it is likely not to work normally as switching the screen.
In that case, use fixed period macro of project.
1-8
Macro executions for list type functional objects
• List Box
• Alarm/Event Summary&History
• Data Block Selector
Stops object
processes when
input is cancelled
or when there is
an input error.
Executes “When
Pressing a Display
Area” macro.
Displays Executes
Click the
password input processes for
functional object.
dialog box. functional objects.
Stops object
processes when
input is cancelled
or when there is
an input error.
1-9
Macro executions for Thumbwheel Switch functional objects
• Thumbwheel Switch
Stops object
processes when Stops object write
input is cancelled processes when
or when there is “No” is selected.
an input error.
1-10
1.3. Macro Programming
This section describes the statement and syntax of macro programming.
Programming syntax
Program separator
A programming line must end with a semicolon ( ; ). However, the lines for IF ( ), ELSE, ELSEIF ( ) and
ENDIF ( ) do not end with a semicolon. In addition, FOR ( ) and NEXT do not require a semicolon if there
is no other operation on the same line.
Example:
CW0 = 2;
IF(CW0 >= 10 )
CW5 = CW0-CW2;
ELSE
CW5 = CW0+CW2;
ENDIF
Comments
To write a comment in a program, put an apostrophe ( ’ ) at the beginning of the sentence. The comment
starts at the apostrophe and ends at the end of the line.
Example:
CW0 = 100; ’comment
’comment
IF(CW1== 200)
.....
1-11
Programming statements
The following describes the statements used in this function.
Variables
The variable types used in a macro program are shown below.
Item Description
Shared memory CB, CW:
Bit The allotted range depends on the setting of
CB (including the system “Shared memory (Number of points to be
CB) used)” field in the [Initial Setting] tab of the
SB [RUN parameter setting] dialog box
Word ([Settings] − [RUN parameter setting].
CW (including the system SB:SB0 to SB2047
CW) SW:SW0 to SW2047
SW
Example:
CW100 = CW0 + 1; ’The sum of CW0 + 1 is set to CW100
Index variable Modifies the index for bit variables and word variables. By adding this to the end of
an address, it is processed as an address of [the specified address + the value of
the index variable].
There are ten points: I0~I9.
Example:
I0 = 20;
CW0I0 = 123; ’operates as CW20 = 123
1-12
Variable qualifiers
Variable qualifiers are written as shown below.
Qualifiers are used for processing 32 bit data or handling numeric values of bit variables.
Item Description
Long (32-bit) access of a Adds an L after the variable name. This uses two words.
word variable (16-bit)
CW0L = 1000000; ’accesses CW0 and CW1 as 32-bits
CW100L = 1000∗1000;’accesses CW100 and CW101 as 32-bits
Numeral access of bit Adds an ‘:n’ after the variable name. The ‘n’ specifies the number of
variables bits. Up to 32 bits can be specified in increments of 4 bits.
If n = 16, put a W at the end. If n = 32 put an L at the end.
Point
This macro automatically converts the data type of the right side to the data of the left side. If the
data type on the left side is smaller, the data on the right side is automatically cut off.
Example:
CW10L = CW0; ’the value of CW0 is set to CW10 and CW11
CW0 = CW10L; ’the value of CW10 is set to CW0
Constant
The following describes the constants used in a macro program as well as their syntax.
Item Description
Decimal constant When using word data (16-bit) − 32768 to 32767
When using 2 word data (32-bit) − 2147483648 to 2147483647
Hexadecimal When using word data (16-bit) H0 to HFFFF
constant When using word data (32-bit) H0 to HFFFFFFFF
Floating point The range of double
String In double quotations.
Example: “ABCDE”
1-13
Decision structure
The syntax used for conditional programming is shown below.
Item Description
IF IF and ELSEIF are followed by the conditional expression in ( ). The IF statement
ELSEIF must end with ENDIF. The statement can be nested up to eight levels.
ELSE
ENDIF Example:
IF (CW100 == 1) ’if CW100 is equal to 1
CW99 = 1;
ELSEIF (CW100 == 2)’if CW100 is equal to 2
CW99 = 2;
ELSE ’if CW100 is something other than 1 and 2
CW99 = 3;
ENDIF;
Conditional expressions
The conditional expressions used for IF statements are shown below.
Item Description
A == B True when A and B are equal
A>B True when A is greater than B
A >= B True when A is equal to or greater than B
A<B True when A is smaller than B
A <= B True when A is equal to or smaller than B
A <> B, True when A and B are not equal
A != B
A && B True when condition A and condition B are both true (AND)
A AND B
A || B True when condition A or condition B is true (OR)
A OR B
1-14
Program structure
The syntax used for program structure is shown below.
Command Description
RETURN Ends the macro. If a macro does not have the RETURN command, the
program will execute to the end. If a value other than 0 is returned from a
macro that is allocated to a functional object, the following process is
aborted.
Example:
RETURN(0) ;
CW100 = 0; ’This line is not executed
FOR, NEXT Repeats the specified code between FOR and NEXT. The statement can be
nested up to eight levels.
Example:
FOR(5)
CW100 = CW100 + 1;
NEXT; ’Repeats the FOR~NEXT statement five times
Example:
FOR(3)
CW100 = CW100 + 1;
IF (CW100>10 && CB100 == 1)
BREAK;
ENDIF ’The FOR loop ends if CW100>10 and CB100 == 1
NEXT;
FOR, CONTINUE Repeats the program.
Example:
FOR(3)
IF (CW100 == 1)
CONTINUE;
ENDIF
NEXT
’If CW100=1 is true, go back to the beginning of the FOR loop
1-15
Basic operation instruction
The basic operation command used in a macro program are shown below.
Item Symbol Example Definition
Assignment = A=B Assigns the value of B to A.
Addition + C =A+ B Sets the sum and A+B to C.
Subtraction - C =A- B Sets the value of A-B to C.
Multiplication ∗ C =A∗ B Sets the value of A x B to C.
Division / C =A/ B Sets the value of A/B to C.
Remainder % C =A% B Sets the remainder of A and B to C.
Logical-sum | C=A|B Applies the operation OR of A and B to C.
Logical-product & C =A& B Applies the operation AND of A and B to C.
Negation ! C=!A Sets the opposite value of A to C.
Exclusive-OR ^ C = A^ B Applies the exclusive-OR comparison of A and
B to C.
Complement of 1 ~ B=~A Sets the compliment of A to B.
Bitwise Left Shift << C = A << B Shifts the bit of B positions to the left and sets
the value to C.
Bitwise Right Shift >> C = A >> B Shifts the bit of B positions to the right and sets
the value to C.
Multiple operators can be used in any combination.
Example:
A = (B + C)∗(D+E/2)
Point
For the calculation result of division, truncate decimal place.
1-16
Function list
The functions used in a macro program are shown below.
Function Function name
String ←→ numeric String type Numeral type
value Decimal 16-bit length ATOI/ATOIW
conversion String →
32-bit length ATOL /ATOLW
numeric value
Hexadecimal 16-bit length HTOI/HTOIW
32-bit length HTOL/HTOLW
String type Numeral type
Decimal 16-bit length ITOA/ITOAW
Numeric value
32-bit length LTOA/LTOAW
→ string
Hexadecimal 16-bit length ITOH/ITOHW
32-bit length LTOH/LTOHW
BCD ←→ BIN Numeric value (BIN code) → BCD code BCD
conversion BCD code → numeric value (BIN code) BIN
Upper case ←→ lower Upper case → lower case STRLWR/STRLWRW
case conversion Lower case → upper case STRUPR/STRUPRW
Copy all Copies bits BITCPY
Copies words MEMCPY
Set all Sets bits BITSET
Sets words MEMSET
String operations Copies string STRCPY/STRCPYW
Compares string (case sensitive) STRCMP/STRCMPW
Compares string (not case sensitive) STRICMP/STRICMPW
Attaches strings STRCAT/STRCATW
String length STRLEN/STRLENW
Takes specified number of characters from the STRLEFT/STRLEFTW
string starting from the left
Takes specified number of characters from the STRMID/STRMIDW
string starting from the specified position
Takes specified number of characters from the STRRIGHT/STRRIGHTW
string starting from the right
Deletes left spaces STRLTRIM/STRLTRIMW
Deletes left and right spaces STRTRIM/STRTRIMW
Deletes right spaces STRRTRIM/STRRTRIMW
Returns the first character code of the specified ASC/ASCW
string
String operations Converts the string from multi-byte code to STRM2W
unicode
Converts the string from unicode to multi-byte STRW2M
code
Statistic Average AVERAGE
Sum SUM
Sort (ascending) USORT
Sort (descending) DSORT
Maximum value GETMAX
Minimum value GETMIN
Compare values Returns the larger value MAX
Returns the smaller value MIN
1-17
Function Function name
Arithmetic operations Absolute value ABS
Exponentiation POW
Time Obtains the current time (elapsed seconds) TIME
Converts the elapsed seconds to mm/dd/yy LOCALTIME
hh:mm:ss
Converts the mm/dd/yy hh:mm:ss to elapsed MKTIME
seconds
Converts seconds to hh:mm:ss SEC2HMS
Sets the time SETTIME
Data block Loads the data block LOADDB
Saves the data file SAVEDB
Writes to the data block record WRITEDB
Reads the data block record READDB
Selects record in data block SELECTDBREC
Gets record number in data block GETDBREC
Alarm/event Saves the alarm/event history data SAVEALARMLOG
History Clears the alarm/event history data RSTALARMLOG
Restarts the alarm/event count RSTALARMCNT
Macro error log Saves the macro error log SAVEERRORLOG
Restarts the macro error log RSTERRORLOG
Operation log Saves the operation log SAVEOPELOG
Restarts the operation log RSTOPELOG
Data log Stops the data log STOPDATALOG
Starts the data log STARTDATALOG
Saves the data log SAVEDATALOG
Clears the data log RSTDATALOG
HMI exclusive Obtains numeric values to be written, and GETNUMVAL
commands changed values
Switches screen SHOWPAGE
Moves the object display area MOVEPARTS
Displays the message dialog box MSGBOX
Sends the label character code SENDCAPTION
HMI Exclusive Sends the character code SENDKEY
Commands Makes a hard copy of the screen SENDSTR
HMI Exclusive
Obtains the display field of the object HARDCOPY
Commands
Redraws the specified rectangular area GETPARTS
Resizes the outer frame of the object REDRAW
Switches the specified functional object to RESIZEPARTS
input mode
Sets the coordinate origin for the view position SETFOCUS
of the object on the screen
Sends the display command to the specified SETVIEWPOS
functional object
Sends the click event to the specified page SENDCMD
Reverses operation screen CLICKEVEVT
Forwards operation screen PREVPAGE
Moves the pop-up screen NEXTPAGE
Moves the pop-up screen up MOVEPOPW
Moves the pop-up screen down MOVEPOPWUP
1-18
Function Function name
Moves the pop-up screen to the left MOVEPOPWDOWN
Moves the pop-up screen to the right MOVEPOPWLEFT
Closes the pop-up screen MOVEPOPWRIGHT
Finds a screen name CLOSEPOPW
Maximizes the specified screen WINFIND
Minimizes the specified screen WINMAX
Moves the specified screen to the front WINMIN
Exits the specified screen WINTOP
Starts the application WINTERM
Calls the DLL EXEC
Sends the character code DFC
1-19
2. Function Description
This chapter describes how to use the basic functions.
2.1. Function Arguments Table
The following are the variable and value types that can be specified as arguments of a macro function.
The letters used in the argument examples (e.g. S, D, n, x, y) represent the parameters used in the
“Format” section of each function detail.
Shared memory
specification
Constant
specification
External
Floating
Variable
address
INDEX
String
point
Function name
Digit
CB CW
SB SW
ABS S
ASC (W) S
ATOI (W) S
ATOL (W) S
AVERRAGE S
n
BCD S
BIN S
BITCPY D
S
n
BITSET D
c
n
CLICKEVENT n
x
y
CLOSEPOPW n
DFC S1
S2
DSORT D
S
n
EXEC S1
S2
S3
GETDBREC n
GETMAX S
n
2-1
Shared memory
specification
specification
Constant
External
Floating
Variable
address
INDEX
String
point
Digit
Function name CB CW
SB SW
GETMIN S
n
GETNUMVAL - - - - - - - - -
GETPARTS n
Left,
Top,
Right,
Bottom
HARDCOPY S
HTOI(W) S
HTOL(W) S
ITOA(W) D
S
ITOH(W) D
S
LOADDB n
LOCALTIME D
S
LTOA(W) D
S
LTOH D
S
MAX S1
S2
MEMCPY D
S
n
MEMSET D
c
n
MIN S1
S2
MKTIME S
MOVEPARTS n
x
y
2-2
Shared memory
specification
specification
Constant
External
Floating
Variable
address
INDEX
String
point
Digit
Function name CB CW
SB SW
MOVEPOPW n
x
y
MOVEPOPWDOWN n
y
MOVEPOPWLEFT n
x
MOVEPOPWRIGHT n
x
MOVEPOPWUP n
y
MSGBOX S1
S2
S3
NEXTPAGE - - - - - - - - -
POW S1
S2
PREVPAGE - - - - - - - - -
READDB n
REDRAW Left,
Top,
Right,
Bottom
RESIZEPARTS n
Left,
Top,
Right,
Bottom
RSTALARMCNT S
RSTALARMLOG S
RSTDATALOG n
RSTERRORLOG - - - - - - - - -
RSTOPELOG - - - - - - - - -
SAVEALARMLOG S
SAVEDATALOG n
SAVEDB n
SAVEERRORLOG - - - - - - - - -
2-3
Shared memory
specification
specification
Constant
External
Floating
Variable
address
INDEX
String
point
Digit
Function name CB CW
SB SW
SAVEOPELOG - - - - - - - - -
SEC2HMS D
S
SELECTDBREC n1
n2
SENDCAPTION - - - - - - - - -
SENDCMD W
n
S
SENDKEY S
SENDSTR S
SETFOCUS S
SETTIME S
SETVIEWPOS x
y
SHOWPAGE S
STARTDATALOG n
STOPDATALOG n
STRCAT(W) D
S
STRCMP(W) S1, S2
STRICMP(W) S1, S2
STRCPY(W) D
S
STRLEFT(W) D
S
n
STRLEN(W) S
STRLTRIM(W) D
S
STRLWR(W) D
S
STRMID(W) D
S
n1,n2
2-4
Shared memory
specification
specification
Constant
External
Floating
Variable
address
INDEX
String
point
Digit
Function name CB CW
SB SW
STRM2W D
S
STRRIGHT(W) D
S
n
STRRTRIM(W) D
S
STRTRIM(W) D
S
STRUPR(W) D
S
STRW2M D
S
SUM S
n
TIME D
USORT D
S
n
WINFIND S1
S2
WINMAX S1
S2
WINMIN S1
S2
WINTERM S1
S2
WINTOP S1
S2
WRITEDB n
2-5
2.2. Function Details
This section describes the basic function details used in macro programming.
Format ABS(S)
Exampl CW0 = ABS (CW1); ’Sets the absolute value of CW1 to CW0
Decimal string →
ATOI(W)
numeric value (16-bit) conversion
2-6
Decimal string →
ATOL(W)
numeric value (32-bit) conversion
AVERAGE(S, n)
Format
A calculated average
Return Value
2-7
BCD Numeric value → BCD code conversion
Format BCD(S)
BCD code
Return Value
BIN(S)
Format
2-8
BITCPY Block copy (bit)
BITCPY(D, S, n)
Format
n/a
Return Value
BITSET(D, c, n)
Format
n/a
Return Value
CLICKEVENT(n,x,y)
Format
Sends the click event to the coordinates (x, y) of the screen page number
Function
n.
Specifies -1 for the base screen.
CLICKEVENT (-1,20,35);
Example
’Sends the click event to the coordinates of the base screen (20, 35).
2-9
CLOSEPOPW Closes the pop-up screen
CLOSEPOPW (n)
Format
n/a
Return Value
CLOSEPOPW (15);
Example
’Closes the pop-up screen of screen page 15.
DFC(S1,S2 , Arg)
Format
Function Adds an argument to function S2 of DLL name S1, and calls the DLL.
Stores DLL in the folder where ScreenWorks was installed.
(The default location is
C:¥Program Files¥ScreenWorks.)
Format DSORT(D, S, n)
n/a
Return Value
2-10
EXEC Starts an application
Executes the command specified by S1, and displays a screen with the
Function
screen title of S2 and the screen style of S3.
Specify a startup file or startup variable for S1.
(Separate the startup file and startup variable with a space.)
S2 : screen title (if “ ”, the default screen title is displayed)
S3 : 0 = standard 1 = minimized 2 = maximized 3 = hide
Note : when specifying a string variable for S1 or S2, use unicode.
0: normal termination
Return Value
-1: startup error
Format GETDBREC(n)
Function Gets record number which is currently selected in data block No.n.
You can specify any number between 1..100 for n, which is available for
entry.
2-11
GETMAX Calculates maximum valu
Format GETMAX(S,n)
Maximum Value
Return Value
GETMIN(S,n)
Format
Minimum Value
Return Value
GETNUMVAL( )
Format
Obtains numeric values to be written, and changed values for or from the
Function
Numeral Display&Input object.
This is used for macros with the [Before Writing Numeral] , [After Writing
Numeral] and [When Changing Numeral] execution conditions selected for
the Numeral Display & Input object.
If it is used in a “Before Inputting Numeral” macro, a macro program
execution error will occur.
2-12
GETPARTS Obtains the display rectangle of the object
Format GETPARTS(n,Left,Top,Right,Bottom);
Function Obtains the display rectangle of the object with the ID number n. The top
left (Left, Top) and bottom right (Right, Bottom) coordinates of the
rectangle are set.
(Left,Top)
(Right,Bottom)
Format HARDCOPY(S)
Function Prints a hard copy of the current screen with the title S.
2-13
HTOI(W) Hexadecimal String → Numeric value (16-bit) Conversion
2-14
ITOA(W) Numeric value (16-bit) →decimal string conversion
Function Converts the numeric value S (16-bit) to a decimal string, then sets it to D.
The start number of the string is specified for D, and a 0 is added to the
end of the string.
Format LOADDB(n)
2-15
LOCALTIME Converts the elapsed seconds to yyyy/mm/dd/ hh:mm:ss
Format LOCALTIME(D,S)
Function Stores the elapsed number of seconds from the Greenwich mean time
1970/1/1/00:00:00 to D to D+7 in the format of yyyy/mm/dd/ hh:mm:ss
S must be a 32-bit number to obtain correct results.
Do not specify a value exceeding the setting range for the first variable that
stores the results for D.
The following values are set for D:
D:seconds (0 to 59)
D+1: minutes (0 to 59)
D+2: time (0 to 23)
D+3: day (1 to 31)
D+4: month (1 to 12)
D+5: year (1900 to)
D+6: day of the week (0: Sun, 1: Mon, 2: Tue, 3: Wed, 4: Thu, 5: Fri, 6: Sat)
D+7: the elapsed days from January 1st (0 to365)
Function Converts the numeric value S (32-bit) to a decimal string, then sets it to D.
0 is added to the end of the
string.
2-16
LTOH Numeric value (32-bit) →hexadecimal string conversion
Function Converts the numeric value S (32-bit) to a hexadecimal string, then sets it
to D.
0 is added to the end of the string.
Format MEMCPY(D, S, n)
2-17
MEMSET Sets all
Format MEMSET(D, c, n)
2-18
Converts the date and time to the number of elapsed seconds
MKTIME
from the Greenwich mean time 1970/1/1 00:00:00
Format MKTIME(S)
Function Sets the date and time to S to S+5 to return the number of elapsed
seconds from the Greenwich mean time 1970/1/1/00:00:00.
The following values are set for S:
S: seconds (0 to 59)
S+1: minutes (0 to 59)
S+2: time (0 to 23)
S+3: day (1 to 31)
S+4: month (1 to 12)
S+5: year (1900 to)
Return Value Returns the elapsed seconds (32-bit value) from the Greenwich mean time
1970/1/1/00:00:00.
The value between –1 : S to S+5 is incorrect.
Function Moves the object with the ID number n to the specified coordinates (x, y).
Specify the top left coordinates of the object for x and y.
2-19
MOVEPOPW Moves the pop-up screen
Format MOVEPOPW(n,x,y)
Function Moves the top left of the pop-up screen of screen page n to the specified
coordinates (x, y).
Format MOVEPOPWDOWN(n,y)
Function Moves the pop-up screen of screen page n to the left x dot (s).
2-20
MOVEPOPWRIGHT Moves the pop-up screen to the right
Format MOVEPOPWRIGHT(n,x)
Function Moves the pop-up screen of screen page n to the right x dot(s).
Example
2-21
MSGBOX Displays the message dialog box
Format MSGBOX(S1,S2,S3)
Point
When you specify "0: only the [OK] button", "1: [OK] and [Cancel] buttons" or "3: [Yes] and [No]
buttons" as the response buttons, a large message box is displayed.
In this case, the number of characters that can be displayed per line is limited.
For details, refer to "Write (expansion tab" in "3-1 Common Functions of Functional Objects" of
the ScreenWorks-T Reference Manual.
2-22
NEXTPAGE Next screen
Format NEXTPAGE( )
Example ’If the screen display history recorded that you viewed screen page 1 to 10
to 7, and you moved back to the previous page (7 to 10)...
NEXTPAGE ( ); ’goes to screen page 7.
Format PREVPAGE( )
Example ’If the screen display history has screen page number 1 to 3 to 10 to 7
recorded
PREVPAGE ( ); ’returns to screen page 10.
2-23
READDB Reads the data block record
Format READDB(n)
Function Sets the value of the “Read Address” to the record that is currently
selected in data block n.
You can specify a number between 1 and 100 (the allotted number of data
block registries) for n.
Format REDRAW(Left,Top,Right,Bottom)
Function Redraws a rectangular area with the given top left (Left, Top) and bottom
right (Right, Bottom) coordinates.
(Left, Top)
(Right, Bottom)
2-24
RESIZEPARTS Resizes the outer rectangle of the object
Format RESIZEPARTS(n,Left,Top,Right,Bottom)
Function Changes the framed rectangle of the object with the ID number n to a
rectangle with the given top left (Left, Top) and bottom right (Right, Bottom)
coordinates.
(Left, Top)
(Right, Bottom)
Format RSTALARMCNT(S)
Function If the S value is 0, the alarm count is cleared. If the value is 1, the event
count is cleared.
Format RSTALARMLOG(S)
Function If the S value is 0, the alarm history data is cleared. If the value is 1, the
event history data is cleared.
2-25
RSTDATALOG Clears the data log
Format RSTDATALOG(n)
Format RSTERRORLOG()
Example RSTERRORLOG();
Format RSTOPELOG()
Function Clear the data of the operation history (functional object operation log,
screen operation history, macro execution history).
Example RSTOPELOG( );
2-26
SAVEALARMLOG Saves the alarm/event log data
Format SAVEALARMLOG(S)
Function If 0 is specified for S, the data of the alarm log is saved to “Alarm.log ”. If
the value is 1, the data of the event log is saved to “Event.log” .
Each time this function is executed, the original file is overwritten.
Format SAVEDATALOG(n)
Function Saves the data of data log group n to the csv file called Trend#.log
(# stands for the group number).
Each time this function is executed for the same data group, the original
file is overwritten.
Example SAVEDATALOG(1);
’Saves the data of data log group 1 to the file.
Format SAVEDB(n)
Saves all of data of the data block in data block n. Each time this function is
Function
executed for the same data block number, the original file is overwritten.
0: normal termination
Return Value
-1: no block specified
SAVEDB(5);
Example
’Saves all of the data in data block 5 to the file.
2-27
SAVEERRORLOG Saves the macro error log
Format SAVEERRORLOG()
0: normal termination
Return Value
-1: file error
SAVEERRORLOG( );
Example
Format SAVEOPELOG();
0: normal termination
Return Value
-1: file error
SAVEOPELOG( );
Example
Format SEC2HMS(D,S)
n/a
Return Value
SEC2HMS(CW0, 3670);
Example
’Sets the value 10 to CW0, 1 to CW1, and 1 to CW2.
2-28
SELECTDBREC Selects record in data block
Format SELECTDBREC(n1,n2)
Function Selects the record specified with n2 in the data block specified with n1.
You can specify any number between 1..100 for n1, which is available for
entry.
You can specify the CW number where the record number is stored in, or
any number between 0..1023 for n2.
In case that the specified record number doesn’t exist, macro program
error will occur when excuting the macro.
Format SENDCAPTION()
Sends the string, set to the label, to the functional object of the focus
Function
location.
0: normal termination
Return Value
-1: transmission error
SENDCAPTION ( );
Example
2-29
SENDCMD Sends the display command to the specified functional object
Format SENDCMD(W,n,S)
Function Sends the control code, which is specified in S, to the functional object with
the ID number n from the page specified by W. To specify the base screen,
set W to -1.
11: HOME...moves the focus to the data input object at the top left of the
screen
12: F UP......moves the focus to the next data object up
13: F DOWN...moves the focus to the next data object down
14: F LEFT...moves the focus to the next data object to the left.
15: F RIGHT...moves the focus to the next data object to the right
16: F NEXT...moves the focus to the next registered (ascending order)
data input object
17: F PREV...moves the focus to the previous registered
(descending order) data input object
18: S PAGEUP...moves up one page for list selection, combo box,
alarm/event summary & history, data block table, and
data block selector
19: S PAGEDOWN...moves down one page for list selection, combo box,
alarm/event summary & history, data block table, and
data block selector
20: S LINEUP...moves list selection, combo box, alarm/event summary &
history, data block table, and data block selector objects up
one line
21: S LINEDOWN...moves list selection, combo box, alarm/event summary
& history, data block table, and data block selector
objects down one line
22: S RIGHT...right-scrolls the data block object
23: S LEFT...left-scrolls the data block object
0: normal termination
Return Value
-1: transmission error; the specified functional object not supported
SENDCMD(-1, 2, 19);
Example
’Sends a pagedown command to the functional object on base screen [
ID 2.
2-30
SENDKEY Sends a control character code to the focus location
Format SENDKEY(S)
Function Sends the control character code specified in S to the functional object in
the focus location.
Specify the following values for S.
1: LFET...moves the cursor one character to the left
(equivalent to the [BS] key)
2: RIGHT...moves the cursor one character to the right
(equivalent to the [Space] key)
3: CLR...clears the whole input area
4: CAN...cancels the input
5: BS...the backspace (BS) key
6: DEL...the DEL key
7: RET...confirms the input
8: ENT...confirms the input and shifts the focus to the next Input location
9: ±...switches the +, - signs
10:. ...enters decimal points
Format SENDSTR(S)
Function Sends the string specified in S to the functional object of the focus location.
2-31
SETFOCUS Sets the specified functional object to input mode
Format SETFOCUS(S)
Format SETTIME(S)
Function Specifies the time and date for variables S to S+5 to modify the system
clock.
Specify the following values for S1 to S7.
S: seconds (0 to 59)
S+1: minutes (0 to 59)
S+2: hour (0 to 23)
S+3: day (1 to 31)
S+4: month (1 to 12)
S+5: year (1980 to 2038)
2-32
SETVIEWPOS Sets the display point in the screen
Format SETVIEWPOS(x,y)
Function Specifies the coordinates (x, y) of the display point in the screen.
Format SHOWPAGE(S)
Point
When using switch screen macro functions SHOWPAGE and CLOSEPOPW, the screen will switch at the
moment the macro is executed. Therefore, any processes that come after these macros will not be
executed. To avoid this, other processes used in combination with SHOWPAGE and CLOSEPOPW in the
same macro should be placed before SHOWPAGE and CLOSEPOPW
2-33
STARTDATALOG Restarts the data log
Format STARTDATALOG(n)
Format STOPDATALOG(n)
2-34
STRCMP(W),
Compares strings
STRICMP(W)
2-35
STRLEN(W) String length
Function Trims the spaces off the left end of the string S, then copies the string to D.
Function Converts the upper case characters of string S to lower cases, then sets it
to D.
2-36
Takes the specified number of characters starting from the
STRMID(W)
specified character.
Function Copies the specified portion of string S to D. n1 indicates the start position
in string S, and n2 indicates the number of characters to copy. (The start
position, n1, is counted as the first character to copy.)
Format STRM2W(D, S)
Function Gets an n number of characters from the right end of the string, then
copies the string to D.
2-37
STRRTRIM(W) Trims right spaces of string
Function Trims the spaces off the right end of string S, then copies the string to D.
Function Trims the spaces off of both ends of string S, then copies the string to D.
Function Converts the lower case characters of string S to upper case characters,
then sets it to D.
2-38
STRW2M Convert the string from unicode to Multi-byte code
Format STRW2M(D,S)
Format SUM(S, n)
Format TIME(D)
Function Sets the elapsed number of seconds from the Greenwich mean time
1970/1/1/00:00:00 to D.
If a 16-bit variable is specified for D, only the lower 16-bit is set.
2-39
USORT Sort (Ascending)
Format USORT(D, S, n)
Function Sorts a n number of values from S in ascending order and stores them to
D.
2-40
WINMAX Maximizes the specified screen
2-41
WINTERM Exits the specified screen
2-42
WINTOP Brings the specified screen to the front
Format WRITEDB(n)
Function Sets the value of the record currently selected in data block n to the “Write
Address”.
Specify a number between the allotted number of data block registries (1 to
100) for n.
2-43
3. Error Messages
This chapter describes the various error messages of the error check executed when adding a macro
function to a project, screen, or functional object.
3-1
Appendix-1 DLL for DFC Commands
This section describes the definitions for DLL functions used for DFC commands, as well as related
precautions.
Defining functions
DLL functions used for DFC commands must be defined in the following format (for function
samples where the return value is short).
short WINAPI Sample(
void ∗pHandle, // Handle passed to the IPSS function
// (The value for this variable should not be changed in the function.)
_TCHAR ∗szArg) // Argument string for this function when set during a DFC call
//*************************************************************
/// Check parameter (szArg)
//*************************************************************
// Unicode to multi-byte code
#ifdef _UNICODE
WideCharToMultiByte (CP_ACP, 0, (WCHAR*)szArg, -1, cArg, 256, NULL, NULL);
#else
strcpy(cArg, szArg);
#endif
Example
short WINAPI Sample(void *pHandle, _TCHAR *szArg)
...
Same handle
Point
IPSS is a library that provides interface functions with ScreenWorks.
Appendix-1
The content hereof may be subjected to change for improvement
without notice