User Manual

MCP Series
Brushed DC Motor Controllers
MCP Series User Manual
187
#ELSIF
#IF expression
..optional code..
#ELSEIF
..more optional code..
#ELSEIF
..even more optional code..
#ELSE
..if nothing else was used, then use this code..
#ENDIF
..rest of program..
Example
Allows multiple snippets of code to be compiled based on multiple tests. ELSEIF is an extension
of #ELSE and allows multiple conditional tests to run during compile time.
screentype con 1
#IF screentype=1
..optional code..
#ELSEIF screentype=2
.. more optional code..
#ELSEIF screentype=3
..even more optional code..
#ENDIF
... rest of program ...
Compiles “optional code”, “more other code”, or “even more optional code” depending on what
the constant “screentype” is set to (1, 2 or 3). If “screentype” has some value other than 1,2 or
3 compilation simply continues with “rest of program” and none of the optional code is compiled.
#ELSEIFDEF, #ELSEIFNDEF
#ELSEIFDEF name
#ELSEIFNDEF name
Example
Equivalents of #ELSEIF for the #IFDEF and #IFNDEF directives. Similar to the example given for
#ELSEIF.