Writing header, configuring I/O pins, using delay function and switch operator
The only purpose of this program is to turn on a few LED diodes on port B. Anyway, use this example to study what a real program looks like. Figure below shows connection schematic, while the program is on the next page. When switching on, every other LED diode on the port B emits light, which indicates that the microcontroller is properly connected and operates normally. This example describes a correctly written header. It’s the same for all the programs described in this book. To skip repetitiveness, it will not be written in the following examples, but is considered to be at the beginning of every program and marked as ‘Header’. To make this example more interesting, we will enable LEDs connected to the port B to blink. There are several ways to do it: