Teach Yourself PIC Microcontrollers | www.electronicspk.com | 10
now digital signal processing microcontrollers.
The beauty of these devices
is their easy availability, low cost and easy programming and handling. This
has made PIC microcontrollers as the apple of hobbyists and students eyes.
We shall be talking about mid-range PIC
microcontrollers, and use PIC18F452 as a prototype
in this manual to explore them. Knowledge gained by
learning and exploring one microcontroller is almost
90% applicable on other microcontrollers of the same
family. The only difference
is in availability of
resources on different chips.
General Organization of PIC
Microcontrollers
Although we shall talk in detail on various aspects of
these chips in relevant sections, here I would like to
give a brief introduction
on the overall business
involved. Fig-2 shows the pin out details of a very
popular 40-pin PIC microcontroller, PIC16F877. as
you can see that each pin has been assigned a number
of functions. Sometimes two and sometimes three.
This situation is very common in microcontrollers, as
there is always more which your microcontroller can
offer, yet the number of
pins on a given package is
limited.
In a given circuit/application a pin is usually tied to a specific job, and all functionality of a pin is usually
not required, however you make opt to use the specific pin your own way.
The specific function of a pin is selected by configuring various bits of internal registers. The number and
names of these special function registers (SFRs) vary from device to device as
some devices have limited
functionality while others have more. Nevertheless if we are talking about a function which is present in
both devices, its SFR will be same. The selection and settings of these SFR’s is the key to successful
programming. It is therefore mandatory to go through the data sheets of the device before starting a project.
Second important thing to know is that the devices with same number of pins (from microchip®), are all
pin-compatible. Which means if you design a project for 40 pin PIC microcontroller, and later want to
replace the chip with another 40 pin PIC the pins are all compatible. It is also good
to know that a pin
labeled as lets say RB0 is located on pin 33 of PIC 16F877, but the same pin is available on pin 6 in 18 pin
PIC16F628. the pins are functionally same, as long as their names are same. So if you develop a project
while experimenting on 18F452 using pin RB0, after successful testing you want to transport the project to
an 18 pin device, which also has RB0 on it, apart
from pin number on package, and recompiling the
program, you don have to bother much about anything else.
Chia sẻ với bạn bè của bạn: