Omron NB-series Operation Manual page 307

Nb-series programmable terminals
Hide thumbs Also See for NB-series:
Table of Contents

Advertisement

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.
NB-series Programmable Terminals NB-Designer Operation Manual(V106)
3 Functions of NB-Designer
3
3-265

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents