Macros #M
Single or multiple command sequences can be collected in a so-called macro (*.emc) and stored on internal FLASH. A macro could also contain lots of commands to build up a complete screen - including a command that deletes all old objects (#ODI0). |
Run macros / Start a screen
Run normal macro (Macro Run Normal) |
<Macroname> |
|
Run normal macro conditionally (Macro Run Conditionally) |
(Condition), <MacronameTrue>, <MacronameFalse> |
|
Run normal macro delayed (Macro Run Delayed) |
Delay-No., Time, <Macroname> |
|
Run I/O-Port macro (Macro Run Port) |
Port |
|
Run I/O-Bit macro (Macro Run Bit) |
Portpin, Edge |
|
Run analogue macro (Macro Run Analogue) |
Channel, Type |
|
Run touch macro (Macro Run Touch) |
Obj-ID, Type, Point-No.(0) |
Define macros
Define touch macro (Macro Define Touch) |
Obj-ID, <MacronameDown>, <MacronameUp>; <MacronameDrag> |
|
Define macro process (Macro Process Define) |
Process-No, Time, <Macroname>, StartNumber(no), EndNumber (StartNumber), Type(1) |
|
Define conditional macro process (Macro Process Conditionally) |
Process-No, Time, (Condition), <Macroname>, StartNumber(no), EndNumber (StartNumber), Type(1) |
|
Define automatic macro process (Macro Process Autochange) |
Process-No, Time, (Calculation), <Macroname>, StartNumber(no), EndNumber (StartNumber), Type(1) |
|
Change macro process time (Macro Process Time) |
Process-No, Time |
|
Define action end macro (Macro Define Actionend) |
Obj-ID, <Macroname> |
|
Define I/O/Port macro (Macro Hardware Port) |
Port |
|
Define I/O-Bit macro (Macro Hardware Bit) |
Portpin, Edge, <Macroname> |
|
Define analogue macro (Macro Hardware Analogue) |
Channel, Type, <Macroname> |
|
Define RS232 receive macro (Macro Hardware RS232 master) |
BufferSize, <Macroname> |
|
Define second macro (RTC) (Macro Define Second) |
<Macroname> |
|
Define sound end macro (Macro Hardware Soundend) |
<Macroname> |
|
Define backlight auto-dimming macro (Macro Define Led) |
<Macroname> |
|
Define gesture macro (Macro Define touch Gesture) |
Obj-ID, <MacronameDoubleClick>, <MacronameLongClick> |
|
Define register change macro (Macro Observe Register) |
<Macroname> |
|
Define string register change macro (Macro Observe StringRegister) |
<Macroname> |
|
Define array change macro (Macro Observe Array) |
<Macroname> |
|
Delete macro definition (Macro Clear Defines) |
Mask |
Commands within macros
Skip commands (Macro File Skip) |
(Condition), Commands(1) |
|
Jump (Macro File Jump) |
(Condition), Marker-No(0), Delete(0) |
|
Set jump destination (marker) (Macro File Marker) |
Marker-No(0) |
|
Jump with call (Macro File Call) |
(Condition), Marker-No(0), Delete(0) |
|
Jump to call (Macro File Return) |
(Condition) (true) |
|
Exit macro (Macro File Exit) |
(Condition) (true), <Macroname> |
|
Delete marker (Macro File Delete) |
Marker-No. |
Run macros
Run normal macro / Show a screen
#MRN |
<Macroname> |
This command executes a macro ().
... #MRN <P:macro/macro.emc> ... |
... #MRN "macro"; ... |
Alternatively this command runs a macro that set-up a full screen.
... #MRN <P:macro/screen/Screen1.emc> ... |
... #MRN "screen/Screen1"; ... |
Run normal macro conditionally
#MRC |
(Condition), <MacronameTrue>; <MacronameFalse> |
If the Condition is true, <MacronameTrue> is executed, otherwise <MacronameFalse>.
... #MRC (R0<10),<P:macro/macroTRUE.emc>;<P:macro/macroFALSE.emc> ... |
... #MRC (R0<10),"macroTRUE";"macroFALSE"; ... |
#MRD |
Delay-No., Time, <Macroname> |
The command executes the macro (<MacroName>) with a delay. Up to 10 macros can be started at the same time with a delay (Delay-No. 1 ... 10). The Time is given in 1/100 s. If the command is executed before execution, but without time and macro name, the macro assigned to the Delay-No. will not be started (e.g. #MRD 1) . A re-trigger is also possible. When the command is executed again, the specified delay time starts from the beginning. If time 0 is specified, the macro starts immediately.
... #MRD 1,100,<P:macro/macro.emc> ... |
... #MRD 1,100,"macro"; ... |
or
...
#MRD 1,100,<P:macro/screen/Screen2.emc>
...
#MRP |
Port |
The command executes a port macro (Port 0 ... 15).
#MRB |
Portpin, Edge |
The command executes a bit macro (Portpin 0 ... 127).
Edge |
|
0 |
Falling |
1 |
Rising |
#MRA |
Channel, Type |
The command executes an analog macro (Channel 0 ... 3). The parameterization of the analog input (limits, hysteresis) is set with the command group 'Analog input'.
Type |
|
0 |
Every change |
1 |
Decrement |
2 |
Increment |
3 |
Lower limit 1 |
4 |
Upper limit 1 |
5 |
Lower limit 2 |
6 |
Upper limit 2 |
7 |
Leave window |
8 |
Enter window |
#MRT |
Obj-ID, Type, Point-No.(0) |
The command executes a touch macro (object Obj-ID). PointNo. (0 ... 4) indicates the finger: 0 = first, 1 = second etc. contact point.
Type |
|
1 |
Normal |
2 |
Pushed |
3 |
Drag |
Define macros
#MDT |
Obj-ID, <MacronameDown>; <MacronameUp>; <MacronameDrag> |
The command defines a touch macro. The macro <MacronameDown> is called when the key is pressed, <MacronameUp> when released, <MacronameDrag> when dragging (especially useful for bar-graphs and instruments). With an empty string ("";) the corresponding macro is deleted.
Modules with capacitive touch panels also support multi-finger operation. Up to 5 points are recognized. The first three macro names then apply to the first point, the next three to the second, etc. If no special macro is defined, the macros for the first point are always called.
... #MDT 1,<P:macro/macroDOWN.emc>;<P:macro/macroUP.emc>,<P:macro/macroDRAG.emc> ... |
... #MDT 1,"macroDOWN";"macroUP";"macroDRAG"; ... |
#MPD |
Process-No, Time, <Macroname>; StartNumber(no), EndNumber (StartNumber), Type(1) |
Macro processes define an automatic chronological sequence of macros. The process (Process-No. 1 ... 10) automatically calls the next macro (<Macroname>) in (Time in 1/100 s). Several macros can be called (StartNumber to EndNumber e.g. #MPD 1,100,"MacroProcess";1,50 → MacroProcess1 .. MacroProcess50 are called. The Type specifies the call order:
Type |
|
1 |
Cyclic |
2 |
Cyclic backward |
3 |
PingPong |
4 |
PingPong backward |
5 |
Once |
6 |
Once backward |
... #MPD 1,100,<P:macro/MacroProcess.emc>,1,4 ... |
... #MPD 1,100,"MacroProcess";1,4 ... |
Define conditional macro process
#MPC |
Process-No, Time, (Codition), <Macroname>; StartNumber(no), EndNumber (StartNumber), Type(1) |
Conditional macro processes define an automatic chronological sequence of macros if a condition is fulfilled (true). The process (Process-No. 1 ... 10) automatically calls the next macro (<Macroname>) in (Time in 1/100 s). Several macros can be called (StartNumber to EndNumber e.g. #MPC 1,100,(R1<10),"MacroProcess";1,50 → MacroProcess1 .. MacroProcess50 are called. The type indicates the order of the call:
|
Define automatic macro process
#MPA |
Process-No, Time, (Calculation), <Macroname>, StartNumber(no), EndNumber (StartNumber), Type(1) |
Conditional macro processes define an automatic chronological sequence of macros if the value of the calculation has changed. The process (Process-No. 1 ... 10) automatically calls the next macro (<Macroname>) in (Time in 1/100 s). Several macros can be called (StartNumber to EndNumber e.g.#MPA 1,100,(R1<10),"MacroProcess";1,50 → MacroProcess1 .. MacroProcess50 are called. The type indicates the order of the call:
Type |
|
1 |
Cyclic |
2 |
Cyclic backward |
3 |
PingPong |
4 |
PingPong backward |
5 |
Once |
6 |
Once backward |
... #MPA 1,100,(R1),<P:macro/MacroProcess.emc> ... |
... #MPA 1,100,(R1),"MacroProcess"; ... |
#MPT |
Process-No, Time |
The time (1/100 s) for the macro process (Process-No = 0 all) is changed.
Time |
|
-1 |
Restart with old interval |
0 |
Stop |
>0 |
Reset time |
#MDA |
Obj-ID, <Macroname> |
After an object animation (Obj-ID) has ended, the macro (<Macroname>) is called.
... #MDA 1, ... |
... #MDA 1,"Macro"; ... |
#MHP |
Port |
The port macro is called when the status of the Port (0 ... 15) changes.
... #MHP 0,<P:macro/Macro.emc> ... |
... #MHP 0,"Macro"; ... |
#MHB |
Portpin, Edge, <Macroname> |
The bit macro is called when an Edge is detected at the Portpin (0 ... 127).
Edge |
|
0 |
Falling |
1 |
Rising |
2 |
Both edges |
... #MHB 16,2,<P:macro/Macro.emc> ... |
... #MHB 16,2,"Macro"; ... |
#MHA |
Channel, Type, <Macroname> |
A macro (<Macroname>) is assigned to an A / D input (Channel 0 ... 3). Type:
Type |
|
0 |
Every change |
1 |
Decrement |
2 |
Increment |
3 |
Lower limit 1 |
4 |
Upper limit 1 |
5 |
Lower limit 2 |
6 |
Upper limit 2 |
7 |
Leave window |
8 |
Enter window |
The parametrization of the analogue input (limits, hysteresis) is set with the command group 'Analog input'.
... #MHA 0,0,<P:macro/Macro.emc> ... |
... #MHA 0,0,"Macro"; ... |
#MHR |
BufferSize<Macroname> |
The macro (<Macroname>) is called when the BufferSize (0 = disable) in the master RS232 receive buffer is reached.
... #MHR 42,<P:macro/Macro.emc> ... |
... #MHR 42,"Macro"; ... |
#MDS |
<Macroname> |
The macro (<Macroname>) is called every second.
... #MDS <P:macro/Macro.emc> ... |
... #MDS "Macro"; ... |
Define sound end macro
#MHS |
<Macroname> |
The macro (<Macroname>) is called when the sound string has finished playing. The definition must be made before playing the jingle. The macro is not called for automatically played jingles (e.g. button) (only after #HTN )
... #MHS <P:macro/Macro.emc> ... |
... #MHS "Macro"; ... |
Define backlight auto-dimming macro
#MDL |
<Macroname> |
The automatic dimming function of the backlight calls up the specified macro (<Macroname>) when the state changes. Please see command #XAL for parameter setting concerning time and brightness.
... #MDL <P:macro/Macro.emc> ... |
... #MDL "Macro"; ... |
#MDG |
Obj-ID, <MacronameDoubleClick>; <MacronameLongClick> |
The command defines a gesture macro. The macro <MacronameDoubleClick> is called with a double click, the macro <MacronameLongClick> with a long click
... #MDG 1,<P:macro/MacroDoubleClick>;<P:macro/MacroLongClick> ... |
... #MDG 1,"MacroDoubleClick";"MacroLongClick"; ... |
#MOR |
<Macroname> |
The command defines the Register change macro. The macro <Macroname> is called whenever an observed Register is changed (#VOR). Do not forget to clear status flag (#VDR).
Define string register change macro
#MOS |
<Macroname> |
The command defines the StringRegisterr change macro. The macro <Macroname> is called whenever an observed StringRegister is changed (#VOS). Do not forget to clear status flag (#VDS).
#MOA |
<Macroname> |
The command defines the array change macro. The macro <Macroname> is called whenever an observed array is changed (#VOA). Do not forget to clear status flag (#VDA).
#MCD |
Mask |
The command deletes macro definitions by type:
Mask |
|
0 |
Second macros (RTC) |
2 |
Process macros |
4 |
Port macros |
8 |
Bit macros |
16 |
Analogue macros |
32 |
Touch/Gesture macros |
64 |
Action macros |
128 |
Delayed macros |
256 |
Backlight macro |
512 |
RS232 receive macro |
1024 |
Sound end macro |
The individual types can be added, e.g. Delete all macros: Mask = $ FFFF
Commands within macros
#MFS |
(Condition), Commands(1) |
If the Condition is true, the command skips the defined number of Commands (blank lines and comments are ignored) in the macro.
#MFJ |
(Condition), Marker-No(0), Delete(0) |
If the Condition is true, the command jumps to the marker (Marker-No. 0..99) in the macro. A marker can appear multiple times in a macro. The parameter Delete deletes the last marker found and searches for the next marker with the same ID in the macro.
#MFM |
Marker-No(0) |
The command sets a jump target (Marker-No. 0..99) in the macro.
#MFC |
(Condition), Marker-No(0), Delete(0) |
If the Condition is true, the command jumps to the marker (Marker-No. 0..99) in the macro. A marker can appear multiple times in a macro. A return (#MFR) is mandatory to return to the call. The parameter Delete deletes the last marker found and searches for the next marker with the same ID in the macro.
... #MFC (R1<10),1 #??? /**Command 1 #??? /**Command 2 #MFE #MFM 1 #??? /**Command 3 #MFR ... |
#MFR |
(Condition) (true) |
If the Condition is true, the command jumps to the call.
#MFE |
(Condition) (true), <Macroname> |
If the Condition is true, the macro is exited. Another macro (<Macroname>) can be called optionally.
#MFD |
Marker-No. |
The command deletes the last marker with the Marker-No..
Comparison between C-Code and Macro-Code
if-query one-line |
|
C-Code |
Makro-Code |
if(R1<10) |
#MFS (R1>=10),3 #??? /**Command #MFS (R1<10),1 #??? /**Command |
if-query multi-line |
|
C-Code |
Makro-Code |
if(R1<10) //Command 2 //Command 2 |
#MFJ (R1>=10),1 #??? /**Command 1 #??? /**Command 2 #MFJ (1),2 #MFM 1 #??? /**Command 1 #??? /**Command 2 #MFM 2 |
for-loop |
|
C-Code |
Makro-Code |
for(int i=0;i<10;i++) //Command 2 |
#VRI 0,0 #MFM 1 #??? /**Command 1 #??? /**Command 2 #MFJ (++R0<10),1 |
do-loop |
|
C-Code |
Makro-Code |
do //Command 2 |
#MFM 1 #??? /**Command 1 #??? /**Command 2 #MFJ (R0<10),1 |
Function call |
|
C-Code |
Makro-Code |
... //Command 1 //Command 2 //Function Command 2 |
#MFC 1,1 #??? /**Command 1 #??? /**Command 2 #MFE /**---------------subfunction--------------- #MFM 1 #??? /**Function Command 1 #??? /**Function Command 1 #MFR |