0% found this document useful (0 votes)
10 views8 pages

Understanding Microcontrollers and PIC18

Uploaded by

factshub513
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views8 pages

Understanding Microcontrollers and PIC18

Uploaded by

factshub513
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

This chapter begins with a discussion of the role and importance of micro-

controllers in everyday life. In Section 1.1 we also discuss criteria to consider in


choosing a microcontroller, as well as the use of microcontrollers in the embedded
market. Section 1.2 covers various members of the PICl8 family and their fea-
tures. In addition, we provide a brief discussion of alternatives to the PIC chip such
as the 8051, AVR, and 68HCI I microcontrollers.

SECTION 1.1: MICROCONTROLLERS AND EMBEDDED


PROCESSORS

In this section we discuss the need for microcontrollers and contrast them
with general-purpose microprocessors such as the Pentium and other x86 micro-
processors. We also look at the role of microcontrollers in the embedded market.
In addition, we provide some criteria on how to choose a microcontroller.

Microcontroller versus general-purpose microprocessor


What is the difference between a microprocessor and microcontroller? By
microprocessor is meant the general-purpose microprocessors such as Intel's x86
family (8086, 80286, 80386, 80486, and the Pentium) or Motorola's PowerPC
family. These microprocessors contain no RAM, no ROM, and no 1/0 ports on the
chip itself. For this reason, they are commonly referred to as general-purpose
microprocessors. See Figure 1-1.

CPU RAM ROM

1/0 Timer Serial


COM
Port

(a) General-Purpose Microprocessor System (b) Microcontroller


Figure 1-1. Microprocessor System Contruttd With Microcontroller System
A system designer using a general-purpose microprocessor such as the
Pentium or the PowerPC must add RAM, ROM, 1/0 ports, and timers externally
to make them functional. Although the addition of external RAM, ROM, and 1/0
ports makes these systems bulkier and much more expensive, they have the advan-
tage of versatility, enabling the designer to decide on the amount of RAM, ROM,
and I/0 ports needed to fit the task at hand. This is not the case with microcon-
trollers. A microcontroller has a CPU (a microprocessor) in addition to a fixed
amount of RAM, ROM, I/0 ports, and a timer all on a single chip. In other words,
the processor, RAM, ROM, I/0 ports, and timer are all embedded together on one
chip; therefore, 1he designer cannot add any external memory, 1/0, or timer to it.
The fixed amount of on-chip ROM, RAM, and number of VO ports in microcon-
trollers makes them ideal for many applications in which cost and space are criti-
cal. In many applications, for example a TV remote control, there is no need for

24
Home the computing power of a 486 or even an 8086 microprocessor. In
~A"'pp"'1;"".,-eo-,- - - - I many applications, the space used, the power consumed, and the
Intercom price per unit are much more critical considerations than the com-
Telephones puling power. These applications most often require some I/O
Security systems operations to read signals and tum on and off certain bits. For this
Garage door openers reason some call these processors IBP, "itty-bitty processors."
Answering machines (See "Good Things in Small Packages Are Generating Big
Fax machines Product Opportunities" by Rick Grehan, BYTE magazine,
~~;e computm September 1994 ([Link] for an excellent discus-
Cable TV tuner sion ofmicrocontrollers.)
VCR It is interesting to note that some microcontroller manu-
Camcorder facturers have gone as far as integrating an AOC (analog-to-digi-
Remote controls tat converter) and other peripherals into the microcontroller.

Microcontrollers for embedded systems


Musical instruments In the literature discussing microprocessors, we often see
Sewing machines the term embedded system. Microprocessors and microcontrollers
~!!~!i;g control are widely used in embedded system products. An embedded
Camera product is controlled by its own internal microprocessor (or
Pinball machines microcontroller) as opposed to an external controller. Typically, in
Toys an embedded system, the microcontroller's ROM is burned with
Exercise equipment a purpose for specific functions needed for the system. A printer
Office is an example of an embedded system because the processor
1;11"',,p"'h•-•-.,----I
1"' inside it perfonns one task only; namely, getting the data and
Computers printing it. Contrast this with a Pentium-based PC (or any x86
Security systems IBM-compatible PC), which can be used for any number of appli-
Fax machine cations such as word processor, print-server, bank teller tenninal,
Microwave video game player, network server, or Internet tenninal. A PC can
~=~;~rioter also load and run software for a variety of applications. Of course,
Color printer the reason a PC can perform myriad tasks is that it has RAM
Paging memory and an operating system that loads the application soft-
Auto ware into RAM and lets the CPU run it. In an embedded system,
Trip computer typically only one application software is burned into ROM. An
Engine control x86 PC contains or is connected to various embedded products
Air bag such as the keyboard, printer, modem, disk controller, sound card,
ABS CD-ROM driver, mouse, and so on. Each one of these peripherals
Instrumentation has a microcontroller inside it that performs only one task. For
Security system example, inside every mouse a microcontroller perfonns the task
Transmission control of finding the mouse's position and sending it to the PC. Table 1-1
Entertainment lists some embedded products.
Climate control
Cellular phone x86 PC embedded applications
Keyless entry
Although microcontrollers are the preferred choice for
Table 1-1: Some many embedded systems, sometimes a microcontroller is inade-
Embedded Products quate for the task. For this reason, in recent years many manufac-
Usinz Microcontrollen turers of general-purpose microprocessors such as Intel, Freescale
Semiconductor (fonnerly Motorola), and AMD (Advanced Micro

CHAPTER I: THE PIC MICROCONTROLLERS: HISTORY AND FEATURES 25


8051 VARIANTS FROM INTIL
mi
l liii(-----..,,t;..,
,_

I/IH IIWI)
.. ••

121
· 8052
:,
· 256, ,, •
QK
128

-
8051 VARIANTS FROM ATMIL
..., _ _ RAM I/OF [Link]
AT'iidt .. ,K 128 J
• A119LV5I 4K 128 •. J2 ]V ' . ,40
An9C105I IIC 64 · 15 JV 20
A119C2Q5I 2K • 128 U ]V 20
ATIIICSl' · .. "' - ~ 128 n
. 5V 40
A'l'M.V5l 111t 128 · • · · J2 JV • 40

