Cirkit Designer Logo
Cirkit Designer
Your all-in-one circuit design IDE
Home / 
Component Documentation

How to Use pic16f887: Examples, Pinouts, and Specs

Image of pic16f887
Cirkit Designer LogoDesign with pic16f887 in Cirkit Designer

Introduction

The PIC16F887 is an 8-bit microcontroller manufactured by Microchip Technology. It is a versatile and powerful device, featuring 40 pins, 368 bytes of RAM, 256 bytes of EEPROM, and a 14-bit instruction set. This microcontroller is equipped with a variety of peripherals, including timers, analog-to-digital converters (ADC), pulse-width modulation (PWM), and communication interfaces, making it ideal for a wide range of embedded applications.

Explore Projects Built with pic16f887

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
Raspberry Pi Pico-Based Gas Detection System with LCD Display and Buzzer Alert
Image of Gas Detector: A project utilizing pic16f887 in a practical application
This circuit features a Raspberry Pi Pico microcontroller interfaced with various components including a 16x2 I2C LCD, an MQ-9 gas sensor, a potentiometer, a buzzer, and a pushbutton. The circuit is designed to read sensor data, display information on the LCD, and control the buzzer and other peripherals through the microcontroller.
Cirkit Designer LogoOpen Project in Cirkit Designer
ESP8266 RFID Access Control with I2C LCD Feedback and Buzzer Alert
Image of RFID: A project utilizing pic16f887 in a practical application
This circuit features an ESP-8266 microcontroller interfaced with a 16x2 I2C LCD display, an RFID-RC522 module, and a buzzer. The ESP-8266 communicates with the LCD via I2C (using D1 for SCL and D2 for SDA) to display information, with the RFID module via SPI (using D4-D7 for control and data lines) to read RFID tags, and controls the buzzer using pin D8. The circuit is likely used for an RFID-based identification system with visual feedback on the LCD and audible alerts from the buzzer.
Cirkit Designer LogoOpen Project in Cirkit Designer
RTL8720DN-Based Interactive Button-Controlled TFT Display
Image of coba-coba: A project utilizing pic16f887 in a practical application
This circuit features an RTL8720DN microcontroller interfaced with a China ST7735S 160x128 TFT LCD display and four pushbuttons. The microcontroller reads the states of the pushbuttons and displays their statuses on the TFT LCD, providing a visual feedback system for button presses.
Cirkit Designer LogoOpen Project in Cirkit Designer
ATMEGA328 Battery-Powered LED Blinker with FTDI Programming
Image of Homemade Arduino using ATmega328: A project utilizing pic16f887 in a practical application
This circuit is a basic microcontroller setup using an ATMEGA328, powered by a 5V battery, and includes an FTDI programmer for serial communication. It features a pushbutton for reset functionality and two LEDs controlled by the microcontroller, with one LED blinking at a 1-second interval as programmed.
Cirkit Designer LogoOpen Project in Cirkit Designer

Explore Projects Built with pic16f887

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
Image of Gas Detector: A project utilizing pic16f887 in a practical application
Raspberry Pi Pico-Based Gas Detection System with LCD Display and Buzzer Alert
This circuit features a Raspberry Pi Pico microcontroller interfaced with various components including a 16x2 I2C LCD, an MQ-9 gas sensor, a potentiometer, a buzzer, and a pushbutton. The circuit is designed to read sensor data, display information on the LCD, and control the buzzer and other peripherals through the microcontroller.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of RFID: A project utilizing pic16f887 in a practical application
ESP8266 RFID Access Control with I2C LCD Feedback and Buzzer Alert
This circuit features an ESP-8266 microcontroller interfaced with a 16x2 I2C LCD display, an RFID-RC522 module, and a buzzer. The ESP-8266 communicates with the LCD via I2C (using D1 for SCL and D2 for SDA) to display information, with the RFID module via SPI (using D4-D7 for control and data lines) to read RFID tags, and controls the buzzer using pin D8. The circuit is likely used for an RFID-based identification system with visual feedback on the LCD and audible alerts from the buzzer.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of coba-coba: A project utilizing pic16f887 in a practical application
RTL8720DN-Based Interactive Button-Controlled TFT Display
This circuit features an RTL8720DN microcontroller interfaced with a China ST7735S 160x128 TFT LCD display and four pushbuttons. The microcontroller reads the states of the pushbuttons and displays their statuses on the TFT LCD, providing a visual feedback system for button presses.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of Homemade Arduino using ATmega328: A project utilizing pic16f887 in a practical application
ATMEGA328 Battery-Powered LED Blinker with FTDI Programming
This circuit is a basic microcontroller setup using an ATMEGA328, powered by a 5V battery, and includes an FTDI programmer for serial communication. It features a pushbutton for reset functionality and two LEDs controlled by the microcontroller, with one LED blinking at a 1-second interval as programmed.
Cirkit Designer LogoOpen Project in Cirkit Designer

