You are on page 1of 3

Chapter 4 Macro Function

Macro editing is a function in which allows the users to perform programming like programming in BASIC
language. It provides the same language syntax as BASIC. It can also reduce the PLC program editing.
Therefore, Macro is a very convenient function for the HMI users to use. After editing Macro, the users can
test the Macro validity via either on-line simulation or off-line simulation on PC before downloading to HMI.
The lines number for each macro is 512 lines and 128 words (max.) for writing comments or strings in a line.
The sub-macro number is 512 sub-macros (number is 1-512). See Fig. 4.1 and Fig. 4.2.

Fig. 4.1
The users can comment each macro by sub-macro
function for the convenience of management,
maintain and operation. The initial name of all sub-
macro is Sub-macro (n) (n is from 1 to 512).

Fig. 4.2
The left-most field in the left window is sub-macro
number. There are 512 sub-macros for editing. The
users can write “CALL n (n is from 1 to 512)” to use
sub-macro.

Revision 05/30/2006, EH00 4-1


Chapter 4 Macro Function|ScrEdit Software User Manual

4.1 Macro Type

Fig. 4.1.1 Choosing Macro command from menu bar

Macro Name Numbers Remark


There is a screen open macro for each screen. Therefore, there are n
Screen open Macro 1
screen open macros for n screen.
There is a screen close macro for each screen. Therefore, there are n
Screen close Macro 1
screen close macros for n screen.
There is a screen cycle macro for each screen. Therefore, there are n
Screen Cycle Macro 1
screen cycle macros for n screen
Initial Macro 1 There is only an initial Macro in a program.
Background Macro 1 There is only an background Macro in a program.
Clock Macro 1 There is only an clock Macro in a program.
On Macro 1 The users can have an ON Macro for each specific button.
Off Macro 1 The users can have an OFF Macro for each specific button.
Sub-macro 512 There are only 512 sub-macros for a program.

Table 4.1.1 Macro command table

„ Screen Open Macro

The users can use open Macro to open each screen. Screen Open Macro will only be executed ONCE
when you open screen (or switch to new screen) and finish execution ONCE. The screen element will
be displayed after finishing executing Screen Open Macro. Therefore, the users need to pay close
attention on designing Screen Open Macro to avoid infinite loop (program cannot be ended) as it may
cause system delay or even cannot execute screen’s elements permanently. It is not recommended to
write too long macro unless necessary. Please pay close attention on loop usage and test Macro with
on-line/off-line simulation before downloading to HMI.

4-2 Revision 05/30/2006, EH00


Chapter 4 Macro Function|ScrEdit Software User Manual

„ Screen Close Macro

The users can use close Macro to close each screen. Screen Close Macro will only be executed ONCE
when you close screen and finish execution ONCE. The Screen Open Macro of new screen will be only
executed after finishing Screen Close Macro. Therefore, the users should also be careful for infinite
loop (program cannot be ended) to avoid unexpected error.

„ Screen Cycle Macro

The users can use cycle Macro to cycle each screen. Screen Cycle Macro will only be executed ONCE
when you change screen and the macro will be executed continuously until the screen is changed,
program or machine is stopped. Therefore, it is not recommended to write too long macro unless
necessary.

„ Initial Macro

There is only one initial Macro in a program or a machine. It is executed in the beginning of program.
The users can preset value to omit step-by-step settings and also control initial setting to avoid
unexpected problem by unknown initial value. If the users need to setup any special setting in PLC
special address, the users can use initial macro to set it. It saves much time with well-designed initial
macro.

„ Background Macro

There is only one initial Macro in a program or a machine. It will be executed continuously like
background. But the execution of Background Macro is to execute one or more commands at a time,
not finish the execution ONCE. If there is other executed Macro, such as cycle macro, it won’t have any
influences. They are executed almost simultaneously (In fact, it is executed one by one physically.
Since the execution time is so quick, it makes people feel that is executed simultaneously). The users
do not need to write loop for continuous execution. Even the users writes END command for Macro it
will still execute Macro again.

„ Clock Macro

There is only an initial Macro in a program or a machine. It will be executed continuously, finish the
execution ONCE and be executed again like cycle macro. Therefore, the same, it is not recommended
to write too long macro unless necessary.

„ On Macro

The users can use ON Macro for each specific button (Bit). It is called ON Macro because this start
Macro is set to ON via setting the button (Bit). This Macro is also executed ONCE and finished
executing ONCE. It will be started again when this button (Bit) is set to be ON again. The ON Macro will
be only started when the button (Bit) is set to be ON and pressed button to be ON.

Revision 05/30/2006, EH00 4-3

You might also like