Part 2 - C Programming Essentials

This chapter discusses programming PIC microcontrollers in C using the simplest possible programs, assuming that the reader has no previous experience of the language. The CCS compiler uses ANSI standard syntax and structures. However, a compiler for any given microcontroller uses its own variations...

Ausführliche Beschreibung

Gespeichert in:
Bibliographische Detailangaben
1. Verfasser: Bates, Martin P
Format: Buchkapitel
Sprache:eng
Schlagworte:
Online-Zugang:Volltext
Tags: Tag hinzufügen
Keine Tags, Fügen Sie den ersten Tag hinzu!
Beschreibung
Zusammenfassung:This chapter discusses programming PIC microcontrollers in C using the simplest possible programs, assuming that the reader has no previous experience of the language. The CCS compiler uses ANSI standard syntax and structures. However, a compiler for any given microcontroller uses its own variations for processor-specific operations, particularly input and output processes. These are fundamental to MCU programs and so will be introduced from the start. Microcontroller programs contain three main features: sequences of instructions; conditional repetition of sequences; and selection of alternative sequences. The program could be tested by downloading to a suitable hardware target system, but it is preferable to debug it first in simulation mode, either in MPLAB or, preferably, in Proteus VSM. In the VSM schematic capture and cosimulation module ISIS, the target PIC is selected from the component library and placed on the schematic. PIC16 C Program Basics includes variables, looping, and decisions. The purpose of an embedded program is to read in data or control inputs, process them, and operate the outputs as required. Input from parallel, serial, and analog ports are held in the file registers for temporary storage and processing; and the results are output later on, as data or a signal. The program for processing the data usually contains repetitive loops and conditional branching, which depends on an input or calculated value.
DOI:10.1016/B978-0-7506-8960-1.00002-X