PIC12F508 8-bit PIC Microcontroller

PIC12F508 is an 8-bit middle range microcontroller from Microchip. Here, PIC stands for Peripheral Interface Microcontroller. PIC12F508 is a cost-effective, high-performance flash microcontroller that permits us to add intelligence to our projects. It comes with a high-performance RISC CPU with only 33 single-word instructions. All instructions take one cycle to execute except for the branch instructions which takes 2 CPU cycles.

PIC12F508 8-bit PIC Microcontroller

PIC microcontrollers are designed to be controlled through software to perform various tasks. It comes with Flash memory technology which enables us to reprogram the controller over and over again.

This tutorial is an introduction to the PIC12F508 microcontroller. All the features, specifications, pin configuration, operation of GPIO pins, and applications will be discussed here.

PIC12F508 Introduction

PIC12F508 is used in numerous electronic microcontroller projects. It has 8 pins in total, out of which 6 are GPIO pins. Only one pin can be used as a digital input pin. But you want to use PIC12F508 in your project and you are fall short of GPIO pins, you can use a GPIO expander IC such as 74HC595 and MAX7219.

It comes with a 4MHz of inbuilt oscillator, which can be customized in energy-saving mode. We can also use an external oscillator with pin 2(OSC1) and pin 3(OSC2) but at the cost of GPIO pins. GPIO pins are already limited in PIC12F508. Therefore, it is recommended not to use an external oscillator and for various low-end applications internal 4MHz crystal is more than enough.

PIC12F508 Pinout

First let’s discuss the pinout digram of PIC12F508 microcontroller. The following diagram shows the pinout of the PIC12F508 Microcontroller:

PIC12F508 pinout diagram

Pin Configuration

The pin configuration detail in tabular is mentioned below:

NumberPin NameFunction
1VDDSupply pin for GPIO pins (+5V)
2GP5/OSC1/CLKINDual-directional pin GPIO pin / External clock pin/ Oscillator input pin
3GP4/OSC2Dual-directional pin GPIO pin / Oscillator output pin
4GP3/MCLR/VPPInput pin / active-low Master Reset pin / programming input Voltage pin
5GP2/T0CKIDual-directional GPIO pin / Clock input to TMR0 pin
6GP1/ICSPCLKDual-directional pin GPIO pin / In-circuit Serial programmer clock pin
7GP0/ICSPDATDual-directional pin GPIO pin / In-circuit Serial programmer clock pin
8VSSGround pin
  1.  GPIO pins: It has a total of 8 GPIO pins, out of which 5 are bi-directional input-output pins and 1 input pin.
  2. In-Circuit Serial Programming (ICSP): PIC12F508 supports circuit programming. It can program the microcontroller in-circuit through serial communication.
  3. MCLR: It is an active-low master reset of the microcontroller. As it is active-low so consistent supply should be provided to this pin; otherwise, the controller resets itself.
  4. T0CKI: This pin acts as a clock to the Real-Time TMR0.
  5. OSC1/CLKIN: It represents oscillator input or external clock input. The respective can be used for either purpose.
  6. OSC2: It is the oscillator output pin.
  7. VDD: A power supply of 5 Volts is provided to operate the microcontroller.
  8. VSS: It provides a ground or zero reference level to the input pins.

PIC12F508 Features and Specifications

Feature and Peripheral PIC12F508Availability
Bus Width8-bit
ArchitectureRISC
Flash Program Memory (words)512 Bytes
Data Memory (bytes)25 bytes
GPIO Pins6 GPIO and 1 only input
General-Purpose Timers1
Internal Pull-upsYes
In-Circuit Serial ProgrammingYes
Number of Instructions33
ADC0
DAC0
PWM0
UART0
I2C0
SPI0
CAN0
Maximum Operating voltage (V)5.5
Watchdog Timer (WDT)Yes
  • DataBus Width : 8bits
  • ProgramBus Width : 12 bits 
  • Pin Count : 8 (PDIP/SOIC/MSOP/DFN)
  • Processor Speed: 1 Million Instructions per Second
  • Program Memory: 512 words
  • StaticRAM: 25 bytes
  • Data EEPROM: 25 Bytes
  • Operational Temperature : -400C –  1250C

Some of the detailed features listed as follows:

  • High-performance CMOS microcontrollers with Flash Technology
  • operates at a low power of 2.2 – 5.5 volts, so it is power-efficient
  • Each I/O pin can sink/source current of 25mA
  • operational frequency is up to 4MHz but can be altered for saving energy
  • does need an external circuit to reset it due to a device reset timer and power-on reset
  • Programmable code protection for durability
  • Watchdog timer to work and wake the device up from sleep mode and can be activated or deactivated through programming
  • Electrically Erasable Memory programmable Read-Only Memory of 25×8 bytes to store some of the data permanently
  • Program memory of 0.75 KB
  • 8-bit RISC architecture based CPU
  • 12-bit wide instruction set with 33 single-word instructions
  • Completes instructions in one cycle except for program branches, which requires two cycles

How to Program PIC12F508 Microcontroller

PIC microcontrollers can be programmed with different software and compilers.

Supported Compilers

The function of an IDE(Integrated Development Environment) is to provide the environment for programming. The compiler converts the program into readable HEX files. The IPE(Integrated Programming Environment) serves the purpose of burning HEX files in PIC MCUs.

Programming for PIC microcontrollers through assembly language is still functional. Some of the compilers like MPLAB XC8 developed by Microchip manufacturers, MikroC for PIC, and Hi-Tech Compiler are commonly used. You are see these getting started guide:

Programmer to Flash Code

To program PIC12f508, we require an IDE, an IPE, a Compiler, and a programmer/debugger, all provided by MPLAB.

PICKit3 is an In-circuit programmer/debugger which plays an integral role in programming PIC. It supports In-Circuit-Serial-Programming, operated by a computer, to burn the code into PIC using MPLAB. PIC is programmed by using only two pins(PGC and PGD) using PICKit3. No power pins are required. Furthermore, hardware like Perfboard, soldering station, Crystal Oscillator, capacitors, PIC IC is required.

program PIC12F508 with pickit3

You can see this tutorial on PicKit3:

Alternate Options

  • PIC12F629
  • PIC12F683
  • PIC16F505
  • PIC12C508
  • PIC16F676
  • PIC16F72
  • PIC16F873A
  • PIC16F876A
  • PIC16F886
  • PIC16F252

Applications

  • Sensor Systems
  • Safety devices
  • Automation systems 
  • Cost-effective embedded systems

PIC12F508 2D Diagram

 PIC12F508 8-bit PIC Microcontroller comes in four packages, i.e., PDIP, SOIC, MSOP, and DFN. The following figure shows the 2d model of PIC12F508 8-bit PIC Microcontroller(PDIP). It shows us the physical dimensions of the components required when a PCB card is designed.

PIC12F508 2D diagram

Datasheet

To see further details and specifications of PIC12F508, the link to the datasheet is given below.

Other Pic Microcontrollers:

1 thought on “PIC12F508 8-bit PIC Microcontroller”

Leave a Comment