PIC16F887 has the same pin
diagram as PIC16F877A. Therefore, you can replace the PIC16F877A on your old
project with PIC16F887 without any problem. What is so special about this new
model of 8-bit PIC microcontroller? Let’s compare it side by side.
As the table shows, memory wise,
both 887A and 887 are the same, whereby both have 8K words of program memory
and 368 bytes of data memory. What attracted me to 887 is the internal crystal
that offers speed from 32KHz to 8MHz. This internal crystal can be tuned
through software register and it offers switchable operating frequency between
internal and external crystal during program runtime. With this option, we can
save the money needed for external crystal, avoid breakdown when the external
crystal stop working and you have two extra I/O pin that was initially used for
external crystal. The two extra pins are RA6 and RA7 which is bidirectional I/O
pin, great! If you compare with PIC16F877A pin diagram you will not get these
two pins.
What’s next? The ADC of course!
PIC16F887 has increased the analog input to 14 channels, and every pin can be
configured to analog or digital independently. As you might have notice, analog
input is getting more important because more sensors come with analog output as
it is the easiest method to deliver wide range of information by just single
wire interface. These sensors include infrared distance sensor, Ultrasonic
range finder, Accelerometer, Gyro, Gas sensor, LDR, and many more. With extra
analog input, you are able to integrate more analog sensor into your design.
Despite the increased number of analog input, there is another good feature in
this model for those who do not need the analog input. In a scenario where some
of you experience failure after you connect analog sensor to, let’s say, RA0
and RA5, digital input to RA2; and when you want to develop the program you
notice that to make RA0 and RA5 become analog input, RA2 will become analog
input too. Once the pin is analog, requesting digital logic will result in
wrong info.
However, you are still able to use it, provided that the program
changes the analog pin to digital pin every time before it reads digital input
pin, and same step apply when the program wants to read analog input pin. Isn’t
it troublesome? Many would agree with me. Worry no more with PIC16F887 as the
selection of analog input or digital input pin are truly independent of each
other. PIC16F887 uses ANSEL and ANSELH register to configure 14 channels of AN
pin to analog input or digital pin. ANSEL controls eight pins of PORTA+PORTE
while ANSELH controls six more pins at PORTB.
OK, what else can we get? If you
have noticed, there is one I/O pin left out from previous discussion. This pin
is RE3. PIC16F877A offers 33 I/O pin while PIF16F887 provides 36 I/O. We know
two extra I/O are from the crystal pins, where is another? It is actually the
MCLR pin which we normally use it for Reset purpose. For PIC16F887, user may
have the choice to tie MCLR internally to VDD and use pin 1 as RE3. However,
this pin can only be used as digital input.
I think that those facts
mentioned are sufficient for me to replace my PIC with this new model, but
there is another important factor for me to consider before migrating to it.
Everyone would agree with me, of course that is the price. PIC16F887 is much
cheaper than PIC16F877A. You should be able to get a PIC16F887 with only half
the price of PIC16F877A. This is the main factor, more features yet cheaper
price; with this, we definitely have no reason to resist it.
No comments:
Post a Comment