|
STEP 1 - AN OVERVIEW OF EMBEDDED SYSTEMS
MPLAB® IDE is a software program that runs on a PC to develop applications for Microchip microcontrollers. It is called an Integrated Development Environment, or IDE, because it provides a single integrated “environment” to develop code for embedded microcontrollers.
Description of an “Embedded System”
An embedded system is typically a design making use of the power of a microcontroller, like the Microchip PIC® MCU or dsPIC® Digital Signal Controller (DSCs). These microcontrollers combine a microprocessor unit (like the CPU in a desktop PC) with some additional circuits called “peripherals”, plus some additional circuits on the same chip to make a small control module requiring few other external devices. This single device can then be embedded into other electronic and mechanical devices for low-cost digital control.
|

PIC MCU
|
Differences Between an Embedded Controller and a PC:
Embedded Controller
|
PC
|
Dedicated to one specific task
|
Can do many different tasks
|
Has a single program, as a result, can be made inexpensively to include just enough computing power and hardware to perform that dedicated task
|
Runs many different types of programs and can be re-configured to do each task optimally
|
Program is usually permanently “burned” into memory when manufactured
|
Program is loaded into memory when needed –usually from hard drive.
|
Has a low-cost microcontroller unit (MCU) for its intelligence, with many peripheral circuits on the same chip, and with relatively few external devices
|
Has a relatively expensive generalized central processing unit (CPU) at its heart with many other external devices (memory, disk drives, video controllers, network interface circuits, etc.)
|
Often, an embedded system is an invisible part, or sub-module of another product, such as a cordless drill, refrigerator or garage door opener. The controller in these products does a tiny portion of the function of the whole device. The controller adds low-cost intelligence to some of the critical sub-systems in these devices
|
Usually, a large system, often part of a network, employed for word processing, spreadsheet calculations, presentations, internet interface, GUI for various PC-based tools.
|

|
An example of an embedded system is a smoke detector. Its function is to evaluate signals from a sensor and sound an alarm if the signals indicate the presence of smoke. A small program in the smoke detector either runs in an infinite loop, sampling the signal from the smoke sensor, or lies dormant in a low-power “sleep” mode, being awakened by a signal from the sensor. The program then sounds the alarm. The program would possibly have a few other functions, such as a user test function, and a low battery alert. While a PC with a sensor and audio output could be programmed to do the same function, it would not be a cost-effective solution (nor would it run on a nine-volt battery, unattended for years!) Embedded designs use inexpensive microcontrollers to put intelligence into the everyday things in our environment, such as smoke detectors, cameras, cell phones, appliances, automobiles, smart cards and security systems.
|
Components of a Microcontroller
The PIC MCU has program memory for the firmware, or coded instructions, to run a program. It also has “file register” memory for storage of variables that the program will need for computation or temporary storage. It also has a number of peripheral device circuits on the same chip.
Some peripheral devices are called I/O ports. I/O ports are pins on the microcontroller that can be driven high or low to send signals, blink lights, drive speakers – just about anything that can be sent through a wire. Often these pins are bidirectional and can also be configured as inputs allowing the program to respond to an external switch, sensor or to communicate with some external device.

Block Diagram of PIC MCU
In order to design such a system, it must be decided which peripherals are needed for an application. Analog-to-Digital converters allow microcontrollers to connect to sensors and receive changing voltage levels. Serial communication peripherals allow you to stream communications over a few wires to another microcontroller, to a local network or to the internet. Peripherals on the PIC MCU called “timers” accurately measure signal events and generate and capture communications signals, produce precise waveforms, and even automatically reset the microcontroller if it gets “hung” or lost due to a power glitch or hardware malfunction. Other peripherals detect if the external power is dipping below dangerous levels so the microcontroller can store critical information and safely shut down before power is completely lost.
|
|
|
|

Package Dimensions for PIC MCU
The peripherals and the amount of memory an application needs to run a program largely determines which PIC MCU to use. Other factors might include the power consumed by the microcontroller and its “form factor,” i.e., the size and characteristics of the physical package that must reside on the target design.
|