
PIC 12F675 is 8 bit , 8 pin mini and powerful Microcontroller.
It has 1k Bytes of ROM Flash memory , 64 Bytes of RAM , 128 Bytes of EEPROM , 4 channels of 10 bit ADC , 2 TIMERS one 8 bit and another 16 bit.A comparator and inbuilt oscillator also are provided.
This chip can be programmed using PICKIT3.
IDE used is MPLAB X and compiler is XC 8.
Connection details as below in image.
An LED is connected to pin 3 (GP4) .Short lead of LED is connected to Gnd through a Resistor 470E.

MPLAB X IDE is the IDE used here for development.Compiler installed is XC8
https://www.microchip.com/mplabx-ide-windows-installer
https://www.microchip.com/mplabxc8windows

Open MPLABX IDE , File –> New Project
Select Standalone Project

Under Device select PIC12F675
Against TOOL , tick mark Show All and select PICKIT3 from the dropdown list.

Next is the selection of Compiler.
Select XC8 .
If not listed , check the installation of XC8 compiler.

Provide a Project name and browse to the location of folder created for project location.

Now the project files are created.
Right click on SOURCE FILES and click on New –> main.c
If you want rename the file , leave the extension as .c
Click Next to add the .c file to Source files.

Click on .c file to see the skeleton C file.
#include <xc.h>
header file for Compiler is added automatically.
We need to set the configuration bits in the code using
#pragma config

Settings like Internal oscillator , Watch Dog OFF , Brownout detect OFF can be
used with a comma separator in a single command line.

You can also verify correct settings by clicking on Production –> Set Configuration Bits

A new Window opens at the bottom.
Here you can do the needed settings and finally click on Generate code.
You can copy and paste the pragma settings inside the C code.
Or to make it simple make a single command line with comma separator.
As we cannot spare 2 GPIO pins for external crystal oscillator , most of the projects are configured for internal oscillator of 4 MHz.
This is set by
# pragma config FOSC=INTRCIO

Next we need to define the crystal frequency
#define _XTAL_FREQ 4000000
Without this command delay function will not work.
Data Direction is set by TRISIO Register.
Making a bit 0 will make the corresponding GPIO pin OUTPUT
and making a bit 1 will configure GPIO as INPUT.
TRISIO=(0<<4);
The above notation can also be used.Here 0 is left shifted 4 times thus making GP4 as OUTPUT.
Under never ending loop we make GP4 initially 0 and after a delay of 1 second we make it 1.
Note the usage of double underscore __ before delay.

Before building the project , an important setting to be done to make the Power to Target from PICKIT3.
Click Set Project Configuration and then Customize.

Select PICKIT3 and then from the dropdown select POWER.

Put a tick mark against Power Target from PICKIT3 and click Apply.

Now click on BUILD MAIN PROJECT or F11 Button to Compile.

When no errors are found , you can see BUILD SUCCESSFUL.

Now click on the DOWN Arrow icon on tool bar to upload the hex file on to chip.

Once file is uploaded , you can see the LED connected to GP4 blinking.

