- Name:
-
end
- Syntax:
-
END
- Description:
-
Sleep terminally until the power cycles (program re-runs) or the PC connects for a new download.
Power is reduced to an absolute minimum (assuming no loads are being driven) and internal timers are switched off. The end command places the microcontroller into low power mode after a program has finished. Note that as the compiler always places an end instruction after the last line of a program, this command is rarely required. The end command switches off internal timers, and so commands such as servo and pwmout that require these timers will not function after an end command has been completed.
If you do not wish the end command to be carried out, place a ‘stop’ command at the bottom of the program. The stop command does not enter low power mode. The main use of the end command is to separate the main program loop from sub-procedures as in the example below. This ensures that programs do not accidentally ‘fall into’ the sub-procedure.