Basics of PIC (Hardware)


This tutorial aims to explain the fundamentals of PIC microcontroller family which are essential to understand for the beginners. We will first understand the hardware required to start working with PIC. We will also cover the details of PICKIT3 which is used as loader as well as debugger for PIC micro-controllers.

PIC18F46K22

We will consider PIC18F46K22 micro-controller to learn basic registers of micro-controllers. Pin diagram for this as shown below.

PIC18F46K22

PIC18F46K22

Pin Description

PIC18F46K22 has 5 ports named as PORTA, PORTB, PORTC, PORTD and PORTE.

PORT NAME PINS
PORTA RA0-RA7
PORTB RB0-RB7
PORTC RC0-RC7
PORTD RD0-RD7
PORTE RE0-RE7

VDD (Pin11) and VSS-GND (Pin12): Power supply for any circuit is as important as oxygen for humans. PIC needs power supply in the range of 2.3V to 5.5V for its operation.

We have assumed input as 230, 50 Hz AC mains supply. Block Diagram for 5V DC power supply is as follows.

Power Supply Block Diagram

Power Supply Block Diagram

Transformer: It steps down the AC Voltage from 230V to 9V.

Rectifier: It converts AC supply into pulsating DC.

Filter: It is used to smoothen the DC as much as possible.

Regulator: It absorbs the variation of input voltage and regulates the output voltage.

Circuit Diagram for 5V Power Supply:

Power Supply 5V

Power Supply 5V

OSC1/RA6 (Pin14) & OSC2/RA7 (Pin13): Every microcontroller needs a square wave pulse of suitable frequency for its operation. This pulse controls the execution speed of the controller. PIC controller has inbuilt oscillator available. We can also connect external RC oscillator or crystal oscillator with PIC. Pins OSC1 and OSC2 has been provided for this purpose. If we use internal oscillator, these two pins can be used as GPIO pins as RA6 & RA7.

Circuit Diagram for External Crystal Oscillator:

Crystal Oscillator for PIC

Crystal Oscillator for PIC

PortA: It is 8 bit port which can be used as GPIO port. It also has various alternate functions such as analog input pins, reference voltage for ADC etc. Pins RA6 and RA7 are used for crystal if e opt to use external crystal oscillator.

PortB: It is also an 8 bit port which has alternate functions such as interrupts, analog input pins etc. RB6 (PGC) and RB7 (PGD) are used to connect with PICKIT3 which is used as a loader or debugger tool.

PortC: 8 bit port which has alternate functions such as UART port, I2C port, analog input pins etc.

PortD: It has various functionalities along with analog input on all pins.

PortE: It is 4 bit port available in PIC controller. MCLR (RE3) is also used as a reset pin. However we can us e that as a GPIO pin also. It’s up to us to select how we want to configure it. It also plays a vital role in loading or debugging of program.

PICKIT3

Microchip has developed PICKIT which is used as a programmer/debugger for all PIC family controllers.

Microchip’s PICkit™ 3 In-Circuit Debugger/Programmer uses in-circuit debugging logic incorporated into each chip with Flash memory to provide a low-cost hardware debugger and programmer. In-circuit debugging offers these benefits:

  • Low cost
  • Minimum of additional hardware needed for debug
  • Expensive sockets or adapters are not required

The MPLAB PICkit 3 allows debugging and programming of PIC® and dsPIC® Flash microcontrollers at a most affordable price point using the powerful graphical user interface of the MPLAB X Integrated Development Environment (IDE). The MPLAB PICkit 3 is connected to the design engineer's PC using a full speed USB interface and can be connected to the target via an Microchip debug (RJ-11) connector (compatible with MPLAB ICD 2, MPLAB ICD 3 and MPLAB REAL ICE). The connector uses two device I/O pins and the reset line to implement in-circuit debugging and In-Circuit Serial Programming™.

It has DIP 6 pin connector which can be used to connect with micro-controller board.

Circuit Diagram for PICKIT3:

PICKIT3_Connections

PICKIT3_Connections

In further tutorials, we will learn how to load program using PICKIT3. In circuit diagram section, we have shown schematic which we need to start working on PIC micro-controller.

So now let’s make this board and start exploring the amazing world of micro-controller.

Schematic for PIC

Schematic for PIC

You may also like...

Leave a Reply

Specify Facebook App ID and Secret in Super Socializer > Social Login section in admin panel for Facebook Login to work

Specify LinkedIn Client ID and Secret in Super Socializer > Social Login section in admin panel for LinkedIn Login to work

Your email address will not be published. Required fields are marked *