Thursday, August 27, 2020

Blinking The PIC16F877A With MikroC

Overview Of PIC16F877A

PIC16F877A is an old PICMicro device released in 2003. At the period that this device was very popular due to their large amount of I/O pins, a large memory, and a rich of peripherals to fit most of embedded applications. It was listed at the top of its mid-range 8-bit PICMicro.

However, there are many new released mid-range 8-bit devices. They have a lot of new features and more advantage over PIC16F877A. But the PIC16F877A is still in use in academic purposes and still useful in many typical electronic control projects.


Blinking The PIC16F877A With MikroC
A piece of PIC16F877A-I/P I used for prototyping


Blinking The PIC16F877A With MikroC
A screen shot of the running program

C Compilers For PICMicro

Many C compilers designed to target PIC devices. At the time I was at university, the popular C compiler are Hi-tech PICC, CCS PICC, and MikroC. 

MikroC from Mikroelectronika offers a free version of coding below the size of 2 KB, otherwise we will need to buy the compiler's license.


MikroC is not only support for PICMicro, but it's designed to fit many other architecture, ARM, AVR, and legacy 8051.But they are sold separately. The coding of C in this compiler remain almost the same in syntax and function libraries for all targeted architecture.


Simulation And Hardware Prototyping

Proteus is a simulating software based on SPICE. It has a lot of model and libraries for many analog, digital and microprocessor devices including PICMicro. 
Using this software could save a lot of time of doing the prototyping project in real hardware, especially a breadboard prototyping. Additionally, it could cut down the devices burning due to any wrong connection or over voltage during the prototyping.


Getting Start With MikroC Pro For PIC

MikroC Pro for PIC support all 8-bit PIC devices at the specific time of released version. It has a help file that demonstrates how to use C coding and function libraries. 


In this example, I show a simple LED blinking from the 8-bit of PORTD. PORTD of PIC16F877A is a pure digital input outputs port, without any multiplexing with analog peripherals.

MikroC source code lists below.

Circuit diagram made with Proteus.

Blinking The PIC16F877A With MikroC
Circuit Diagram


I have been using PICKit2 for device programming many years now. It still useful for any programming for most of the earlier version of PICMicro.



Blinking The PIC16F877A With MikroC
Using the PICKit2 to program the device

I use my own development board to test this program.

Blinking The PIC16F877A With MikroC
Testing this program on the development board

I make a video demonstrating how to get starting to use the compiler.


No comments:

Post a Comment

Labels

ADC (10) Analog (14) Arduino (12) Atmega16 (19) Audio (2) AVR (20) Charger (1) Cortex-M0 (1) Counter (10) CPLD (25) Digital I/O (22) Display (34) EEPROM (2) Environment Sensor (1) esp8266 (2) Experiment Board (10) I2C (4) Interrupt (7) LCD (1) LDmicro (29) measurement and instrumentation (7) Microchip Studio (3) MikroC (1) One-Shot (3) OpAmp (1) PCB (31) PIC16 Microcontrollers (16) PIC16F877A (2) PIC16F887 MikroC (22) PLC (35) PWM (11) Regulator (1) RTC (2) Sensor (8) Shift Registers (5) SPI (5) Timer (34) UART (2) ultra-sonic sensor (1) USB (1) VHDL (21) xc8 (1) XC95108 (9) XC9536 (15) XC9572 (1) Xilinx (23) Xilinx ISE (22)