-:.-~•·.xr--iT~
8051 VARIANTS FROM DALLAS SIMI

I 11:1:1.1 I~~:@··
electrical engineering show an increasing integration of mechanics with electron-
ics and infonnation processing. This integration is between the components (hard-
ware) and the infonnation-driven functions (software), resulting in integrated sys-
tems called mechatronic systems.
The development of mechatronic systems involves finding an optimal bal-
ance between the basic mechanical structure, sensor and actuator implementation,
automatic digital infonnation processing and overall control, and this synergy
results in innovative solutions. The practice of mechatronics requires multidisci-
plinary expertise across a range of disciplines, such as: mechanical engineering,
electronics, infonnation technology, and decision making theories."
Review Questions
I. True or false. Microcontrollers are nonnally less expensive than microproces-
sors.
2. When comparing a system board based on a microcontroller and a general-
purpose microprocessor, which one is cheaper?
3. A microcontroller nonnally has which of the following devices on-chip?
(a) RAM (b) ROM (c) 110 (d) all of the above
4. A general-purpose microprocessor nonnally needs which of the following
devices to be attached to it?
(a) RAM (b) ROM (c) 110 (d) all of the above
5. An embedded system is also called a dedicated system. Why?
6. What does the term embedded system mean?
7. Why does having multiple sources of a given product matter?

SECTION 1.2: OVERVIEW OF THE PIC18 FAMILY

In this section, we first look at the PIC family of microcontrollers and then
examine the PIC18 family in more detail.
A brief history of the PIC mlcrocontroller
In 1989, Microchip Technology Corporation introduced an 8-bit micro-
controller called the PIC, which stands for Peripheral Interface Controller. This
microcontroller had small amounts of data RAM, a few hundred bytes of on-chip
ROM for the program, one timer, and a few pins for 1/0 ports, all on a single chip
with only 8 pins. (Sec Figure 1-2.) It is amazing that a company thal began with
such a humble product became one of the leading suppliers of 8-bit microcon-
trollers in less than a decade. At the time of this writing, Microchip is the number-
one supplier of 8-bit microcontrollers in the world. Since the introduction of the
PIC16xxx, they have introduced an array of8-bit microcontrollers too numerous
to list here. They include the PIC families of IOxxx, 12xxx, 14xxx, 16xxx, 17xxx,
and 18xxx. They are all 8-bit processors, meaning that the CPU can work on only
8 bits of data at a time. Data larger than 8 bits has to be broken into 8-bit pieces to
be processed by the CPU. One of the problems with the PIC family is that they are
not all 100% upwardly compatible in tenns of software when going from one fam-
ily to another family. For example, while the 12xxx/16xxx have 12-bit and 14-bit
wide instructions, the PICl8xxx instruction is 16 bits wide with many new instruc-
28
Other Microcontrollers
There are many other popular 8-bit microcontrollers besides the PIC chip.
Among them are the 8051 , 68HC 11 , AVR, and 28. Besides Intel, a number of other 53
companies make the 8051 family, as seen in Table 1-4. TheAVR is made by Atmel
Corp. Freescale (Motorola) makes the 68HCI I and many of its variations. Zilog
produces the Z8 microcontroller. To contrast the PIC18 family with the 8051 /52
chip, examine Table 1-3. For a comprehensive treatment of the 8051 microcon-
troller, see "The 8051 Microcontroller and Embedded Systems" by Mazidi, et. al.