Common Applications

  • Home automation systems
  • Industrial control systems
  • Robotics and motor control
  • Sensor interfacing and data acquisition
  • Educational and prototyping projects

Technical Specifications

Key Technical Details

Parameter Value
Architecture 8-bit
Program Memory 8 KB (Flash)
Data Memory 368 bytes (RAM)
EEPROM 256 bytes
Instruction Set 14-bit
Operating Voltage 2.0V to 5.5V
Clock Speed Up to 20 MHz
I/O Pins 36
ADC Resolution 10-bit
Timers 3 (Timer0, Timer1, Timer2)
Communication Interfaces USART, I2C, SPI
PWM Channels 2
Package Types DIP-40, QFN-44, TQFP-44

Pin Configuration and Descriptions

The PIC16F887 has 40 pins, with the following key pin functions:

Pin Number Pin Name Description
1 MCLR/VPP Master Clear (Reset) input or programming voltage
2-7 RA0-RA5 Analog/Digital I/O pins
8 VSS Ground
9-10 OSC1/OSC2 Oscillator input/output
11-18 RB0-RB7 Digital I/O pins
19 VDD Positive supply voltage
20-27 RC0-RC7 Digital I/O pins
28-33 RD0-RD5 Digital I/O pins
34-37 RE0-RE3 Analog/Digital I/O pins
38 VSS Ground
39 VDD Positive supply voltage
40 RA6/OSC2 Digital I/O or Oscillator output

Usage Instructions

How to Use the PIC16F887 in a Circuit

  1. Power Supply: Connect the VDD pin to a 5V power source and the VSS pin to ground.
  2. Oscillator Configuration: Connect an external crystal oscillator (e.g., 4 MHz) between OSC1 and OSC2 pins, along with appropriate capacitors.
  3. Reset Pin: Connect the MCLR pin to 5V through a 10kΩ pull-up resistor. For in-circuit programming, ensure this pin is accessible.
  4. I/O Pins: Configure the I/O pins (RA, RB, RC, RD, RE) as input or output in the software, depending on your application.
  5. Programming: Use an ICSP (In-Circuit Serial Programming) tool to load your program into the microcontroller.

Important Considerations and Best Practices

  • Decoupling Capacitors: Place a 0.1µF capacitor close to the VDD and VSS pins to reduce noise.
  • Unused Pins: Configure unused pins as outputs or connect them to ground through a resistor to avoid floating states.
  • Clock Source: Choose an appropriate clock source (internal or external) based on your application's timing requirements.
  • Programming Voltage: Ensure the MCLR pin receives the correct programming voltage (VPP) during programming.

Example Code for Arduino UNO Integration

The PIC16F887 can communicate with an Arduino UNO via UART. Below is an example of Arduino code to send data to the PIC16F887:

// Arduino UNO UART Communication with PIC16F887
// Sends a message to the PIC16F887 via Serial

void setup() {
  Serial.begin(9600); // Initialize UART at 9600 baud rate
}

void loop() {
  Serial.println("Hello, PIC16F887!"); // Send data to PIC16F887
  delay(1000); // Wait for 1 second
}

On the PIC16F887 side, configure the USART module to receive the data.

Troubleshooting and FAQs

Common Issues and Solutions

  1. Microcontroller Not Responding

    • Cause: Incorrect power supply or missing decoupling capacitors.
    • Solution: Verify the VDD and VSS connections and add a 0.1µF capacitor near the power pins.
  2. Program Not Running

    • Cause: Incorrect oscillator configuration.
    • Solution: Check the crystal oscillator connections and ensure the correct fuse settings are used during programming.
  3. Communication Failure with Arduino

    • Cause: Mismatched baud rates or incorrect wiring.
    • Solution: Ensure both devices use the same baud rate and verify the TX and RX connections.
  4. Floating Pins

    • Cause: Unused pins left unconnected.
    • Solution: Configure unused pins as outputs or connect them to ground through resistors.

FAQs

Q: Can the PIC16F887 operate without an external oscillator?
A: Yes, the PIC16F887 has an internal oscillator that can be used for low-speed applications.

Q: How do I store data permanently on the PIC16F887?
A: Use the built-in 256 bytes of EEPROM to store data that needs to persist after power loss.

Q: What is the maximum clock speed of the PIC16F887?
A: The PIC16F887 can operate at a maximum clock speed of 20 MHz with an external oscillator.

Q: Can I use the PIC16F887 for PWM applications?
A: Yes, the PIC16F887 has two PWM channels that can be used for motor control, LED dimming, and other applications.