Introduction
XC8 compiler is a C compiler targeting 8-bit PIC devices, develops by Microchip. It's free with full features. But if you want to pay, you can buy a standard or a pro edition.
In this tutorial, I select PIC16F887. It was released around 2009. Currently, It still in production with lower cost. However, Microchip has been release many new 8-bit PIC devices with many more features than PIC16F887.
At this time, The latest version of its main IDE MPLABX is v5.4. The latest version of XC8 compiler is v2.20. They are cross-platform. We can develop the firmware using this IDE and C compiler on Windows, Linux and Mac OS.
A screen shot MPLABX v1.51 starting up, that I use for this tutorial. |
Anyway, I use MPLABX IDE v1.51 with XC8 v1.31 for this tutorial page. They are light-weight and easy to use. The latest version is rich of resources and functionalities, but we don't need those stuffs.
The MPLABX IDE 1.51 and XC8 1.31
Getting started and basic digital inputs outputs programming
- Programming the PIC16F887 with MPLABX XC8
- Programming the digital inputs outputs of PIC16F887 with XC8
- PIC16F887 LED scrolling programming with XC8
- PIC16F887 interfaces to a single digit seven-segment display with XC8
- PIC16F887 controlling the DC servo motor without hardware PWM module
- PIC16F887 set and reset an output relay-controlled lamp
- PIC16F887 interfaces to a unipolar stepper motor
- Using digital input with weak pull up resistor of PIC16F887
- Introduction to external interrupt of PIC16F887
- Programming the PortB interrupt on change of PIC16887
- Making a digital up down counter using PortB interrupt on change of PIC16F887 with Multiplexed Display
- Driving a single 8x8 dot matrix display using PIC16F887
- PIC16F887 interface to a bipolar stepper motor
- PIC16F887 controls the direction and speed of a brushed DC motor without using PWM module
- Interfacing the 74HC595 shift registers with PIC16F887 digital pins
- Interfacing a parallels in serial out shift register to PIC16F887 via digital pins
PIC16F887 Configurations
- Using the internal calibrated RC oscillator of PIC16F887 programming with XC8
- Using Reset pin of PIC16F887 as a digital input pin
- Using the watch dog timer in PIC16F887
Timer 0 Module
Analog To Digital Converter
- Introduction to analog to digital converter module
- Using ADC module to read analog voltage between 0 to 5 volts DC
- Reading multiple analog voltage inputs in the ADC module
- Working with ADC references voltage of PIC16F887
- Interfacing LM35 temperature sensor to the ADC module of PIC16F887
- Designing a positive and negative DC voltage meter using the 10-bit ADC module
- Reading the ADC using interrupt method
- Interfacing LDR and NTC thermistor to PIC16F887 ADC module
The MPLABX IDE 6.15 (2023) and XC8 2.36
The earlier releases of MPLABX IDE and XC8 C compiler does not run properly on Microsoft Windows 10 x64 with updates. So I decided to use the latest version of the MPLABX IDE 6.15 in late 2023. The latest version include code configuration tool, ML, etc. The PICKKit2 programmer tool doesn't work in this new IDE. Using an older version of XC8 C compiler of 2.36 is not a problem. It still work in new IDE but it doesn't contain any new release of Microchip devices that I don't need them here.
From late 2023 I added some new programming examples. The PIC16F887 interfaces with character LCD, analog (LM35) and digital (1-Wire ds18B20) temperature sensor, temperature and humidity (DHT-11) sensor, and the Ultrasonic Range Finder (HC-SR04) sensor.
- PIC16F887 HD44780 4-Bit LCD Example Using XC8
- PIC16F887 HD44780 8-Bit LCD Example Using XC8
- PIC16F887 LM35 and LCD Interfacing Example Using XC8
- PIC16F887 DS18B20 LCD Example Using XC8
- PIC16F887 DHT-11 LCD Example Using XC8
- PIC16F887 HC-SR04 Distance Sensor LCD Using XC8
- PIC16F887 I2C DS1307 RTC LCD Using XC8
- PIC16F887 I2C AT24C16B EEPROM LCD Using XC8
- PIC16F887 SH1106 I2C OLED Display Example using XC8
- PIC16F887 TM1637 Six Digits 7-Segment Display Example Using XC8
- PIC16F887 TM1637 Display and Key Scan Example using XC8
- PIC16F887 PCF8574 I2C Example using XC8
- PIC16F887 KeyPad and Character LCD Example using XC8
- PIC16F887 PCF8574AP I2C 4x4 Key Pad using XC8
- PIC16F887 PCF8574AP I2C LCD Example using XC8
- PIC16F887 MCP23017 I2C GPIO Example using XC8
- PIC16F887 MCP23017 Key Pad and 7-Segment Display Example using XC8
- PIC16F887 MCP23017 I2C LCD Example using XC8
- PIC16F887 MCP23017 LCD and Keypad Interfacing using XC8
- PIC16F887 Serial Peripheral Interface Example
- PIC16F887 SPI and MCP23S17 XC8 Example
- PIC16F887 SPI MCP23S17 and Character LCD XC8 Example
- PIC16F887 SPI MCP23S17 Character LCD and KeyPad XC8 Example
Using a simple DIY prototype board could help the electronics hobbyists to reduce time in circuit construction on bread-board. I also prevent from wrong connections of wire that can destroy the chips. I made my own PIC16F877A/PIC16F887/PIC18F4550 prototype board.
A DIY Prototype Board for PIC16F877A PIC16F887 PIC18F4550 etc |
No comments:
Post a Comment