Table 1-3: Comparison of 8051 and PICl8 Family (40-pln package)


Feature 8051/52 PIC18xxx
Program ROM (maximum space) 64K 2M
Data RAM (maximum space) 256 bytes 4K
Timers 3 4
110 ins 32 33
Serial ort 1

34

Table 14: Some of the Companies that Produce Widely Used 8-bit Microcontrollers

Company Web Site Architecture


Microchip httpJ/[Link] PIC16XJOUl8xxx
Intel [Link] 8051
Atmel [Link] AYR and 8051
Philips/Signetics [Link] 8051
Zilog [Link] Z8 and Z80
Dallas Semi/Maxim [Link] 8051
Freescale Semi [Link] 68HCI l/68HC08

See http:f/[Link]:[Link] for a complete list.

See the following web sites for PIC mlcrocontrollers and PIC Trainer:

[Link]

http:/[Link]

Review Questions

I. Name three features of the PIC18xxx.


2 What 1s the mam difference between the PICl8Fxxx and PICl8Cxx.x m
.c
controllers"
Give the size of RAM m each of the following
(a) PICl8F2420 (b) PICl8F4520 •
4 Give the size of the on-chip program ROM m each of the followmg
(a) PICl8F2420 (b) PIC l8F4520
5 The PICl81s a(n) _ _ -btt microprocessor

Common questions

Powered by AI

Microcontrollers are advantageous in consumer electronics due to their compact size and cost-effectiveness. They integrate all necessary components on a single chip, which reduces the need for additional parts and space. This integration is suitable for tasks like signal reading and toggling bits, which are common in consumer applications such as television remotes and garage door openers .

Microcontrollers integrate a CPU, RAM, ROM, I/O ports, and a timer on a single chip. This makes them compact and cost-effective for specific tasks with limited hardware requirements, like in embedded systems . In contrast, general-purpose microprocessors, such as Intel's x86 family, require external RAM, ROM, and I/O ports to function, making them versatile but bulkier and more expensive .

Microcontrollers are preferred in embedded systems because they contain all necessary components such as CPU, RAM, ROM, and I/O ports on a single chip, which reduces space and cost. Their design is ideal for tasks with fixed purposes, as one specific function can be burned into the ROM .

Microcontrollers are termed "itty-bitty processors" because they integrate essential computing resources on a small chip, making them ideal for cost-sensitive and space-limited applications. This term signifies their efficiency and suitability for including computing power in compact and inexpensive devices, such as remote controls and toys .

Integration of an ADC enhances microcontroller functionality by enabling it to directly interface with analog signals, which are prevalent in real-world applications. This capability allows microcontrollers to process a wider range of inputs without additional hardware, making it suitable for applications such as sensors in automated systems and consumer electronics .

Manufacturers face challenges such as ensuring software compatibility across different families and addressing the limited capability for hardware upgrades. For instance, the PIC18xxx family with 16-bit wide instructions poses software compatibility challenges when shifting from older families like the 12xxx/16xxx with 12-bit or 14-bit instructions .

PIC18 microcontrollers offer up to 2MB of program ROM and 4K of data RAM, providing greater storage capacity for complex programs compared to the 8051 microcontroller, which typically has 64K of program ROM and 256 bytes of RAM . This difference impacts the complexity of tasks each can handle and their application range.

The PIC18xxx family is equipped with features such as larger RAM and extensive program ROM, multiple timers, and a high number of I/O ports. These features make it capable of handling complex tasks and interfacing with numerous peripherals, thus rendering it suitable for advanced and complex embedded system applications .

In mechatronic systems, microcontrollers serve as the central processing units that integrate mechanical components with electronic and information-driven functions. They enable automation and control by processing sensor inputs and driving actuators, leading to innovative solutions and improvements in system efficiency and functionality .

When selecting a microcontroller, factors such as the amount of on-chip RAM, ROM, the number of I/O ports, and the presence of timers must be considered. These attributes are crucial depending on the application's specific needs, like power consumption, space, and cost constraints .

You might also like