HomeAwzTechHow to Use MACRO SCRIPT FOR DopSoft Demo Examples

How to Use MACRO SCRIPT FOR DopSoft Demo Examples

What is Macro Script Function?

Delta DOP-B series HMI provides various kinds of macro scripts, and macro commands, including Arithmetic, Logical, Data transfer, Data conversion, Comparison, Flow control, Bit setting, Communication
(COM port) and drawing, etc.

Macro Script Function

There are many advantages of using macro commands, such as:

  1. It can optimize the screen data.
  2. It can reduce the PLC program editing efficiency.
  3. It can overcome the limit on hardware and software design.
    Therefore, Macro is a very convenient function for the HMI user to use. After editing a Macro,
    you can test the Macro validity via

Download DopSoft Software

DELTA HMI DOPSoft Demo examples

Macro Type

There are eleven kinds of macro commands and they are divided into four categories.
Please refer to the following:

  1. On / Off Macro: It is provided for each Bit element that can be input, such as button element, i.e. Maintained and Momentary button.
  2. Before / After Execute Macro: It is provided for all elements, such as the numeric / character entry element and all button elements (including the system button).
  3. Screen Open / Screen Close / Cycle Macro: Use the screen as a unit. Each screen has an individual screen macro.
  4. Initial / Background / Clock / Sub Macro: Use the system as a unit. Each project, i.e. each program has its individual screen macro.

On Macro
The user can use the On Macro for each specific button element (Bit). It is called the On Macro because the Macro is executed once upon the button element (Bit) changing from OFF to ON.
Off Macro
The user can use the Off Macro for each specific button element (Bit). It is called the Off Macro because the Macro is executed once upon the button element (Bit) changing from ON to OFF.
Before Execute Macro
The user can use the Before Execute Macro for all button elements and numeric / character entry elements. One element has one Before Execute Macro.
After Execute Macro
The user can use the After Execute Macro for all button elements and numeric / character entry elements. One element has one After Execute Macro.
Screen Open Macro
The Screen Open Macro will be executed only ONCE when the user opens a screen (or switch to a new screen) and the screen elements will not be displayed until after the Screen Open Macro has
completed execution. Therefore, it is important that the user pay close attention when designing the Screen Open Macro to avoid infinite loops (programs that cannot be ended) as it may cause a
system delay or even prevent the execution of the screenโ€™s elements permanently. Writing long macros is not recommended and should be avoided if at all possible. Pay close attention to using loops and
make sure to test the Macro with online/off-line simulation before downloading to HMI to ensure expected performance and operation.
Screen Close Macro
The Screen Close Macro will be executed only ONCE when the user closes the screen and no other macros will be executed until the Screen Close Macro is completed. Therefore, it is important that the
user pay close attention when designing the Screen Close Macro to avoid infinite loops (programs that cannot be ended) as it may cause a system delay.
Screen Cycle Macro
The macro will be executed continuously when the screen is open. Therefore, writing long macros is not recommended and should be avoided for this type of macro.
Initial Macro
There is only one Initial Macro in a program and it is executed just prior to the startup screen is displayed. This macro is very useful when setting initial values in the HMI or in a PLC.

Background Macro
The purpose of the Background Macro is to execute one or more commands simultaneously since it runs in a separate task. If another Macro is executed, such as the Cycle Macro, it will not have any
influence on the Background Macro although they appear to be executed almost simultaneously. This type of macro does not require to be run in a loop since it will operate continuously.
Clock Macro
The Clock Macro will be executed continuously, finish the executed ONCE, and then will be executed again at the Clock cycle time set in the Standard tab of the Configuration window under Options. This
type of macro is similar to a Cycle Macro therefore, writing long macros is not recommended and should be avoided.
Sub-macro
There are 512 sub-macros for editing that can be used to write repeated actions or functions to save macro editing time. To call a sub-macro simply, use a CALL command from within a macro; an example would be CALL 1 to call the first sub-macro.

On Macro
This macro is attached to a button element. The user can use On Macro for each specific button (Bit). It is called the On Macro because the Macro is executed once upon the button element (Bit) changing from OFF to ON. When the button is set to be ON, ON Macro will be executed ONCE. After execution, this macro will not be executed until the button is set to be ON again. However, On Macro only can be executed when the corresponding Bit for the button is triggered to be ON through the action of pressing
the button, i.e. the Bit is set to be ON and the pressed button is ON also. ON Macro will not be executed if the Bit is set to be ON only. If there is a Momentary button created on the screen and On Macro is used, when the button is pressed, the procedure is as follows:

macro script  2
MACRO SCRIPT

