halt( )

Halt Program


Syntax: halt( )
Description: Halts the program.
Parameters: None
Returns: None
Related: wait()


The halt() command will interrupt the program and stop execution at this point in the program. No further commands are run.

The halt() command is a useful tool when debugging a program to determine whether the program is getting to a given point in the program.

Example:

pindir(P1_0,OUT)
out(P1_0, 1)
halt()                         # Program should stop here, the remainder of the program will not be run
wait(500)
out(P1_0, 0)
wait(200)

In this example the program should halt immediately after setting the red LED on. It should be lit when it halts, if the LED is lit it confirms that the program is able to light the red LED, and that the program is able to get to that point in the program.

The halt() command enters a software loop while waiting. It does not use a Timer block nor does it enter a low power mode while it is halted.