Day 2 Walking in Circles

The Plan

It is funny how many stories of expeditions gone wrong culminate with a revealing moment where the explorers realize they got desperately lost and have been walking in circles for a while. In embedded-control programming it’s the opposite: Our programs need a framework, a structure so that the flow of code can be managed, and this usually is built around one main loop.

Today we will review the basics of the loops syntax in C, and we’ll also take the opportunity to introduce a first peripheral module: the 16-bit Timer1. Two new MPLAB© SIM features will be used for the first time: the Animate mode and the Logic Analyzer view.


For this second lesson, we will need the same basic software components ...

Get Programming 32-bit Microcontrollers in C now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.