Off Macro
This macro is attached to a button element. The user can use Off Macro for each specific button (Bit). Same as ON Macro, Off Macro is started via setting this button. When the button is set to be OFF, the Off macro will be executed ONCE. After execution, this macro will not be executed until the button is set to be OFF again. However, OFF Macro only can be executed when the corresponding Bit for the button is triggered to be OFF through the action of pressing the button, i.e. the Bit is set to be OFF and the
the pressed button is OFF also. OFF Macro will not be executed if the Bit is set to be OFF only. If there is a Momentary button created on the screen and On Macro is used, when the button is pressed, the procedure is as follows:

macro script  3
MACRO SCRIPT

ALARM FUNCTION MACRO SCRIPT

YOUTUBE:- https://youtu.be/U2WP27Eix8c

ALARM OPEN SCREEN MACRO

$1010 = 50
$1020 = 10

ALARM SCREEN CYCLE  MACRO

$1099 = $1099+1
$1098 = $1099 % 10
If $1098 == 0
If $1097 == 1
$1010 = $1010-5
Else
$1010 = $1010+5
EndIf

If $1020 > 0
$1020 = $1020 -1
EndIF
EndIF

If $1010 >= 80
BITON $1000.1
ElseIF $1010 <= 20
BITON $1000.0
Else
BITOFF $1000.0
BITOFF $1000.1
EndIF
If $1020 == 0
BITON $1000.2
Else
BITOFF $1000.2
EndIF

If $1010 == 100
$1097 = 1
ENDIF
If $1010 == 0
$1097 = 0
ENDIF


MACRO SCRIPT FOR BAR ELEMENT

YOUTUBE :-https://youtu.be/kNRCONuS9Q4

BAR ELEMENT  SCREEN OPEN MACRO

$221 = 50
$222 = 0
$223 = 25
$224 = 90
$225 = 60

$230 = 80

$250 = 0
$251 = 60
$252 = 45
$253 = 75
$255 = 35

$261 = 60
$262 = 15

BAR ELEMENT  SCREEN CYCLE MACRO

$210 = $210+2
If $210 == 100
$210 = 0
EndIF

$220 = $220+1
$219 = $220 % 10
If $219 == 0
$221 = $221+5
$222 = $222+5
$223 = $223+5
$224 = $224+5
$225 = $225+5
EndIF

$219 = $220 %5
If $219 == 0
$240 = $240+10
EndIF

$250 = $250+1
$255 = $255+1
$260 = $260+1

If $221 >= 100
$221 = 0
EndIF

If $222 >= 100
$222 = 0
EndIF

If $223 >= 100
$223 = 0
EndIF

If $224 >= 100
$224 = 0
EndIF

If $225 >= 100
$225 = 0
EndIF

#$231 is $230โ€™s flag
If $230 == 80
$231 = 1
EndIF
If $230 == 40
$231 = 0
EndIF
If $231 == 1
$230 = $230-1
Else
$230 = $230+1
EndIF

If $240 > 100
$240 = 0
EndIF

If $250 > 100
$250 = 0
EndIF
If $255 > 100
$255 = 0
EndIF

If $260 > 100
$260 = 0
EndIF


MACRO SCRIPT FOR COMBOBOX AND LIST BOX DOPSOFT

YOUTUBE:-https://youtu.be/hFjFs_72rnw

OPEN SCREEN MACRO FOR LIST ELEMENTS

FILLASC($2550, โ€œAAAAAโ€)
FILLASC($2554, โ€œBBBBBโ€)
FILLASC($2558, โ€œCCCCCโ€)
FILLASC($2562, โ€œDDDDDโ€)
FILLASC($2566, โ€œEEEEEโ€)
FILLASC($2570, โ€œFFFFFโ€)
FILLASC($2574, โ€œGGGGGโ€)
FILLASC($2578, โ€œHHHHHโ€)
FILLASC($2582, โ€œIIIIIโ€)
FILLASC($2586, โ€œJJJJJโ€)
FILLASC($2590, โ€œKKKKKโ€)
FILLASC($2594, โ€œLLLLLโ€)

SCREEN CYCLE MACRO FOR LIST ELEMENTS

$2501 = $2520*4
$2502 = $2501+2550
BMOV($2521, *$2502, 4)

$2503 = $2530*4
$2504 = $2503+2550
BMOV($2531, *$2504, 4)


MACRO SCRIPT FOR INDICATOR ELEMENT

HOW TO DESIGN INDICATOR ELEMENT DOPSOFT:-https://youtu.be/lPlQSEz5mL0

INDICATOR OPEN SCREEN MACRO SCRIPT

$518 = 0
$516 = 7
$515 = 16
$514 = 33
$513 = 59
$512 = 68
$511 = 84
$517 = 100

$520 = 1

$526 = 6
$525 = 15
$524 = 32
$523 = 58
$522 = 67
$521 = 83

INDICATOR SCREEN CYCLE MACRO SCRIPT

if $510 < 100
$510 = $510 + 1
else
$510 = 0
ENDIF

