![background image](http://html.mh-extra.com/html/omron/nb10w-tw01b/nb10w-tw01b_operation-manual_743122307.webp)
3-265
3 Functions of NB-Designer
NB-series Programmable Terminals NB-Designer Operation Manual(V106)
3-9 Mac
ro F
unc
tion
3
3-9-1 C
reate a
S
imple Macro Prog
ram
After editing the Macro in the procedure as the above, perform the test again. Then the result as follows
should be out.
Now the basic specification is completed. However, the Macro still have a problem. When entering “0”
into LW1 and executing the Macro, an error occurs and the error can affect the normal operation of the
system. In this case, a check should be entered into the operand.
Change the codes shown as below.
int MacroEntry()
{
//Judge whether LW1 is 0 or not in order to prevent “Divide-by-zero overflow” ;
if (LW1_R!=0)
//LW0 divides LW1and LW2 is obtained
LW2_W = (double)(LW0_R)/LW1_R;
return 0;
}
Execute it again. If the divisor is 0, the Macro will not execute division. Therefore, the program safety
will be improved.
Содержание NB10W-TW01B
Страница 4: ......
Страница 10: ...Terminology 6 NB series Programmable Terminals NB Designer Operation Manual V106 ...
Страница 448: ...3 Functions of NB Designer 3 406 NB series Programmable Terminals NB Designer Operation Manual V106 ...
Страница 450: ...3 Functions of NB Designer 3 408 NB series Programmable Terminals NB Designer Operation Manual V106 ...
Страница 462: ...4 Functions of NBManager 4 10 NB series Programmable Terminals NB Designer Operation Manual V106 ...
Страница 472: ...4 Functions of NBManager 4 20 NB series Programmable Terminals NB Designer Operation Manual V106 ...
Страница 482: ...5 Maintenance and Abnormality Handling 5 10 NB series Programmable Terminals NB Designer Operation Manual V106 ...
Страница 528: ...8 Web Interface 8 10 NB series Programmable Terminals NB Designer Operation Manual V106 ...
Страница 544: ...Appendices A 16 NB series Programmable Terminals NB Designer Operation Manual V106 ...
Страница 546: ...Revision 2 NB series Programmable Terminals NB Designer Operation Manual V106 ...
Страница 547: ......