You are on page 1of 8

The Microchip PIC

‡ Microcontrollers are embedded in many control, monitoring, and processing systems.

‡ Some are general-purpose devices but most microcontrollers are used in specialized
systems such as washing machines, telephones, microwave ovens, automobiles, and
weapons of many kinds.

‡ A microcontroller usually includes a central processor, input and output ports, memory
for program and data storage, an internal clock, and one or more peripheral devices
such as timers, counters, analog-to-digital converters, serial communication facilities,
and watchdog circuits.

‡ More than two dozen companies in the world manufacture and market
microcontrollers.

‡ They range from 8- to 32-bit devices. The most popular ones include several from Intel
(such as the 8051), Zilog (derivatives of their famous Z-80 microprocessor), Motorola
(such as the 68HC05), Atmel (the AVR), Parallax (the BASIC Stamp), and Microchip.

The PICMicro Microcontroller


‡ PIC is a family of microcontrollers made by Microchip Technology.

‡ The original one was the PIC1650 developed by General Instruments.

‡This device was called PIC for ³Programmable Intelligent Computer´ although it is now
associated with ³Programmable Interface Controller.´

‡ PICs use an instruction set that varies in length from about 35 instructions for the low-
end PICs to more than 70 for the high-end devices.

‡ The accumulator, which is known as the work register in PIC documentation, is part of
many instructions since the PIC contains no other internal registers accessible to the
programmer.

‡ The PICs are programmable in their native Assembly Language, which is


straightforward and not difficult to learn. In addition, C language and BASIC compilers
have been developed for the PIC.

‡ One of the reasons for the success of the PIC is the support provided by Microchip.

c  

‡ This includes a professional-quality development environment called MPLAB which
can be downloaded free from the company¶s website ().

‡ The MPLAB package includes an assembler, a linker, a debugger, and a simulator.

‡ The Microchip website furnishes hundreds of free support documents, including data
sheets, application notes, and sample code.

Programming the PIC


‡ Programming a PIC microcontroller requires the following tools and components:

1. An Assembler or high-level language compiler. The software package usually


includes a debugger, simulator, and other support programs.

2. A computer (usually a PC) in which to run the development software.

3. A hardware device called a programmer that connects to the computer through the
serial, parallel, or USB line. The PIC is inserted in the programmer and ³blown´ by
downloading the executable code generated by the development system.

The hardware programmer usually includes the support software.

4. A cable or connector for connecting the programmer to the computer.

5. A PIC microcontroller.

PIC Programmers

‡ The development system (assembler or compiler) and the programmer driver


are the software components.

‡ The computer, programmer, and connectors are the hardware elements.


‡ Figure 7-1 shows a commercial programmer that connects to the USB port of a PC.
The one in the illustration is made by MicroPro.

ë  

åigure 7-1 USB PIC Programmer by MicroPro

Microchip offers several high-end models with In Circuit Serial Programming (ICSP) and
Low Voltage Programming (LVP) capabilities. These devices allow the PIC to be
programmed in the target circuit.

Development Boards

‡ A development board is a demonstration circuit that usually contains an array of


connected and connectable components.
‡ Their main purpose is as a learning and experimental tool.
‡ Most boards target a specific PIC microcontroller or a PIC family of related devices.
‡ Figure 7-2 (in the following page) shows the LAB-X1 development board for the
16F87x PIC family.

Ô  

Prototyping the PIC Circuit
‡ Very few of us are satisfied with writing a PIC program and assuming that it works
correctly.

‡ Testing software is a simple matter if there happens to be a development board at


hand, if the board is compatible with the PIC, and if it provides the hardware that we
need to test.

‡ But often one of these elements is missing and it becomes necessary to build the
circuit for which the program was designed. Here again, there are several options.

‡ These range from having the circuit built for us by a professional engineering firm, to
using a breadboard to prototype the circuit ourselves.

‡ Bread boarding a prototype circuit is one of the options.

‡ A breadboard is a reusable, solder less device that allows building a prototype circuit,
usually for temporary use.

‡ Breadboards have strips down one or both sides that are used as power rails. One
strip carries the circuit¶s positive voltage and the other one is wired to the ground of the
power supply.

