This post provides the code to make an LED blink using PIC12F675 microcontroller. This code is written in C language using MPLAB with HI-TECH C compiler.
This code is intended to be the first step in learning how to use PIC12F675 microcontroller in your projects. You can download this code from the ‘Downloads‘ section at the bottom of this page.
Following figure shows the minimum circuit required to make an LED blink with PIC12F675.
In this figure, first thing to note is that no crystal oscillator is used with PIC12F675, because internal oscillator of 4MHz frequency is being used as the clock source here. GP3 is usually the master reset pin for PIC12F675 microcontroller. But to increase total number of pins available for other purposes, here I am not using GP3 pin as reset pin. So, to make this PIC12F675 microcontroller work, you only need to provide power on the pin 1 and pin 8 of this microcontroller.
Code
The code for making LED blink using PIC12F675 is shown below.
Whenever you are writing code for PIC microcontrollers, then you have to include “htc.h” file in the code. After including “htc.h” file, configuration bits are being set in the code shown above. To understand the details of how these configuration bits are being programmed, you can read this post.
Downloads
LED blinking code using PIC12F675 was compiled in MPLAB v8.85 with HI-TECH C v9.83 compiler and simulation was made in Proteus v7.10. To download code and Proteus simulation click here.
For more detail: PIC12F675 LED blinking code and Proteus simulation