Programming in C
Once the development environment and hardware are in place, all that remains is programming in C to create the application. After initializing the GPIOs (each pin), peripherals (peripheral circuits), etc. to be used with the created IO map, the flow is to the process describing the application.
The full outline of a program written in C is shown in the figure below.
The embedded program is written in steps (1) through (8), and the application describes the processing contents within the infinite loop while(1) in the main function.
If you want the process inside the infinite loop to be executed cyclically, generate interrupts periodically for processing.
For applications using RTOS, follow steps (1) through (10); it is necessary to include (#include) the header files required for RTOS in advance. The details of the settings have been explained in the previous sections.
The program flow is shown in the block diagram below. Interrupt processing is added to this depending on the application.
Once an application is initially configured, it can be used as a springboard for other applications. Then it is just a matter of programming each project to create the application you want to realize.
Programming application creation
Embedded programming itself can really come into its own in the area of writing applications.
Functions that were configured with analog circuits before the advent of microcontrollers can now be realized with software.
This may sound a bit technical, but a digital system that handles analog signals using a microcontroller can sample signals and perform digital signal processing to create a low-cost, multifunctional, and flexible system compared to a system composed entirely of analog circuits.
If programming for embedded technology is not only in the software field, but also closely related to hardware and incorporating engineering elements, it will broaden the range of skills and allow for more advanced applications to be attempted.