2.4. PIC16 C Sequence Control

• While loops

• Break, continue, goto

• If, else, switch

Conditional branching operations are a basic feature of any program. These must be properly organized so that the program structure is maintained and confusion avoided. The program then is easy to understand and more readily modified and upgraded.

While Loops

The basic while (condition) provides a logical test at the start of a loop, and the statement block is executed only if the condition is true. It may, however, be desirable that the loop block be executed at least once, particularly if the test condition is affected within the loop. This option is provided by the do..while(condition) syntax. The difference between these alternatives is illustrated in Figure ...

Get Programming 8-bit PIC Microcontrollers in C now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.