$540 = $540+1
If $540 == 6
$540 = 0
EndIF


MACRO SCRIPT FOR METER ELEMENT

YOUTUBE :-https://youtu.be/ZWQewL00xII

METER SCREEN OPEN MACRO SCRIPT

$100 = 0
$102 = 0-500
$104 = 1

$120 = 60
$121 = 30
$122 = 70

METER SCREEN OPEN MACRO SCRIPT

$100 = $100+2
if $100 == 100
$100 = 0
endif

$102 = $100*10
$102 = $102 -500


MACRO SCRIPT FOR MOVEMENT FUNCTION DOPSOFT

YOUTUBE :- https://youtu.be/nMj6ok6SvOY

MOVEMENT OPEN SCREEN MACRO

$811 = 230
$812 = 220
$815 = 1

MOVEMENT SCREEN CYCLE  MACRO SCRIPT

IF $802.0 == ON
IF $800 <= 5
$800 = $800 + 1
ELSE
$800 = 0
ENDIF
ENDIF

IF $815 == 1
$810 = $810+1
$811 = $811+5
$812 = $812+1
IF $810 == 6
$810 = 0
ENDIF
IF $811 >= 700
$811 = 230
ENDIF
IF $812 >= 280
$812 = 220
ENDIF
ENDIF

$8815 = NOT $815
$8825 = NOT $825


MACRO SCRIPT FOR PIPE ELEMENT

YOUTUBE:-https://youtu.be/CbJzaWzmYSM

PIPE SCREEN OPEN MACRO SCRIPT

$350 = 3
$310 = 100
$320 = 0
$330 = 0

$340 = 20
$342 = 80
$345 = 1

$370 = 10
$371 = 50
$372 = 80

$381 = 60
$382 = 20
$383 = 80

PIPE SCREEN CYCLE MACRO

$300 = $300+1
$301 = $300 % 10

If $350 == 3
$311 = 2
$312 = 2
$313 = 0
ElseIF $350 == 2
$311 = 2
$312 = 0
$313 = 2
EndIF

If $301 == 0
If $311 == 2
$310 = $310-5
EndIF
If $312 == 2
$320 = $320+5
EndIf
If $313 == 2
$330 = $330+5
EndIf
If $345 == 1
$340 = $340+10
$342 = $342-10
ElseIf $345 == 2
$340 = $340-10
$342 = $342+10
EndIf
EndIF

If $310 == 0
$350 = 0
$311 = 0
$312 = 0
$313 = 0
ENDIF

If $340 == 100
If $345 == 1
$345 = 0
EndIF
EndIf
If $342 == 100
If $345 == 2
$345 = 0
EndIF
EndIf

$380 = $380+1
If $380 == 100
$380 = 0
EndIF


MACRO SCRIPT FOR SAMPLING ELEMENTS

YOUTUBE : https://youtu.be/Cqg84i9zI2s

OPEN SCREEN MACRO FOR SAMPLING ELEMENTS

$1550 = 1551
$1548 = 1552
$1547 = 1561
$1549 = 1

$1551 = 971
$1552 = 134
$1553 = 115
$1554 = 267
$1555 = 327
$1556 = 519
$1557 = 231
$1558 = 598
$1559 = 375
$1560 = 125

$1561 = 126
$1562 = 378
$1563 = 601
$1564 = 232
$1565 = 521
$1566 = 328
$1567 = 27
$1568 = 117
$1569 = 135
$1570 = 984


Also Read:-

Recent Posts

Popular Posts

Wonderware Intouch Cracked

Wonderware IntouchInTouch software leaps onto your screen with breakthrough technology, amazing graphic capabilities, and comprehensive functionality delivered with Wonderwareโ€™s legendary ease of use. Wonderwareโ€™s...

How to Install Intouch License: Download, Types, Features, Working

Intouch LicenseWonderware is a powerful and widely-used software platform that is used by many businesses and organizations to streamline their operations and increase efficiency....

Visual Basic and C-Action Script WinCC: How to Write Script

Action ScriptsActionScript is a programming language used to create interactive and dynamic animations, games, and applications for the web and mobile devices. It is...

Popular Softwares

Wonderware Intouch Cracked

Wonderware IntouchInTouch software leaps onto your screen with breakthrough technology, amazing graphic capabilities, and comprehensive functionality delivered with Wonderwareโ€™s legendary ease of use. Wonderwareโ€™s...

Download RSLogix 500 v12

RSLogix 500 is a programming software developed by Rockwell Automation for programming and configuring Allen-Bradley PLCs (Programmable Logic Controllers). It is part of the...

GX Developer free download

GX Developer with serial keyGX-Developer is a software program used for programming and controlling programmable logic controllers (PLCs) made by Mitsubishi Electric. It is...

FIND MORE