PIC16F877A

The PIC16F877A (and earlier PIC16F877) are microntrollers supplied by Microchip. It is just one device among many PIC microcontrollers and it is a veteran chip compared with many others. There are lots of articles, projects and circuit diagrams available on the web that use the PIC16F877A so it seems to make sense to use it but should you still use this chip?


The quick answer is an immediate no. For a start, MPLAB, Microchip’s development environment, makes it easy to swap code to a different chip. This is especially true of the latest MPLAB X, including the XC8 C compiler. Next, there are a number of newer PIC’s with the same pin out so that the circuit layout would be the same as in any PIC16F877A diagrams.

PIC16F877A compared to other 40-pin Microcontrollers

pic16f877a microcontroller picture

The code written for PIC16F877A can be easily swapped in MPLAB, the circuit diagrams are the same but what about price? The last time I looked other suitable PIC microcontrollers are a quarter of the price of the PIC16F877A. This is turning in to a no-brainer!

What PIC could I use instead?
The first obvious answer is the PIC16F887, which is a drop-in replacement. It has the same pin-out with ICSP pins, power and all port pins in the same place. The PIC16F877A has these features that we will want to reproduce for a start

  • 8K of Code space
  • 256 Bytes of EEPROM
  • 384 bytes SRAM
  • 8-level deep hardware stack
  • Up to 20 MHz clock
  • 1 16-bit, 2 8-bit timers
  • Syncronous Serial Port – SPI and I2C
  • USART
  • 8 channel, 10-bit ADC
  • Brown-Out Reset
  • 2 Analog Comparators
  • Capture, Compare, PWM module

and this pin-out

pic16f877a microcontroller pinout picture

How does PIC887 Compare?

The PIC16F887 has all these features, including the same code size and pin-outs but also has these improvements

  • Lower Power Modes
  • 14 ADC channels
  • USART also supports RS422/485 and LIN
  • Calibrated Internal Oscillator, 8-31MHz

PIC16F887 Pin-out

pic16f887 microcontroller pinout picture

The pin layout is the same but the 16F887 also has extra features on some ports, for example pin 37 on 877A is just RB4, on 887 it is also an extra ADC pin, AN11.

It is easy to swap from PIC16F877A to PIC16F887, with no changes to circuits and schematics, it is simple to change device in MPLAB and it is much cheaper. This is such an obvious update that trying to use a 16F877 or 16F877A does not make any sense.

Buy PIC16F887 Microcontroller
pic16f887 microcontroller picture

Other PIC Devices

I hope you agree that we have proved that moving to a 16F887 is a sensible idea on cost grounds alone but can we go further and get even more bang for our buck without lots of redesign? Microchip have not stood still and have produced lots of new PIC16F families with the designation PIC16F1xxx. The best contender in 40-pin layout is probably the PIC16F1789, which costs the same as a PIC16F887 and has the same pinout.

It has these advantages

  • 32K Code space not 8KB
  • Same 256 byte EEPROM
  • 2 KB SRAM not 384 bytes
  • 32 MHz clock not 20MHz
  • 16-Level Deep Hardware Stack not 8
  • Two Capture/Compare/PWM modules not 1
  • Same USART, SPI and I2C modules
  • 12-bit ADC not 10-bit, 15 channel
  • 2.3V to 5.5V VCC
  • 1 8-Bit and 3 5-Bit Digital-to-Analog
    Converters (DAC)
  • 4 high performance PWM modules
  • Four High-Speed Comparators not 2
  • Up to Three Operational Amplifiers
  • Fixed Voltage Reference (FVR)
  • Much lower current consumption

Ok, it has the same pin-out, 4 times the code space, lots more SRAM, better ADC, faster clock, wider voltage range and it costs the same money. Must be worth a look. The code space and SRAM size are important if you want to program in C. The C compiler eats SRAM and 384 bytes on 16F887 is not enough for a really serious project. With the advance of more battery applications, power consumption is more important than ever and PIC16F1789 (or even better PIC16LF1789) are far more efficient than older PIC microcontrollers.

PIC16F1789 PIC Microcontroller Picture
Buy PIC16F1789 Microcontroller

Conclusion

It does not make sense to use a PIC16F887A on cost grounds alone. The PIC16F887 is a better choice immediately.  With very little more work, you can update to a PIC16F1789 that has even more advantages. Incidentally, the same applies to PIC16F84 or PIC16F84A, another older chip with many code examples. You are much better off moving to a newer 18-pin chip, such as the PIC16F1827 for the same reasons described here, lower price, more features, lower power consumption and more code space.

Our latest PIC training kit uses the PIC16F1789 and is packed with tutorials and example projects in assembler and C to get you going with this latest PIC microcontroller. It includes latest PICkit4 debugger and programmer.

PIC Microcontrollers for Beginners
pic microcontrollers for beginners picture

Related Information

PIC Programmer Choices

Which PIC Microcontroller to Choose?

Is MPLAB X any Good?

 

PIC Programmer Range

Leave a Reply