Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Microcontroller Programming. Thi Micro Chip PIC (Julio Sanchez, 2007).pdf
Скачиваний:
476
Добавлен:
12.08.2013
Размер:
4.99 Mб
Скачать

Preface

There are two sides to the computer revolution: one is represented by the PC on your desktop and the second one by the device that remote-controls your TV, monitors and operates your car engine, and allows you to set up your answering machine and your microwave oven. At the core of the PC you find a microprocessor, while at the heart of a self-contained programmable device (also called an embedded system) is a microcontroller.

Microcontrollers are virtually everywhere in our modern society. They are found in automobiles, airplanes, toys, kitchen appliances, computers, TVs and VCRs, phones and answering machines, space telescopes, and practically every electronic digital device that furnishes an independent functionality to its user. In this sense a microcontroller is a self-contained computer system that includes a processor, memory, and some way of communicating with the outside world, all in a single chip that can be smaller than a postage stamp.

A microcontroller (sometimes called an MCU) is actually a computer on a chip.

Essentially it is a control device and its design places emphasis on being self-suffi- cient and inexpensive. The typical microcontroller contains all the components and features necessary to perform its functions, such as a central processor, input/output facilities, timers, RAM memory for storing program data and executable code, and a clock or oscillator that provides a timing beat. In addition, some microcontrollers include a variety of additional modules and circuits. Some common ones are serial and parallel communications, analog-to-digital converters, realtime clocks, and flash memory.

Engineers, inventors, experimenters, students, and device designers in general deal with microcontrollers on an everyday basis. In fact, interest in microcontrollers is not limited to electrical, electronic, and computer engineers. Mechanical and automotive engineers, among many others, often design devices or components that contain microcontrollers. The system that controls the hatch of a ballistic missile silo and the one that operates the doglike toy that barks and rolls on its back, both contain microcontrollers.

The Microchip PIC

Microcontrollers include an enormous array of models and variations of generaland special-purpose devices. Discussing all of them in a single volume would have forced a superficial scope. Even the products of a single manufacturer can have a mind-bog-

XV

XVI

Preface

gling variety, which sometimes include hundreds of different MCU models in a half-dozen families, all with very different applications and features.

For this reason we have focused the book on a single type of microcontroller: the M i c r o c h i p P I C . N o t o n l y a r e t h e P I C t h e m o s t u s e d a n d b e s t k n o w n microcontrollers, they are also the best supported. In fact, PIC system design and programming has become a powerful specialization with a large number of professional and amateur specialists. There are hundreds of WEB sites devoted to PIC-re- lated topics. An entire cottage industry of PIC software and hardware has flourished around this technology.

For practical reasons we have limited the book's scope to 8-bit PICs. In fact, the book concentrates on a particular type of 8-bit PIC known as the mid-range family. We have chosen this approach partly because of space limitations and partly due to the fact that 16and 32-bit microcontrollers (sometimes called external memory microcontrollers) are more related to microprocessor technology than to the topic at hand.

The Book's Design

The book is intended as a resource kit for PIC microcontroller programming. But programming microcontrollers is a different paradigm from microprocessor programming. PIC programming requires a set of skills and a knowledge base quite different from the one needed by a computer programmer. The reason is that the designer/programmer is responsible for the entire system. A typical embedded system has no DOS, Windows, or UNIX software to handle the operational and housekeeping chores. Thus, the PIC programmer provides all the functionality needed by the application with very little assistance from other programs. This makes the microcontroller programmer an application developer, a system's programmer, and an input/output specialist, all at the same time.

For these reasons, the microcontroller programmer must be familiar with a host of computer science topics, including low-level data representations, binary arithmetic, computer organization, input/output programming, concurrency and scheduling, memory management, timing operations, and system functions. At the same time, he or she must be quite conversant with digital electronics and circuit design since the object of the program is a hardware device.

In the first six chapters of the book we have attempted to provide the necessary background both in digital electronics and in computer science. Chapters 7, 8, and 9 are an overview of PIC architecture and programming tools. The remainder of the book deals with programming the various functions, modules, and devices. The appendices contain supplementary materials and expand the coding contained in the text. Readers familiar with electronics and circuit design can skip over Chapters 1, 5, and 6. Those well versed in computer science can do the same with Chapters 2, 3, and 4.

Mapleton, Minnesota

Julio Sanchez

June 28, 2006

Maria P. Canton

Preface

XVII

Additional Material

Additional material is available from the CRC Web site:

www.crcpress.com

Under the menu Electronic Products (located on the left side of the screen), click on Downloads & Updates. A list of books in alphabetical order with Web downloads will appear. Locate this book by a search, or scroll down to it. After clicking on the book title, a brief summary of the book will appear. Go to the bottom of this screen and click on the hyperlinked “Download” that is in a zip file.