
functions. The main program starts with the keyword main(), followed by the
opening brackets `{'. The lines of the main program should also contain
comments to clarify the operation of the program. The program is terminated
by a closing bracket `}'.
An example program is shown in Fig. 2.2. This program receives an 8-bit data
from port 1 of an 89C2051 type microcontroller. The state of a switch,
connected to bit 0 of port 3, is then checked. If the switch is 1, the value of
the data is doubled by calling function double_it. If, on the other hand, the state
of the switch is 0, the data value is incremented by 2 by calling function
inc_by2, and then the ...