‡ Figure 7-3 shows two interconnected breadboards used to test one of the programs
developed.

åigure 7-3 Circuits in Two Interconnected Breadboards

Î  

‡ Once a circuit and the software have been tested, there are several available
technologies for building a more permanent prototype.

‡ These include wire wrap, strip boards, and several other circuit board building tools
and techniques, including prototyping boards specially designed for PIC circuits.

‡ Finally, one can build a semi-professional quality printed circuit board (called a PCB)
and solder the components to it.

‡ A PCB is used to mechanically support the electronic components and provides


conductive pathways, called traces that implement the circuit.

‡ The components are soldered to the PCB board using either surface mount or
through-the-board technology.

‡ Once the board has been populated with electronic components it becomes a printed
circuit assembly, or PCA.

‡ Industrial quality PCB boards are suited to high-volume production. The circuits of the
development board in Figure 7- 2 are on a commercial PCB.

Building one¶s own PCB is quite possible and requires few tools and resources. Figure
7-4, shows a drawing of both sides of a simple PCB board.

åigure 7-4 Drawing for Etching a PCB Board

0  

The PCB in Figure 7-4 is intended for a copper-plated single-sided blank. The left-side
image shows the actual circuit that is etched on the copper side of the board. The text
and diagrams on the right-hand image are engraved (usually by silk screening) on the
back side of the board and serve as a guide for welding the components.

PIC Architecture

‡ PIC controllers are roughly classified by Microchip into three groups: baseline, mid-
range, and high-performance.

‡ Within each of the groups the PICs are classified based on the first two digits of the
PIC¶s family type. However, the sub-classification is not very strict, since there is some
overlap.

‡ For this reason we find PICs with 16X designations that belong to the baseline family
and others that belong to the mid-range group.

‡ In the following subsections we describe the basic characteristics of the various


subgroups of the three major PIC families with 8-bit architectures.

Baseline PIC åamily

‡ This group includes members of the PIC10, PIC12, and PIC16 families. Examples:
10F200, 12C518, 16F506.

‡ The devices in the Baseline group have 12-bit program words and are supplied in 6- to
28-pin packages.

‡ The microcontrollers in the baseline group are described as being suited for battery-
operated applications since they have low power requirements.

‡ The typical member of the Baseline group has a low pin count, flash program memory,
and low power requirements.

u  

Mid-range PIC åamily
‡ The mid-range PIC family includes members of the PIC12 and PIC16 groups.
‡ According to Microchip, the mid-range PICs all have 14-bit program words with either
flash or OTP program memory.
‡ Those with flash program memory have EEPROM data memory and support
interrupts.
‡ Some members of the mid-range group have USB, I2C, LCD, USART, and A/D
converters.
‡ Implementations range from 8 to 64 pins. In the following subsections the basic
characteristics of some mid-range PICs are listed.

PIC16 Devices
‡ This is by far the most extensive PIC family. Currently, over 80 versions of the PIC16
are listed in production by Microchip.
‡ The remainder of this book is devoted to programming two of these PICs: the 16F84
and the 16F877.
‡ Here we listed a few of the most prominent members of the PIC16 family and their
most important features.

-  

High-Performance PIC åamily

‡ The high-performance PICs belong to the PIC18 group.

‡ They have 16-bit program words, flash program memory, a linear memory space of up
to two Mbytes, and protocol-based communications facilities.

‡ They all support internal and external interrupts and have a much larger instruction set
than members of the baseline and mid-range families.

PIC18 Devices

‡ The PIC18 family is also a large one, with over 70 different variations currently in
production.

‡ The PIC18 family uses 16-bit program words and is furnished in 18 to 80 pin
packages.

‡ Microchip describes the PICs in this family as high-performance with integrated A/D
converters.

‡ They have 32-level stacks and support interrupts.

‡ The instruction set is much larger and starts at 79 instructions.

‡ The PICs in this family have flash program memory, a linear memory space of up to 2
Mbytes, 8-by-8 bit hardware multiplier, and communications peripherals and protocols.

½  


You might also like