Development Picks Up The Pace with PIC® Microcontrollers

When considering a microcontroller for your system’s hardware design, many factors must be considered. Although specifications and performance metrics are important, they only tell part of the story.

Any hardware design engineer can attest that ease of development, scalability, and excellent engineering support are invaluable to the successful release of any microcontroller (MCU)-based product. Microchip addresses these concerns through shared peripheral support across the PIC MCU product family, so code becomes more reusable. Development is also simplified via a unified and completely free MPLAB® Integrated Development Environment (IDE) which supports all PIC MCUs. And of course any PIC MCU also comes along with a host of technical documentation, software examples, hardware reference designs, and highly responsive customer support.

Microchip is a leader in the microcontroller market, offering a complete range of microcontroller devices. The 8-bit MCU families include the PIC10, PIC12, PIC16, and PIC18 series of MCUs. The 16-bit families include PIC24 MCUs and dsPIC33 Digital Signal Controllers (DSCs). The 32-bit PIC32 family offers the highest performance and the largest integrated memories in the PIC product line 8-bit MCUs have a pin count ranging from 6 to 100 pins, 16-bit MCUs have a pin count ranging from 14 to 144 pins, and 32-bit MCUs have a pin count ranging from 28 to 144 pins. Performance scales from a maximum of 16 MIPS in 8-bit MCUs, through a maximum of 70 MIPS in 16-bit MCUs, up to a maximum of 330 DMIPS for 32-bit MCUs. Integrated Flash (non-volatile) memory capacity varies similarly, with a range of 0.5-128KB for 8-bit, a range of 4-1024KB for 16-bit, and a range of 16KB to 2MB for 32-bit MCUs.

Microchip PIC MCUs offer the widest operating ranges available. The supply voltage input can range from 1.8V to 5.5V. Some device families support an ambient temperature of up to 150°C. Additionally, the eXtreme Low Power (XLP) 8-bit and 16-bit PIC MCUs offer industry-leading power consumption performance over a full range of package sizes. Run currents start at only 30 µA/MHz (8-bit) and 150 µA/MHz (16-bit), while sleep currents are as low as 9 nA. If outright performance is the goal, the Microchip 16-bit and 32-bit PIC MCU families offer the industry’s highest performance. If small form factors are paramount, packaged parts as small as the 8-pin 2 × 3 DFN are available. Microchip also continues to improve its product offerings: since 2009, over 140 new PIC MCUs have been added to the product portfolio, offering a range of industry-critical technologies such as integrated security engines, advanced analog capabilities and Core Independent Peripherals (CIP). Low-cost options abound, with MCUs supporting USB and 192-pixel segmented display drivers available for less than $1 (in quantity).

One key benefit of the Microchip PIC MCU ecosystem is the strong scalability between microcontroller families. Some integrated peripherals are available across the entire portfolio, such as Capture/Compare/PWM, timers, comparators, I2C, SPI, UART and touch sensing. Beginning with the 8-bit PIC16 MCU family, peripheral support is available for Intelligent Analog (Op Amp, DAC, and 12-bit ADC), USB, motor control, and segmented LCD. PIC18 devices and above support the CAN bus, and PIC24 devices and above also support integrated graphics drivers. Ethernet support is available on the PIC18 and PIC32 MCU families. These integrated peripherals do more than reduce CPU overhead, lower bill-of-materials (BOM) cost, and enable smaller system PCB sizes.

Because the peripheral support is shared amongst many of the PIC MCU families, there is reduced development overhead. In addition, many PIC MCU families share pinout/package footprints.

Therefore, the development code doesn’t need to change when interchanging PIC MCU designs. As a result, the system architect can spend less time worrying about the selection of the specific PIC MCU at the onset of the design. When more specifics are known about the product later in the design cycle, the microcontroller can easily be scaled without losing development effort. MCUs with the same pinout/footprint can even be scaled without impacting PCB layout.

As alluded to earlier, hardware specifications alone don’t win over the hardware/system design engineer. So perhaps the most compelling argument in favor of Microchip PIC MCUs over alternative solutions is their shared development environment. In fact, every MCU within Microchip’s expansive product portfolio (900+ components) is supported by the free MPLAB IDE. The latest version, known as MPLAB X IDE, is now based on the open-source NetBeans platform. It includes cross-platform support for Mac OS X®, Linux® and Microsoft Windows® operating system software. MPLAB X IDE also includes new features such as “one click” for automatically making, programming and running/debugging code on the PIC MCU, support for multiple compiler versions/debug tool versions, and improvements to the user interface of the MPLAB GUI.

MPLAB X IDE can be used for project management, code development, MCU programming and also code debugging. It not only provides a single IDE for development and debug of all Microchip PIC MCUs, but also provides a wide range of standard code libraries, including TCP/IP stacks and USB drivers. Many compilers are supported, including MPLAB XC8 (C compiler for 8-bit PIC devices), MPLAB XC16 (C compiler for 16-bit PIC devices), and MPLAB XC32 (C/C++ compiler for 32-bit devices). The MPLAB IDE also is supported by many third-party devices (PICAXE, etc.). In essence, this means code is easily portable between MCUs, reducing the amount of new code that must be developed and enabling the reuse of existing code.

Excellent support is a necessity for timely product deployment. Microchip has hundreds of highly trained application engineers on staff, who can assist in debugging technical issues as well as provide insight into the more advanced features within the ecosystem of MCUs and software tools. Microchip and their global distribution network offers support to customers of all sizes. In addition, PIC MCU customers have access to numerous reference designs and low-cost development boards for rapid product prototyping. Many example software programs are available for becoming familiar with MPLAB X IDE. Microchip also offers extensive technical documentation and application notes for thorough assistance with implementing PIC MCU features and capabilities. Even more assistance is available through Microchip’s comprehensive training resources, which include web seminars, hands-on training sessions, “lunch & learns”, and customer conferences. Microchip’s online forums provide a convenient and simple way for individuals to interact with the large, global community of over 60,000+ engineers and developers using PIC MCUs in their own systems.

As of 2015, the total embedded systems market continues to grow. Pre-existing markets such as energy meters and monitoring, lighting, security, automotive, and smartphone accessories are still expanding. New markets such as medical instruments and Internet of Things (IoT) devices promise even more applications for embedded systems. Meeting the demand for such a wide variety of embedded system designs will require companies to leverage internal software and hardware development across multiple different product lines. Engineering and development resources must be used efficiently for reduced product time-to-market.   Selecting Microchip PIC MCUs for your system design provides you with industry-leading hardware performance, scalability due to pin and code compatibility, and easier, platform-independent code development via the free MPLAB IDE which supports all Microchip MCUs. As a result, you will benefit from easier design-in and a more effective use of development resources, which will significantly speed your product’s time to market.

Pic Microcontroller Introduction

PIC is a Peripheral Interface Microcontroller which was developed in the year 1993 by the General Instruments Microcontrollers. It is controlled by software and programmed in such a way that it performs different tasks and controls a generation line. PIC microcontrollers are used in different new applications such as smart phones, audio accessories and advanced medical devices.

There are many PICs available in the market ranging from PIC16F84 to PIC16C84. These types of PICs are affordable flash PICs. Microchip has recently introduced flash chips with different types, such as 16F628, 16F877 and 18F452. The 16F877 costs twice the price of the old 16F84, but it is eight times more than the code size, with more RAM and much more I/O pins, a UART, A/D converter and a lot more features.

PIC Microcontrollers Architecture

The PIC microcontroller is based on RISC architecture. Its memory architecture follows the Harvard pattern of separate memories for program and data, with separate buses.

1. Memory Structure

The PIC architecture consists of two memories: Program memory and the Data memory.

Program Memory: This is a 4K*14 memory space. It is used to store 13-bit instructions, or the program code. The program memory data is accessed by the program counter register that holds the address of the program memory. The address 0000H is used as reset memory space and 0004H is used as interrupt memory space.

Data Memory: The data memory consists of the 368 bytes of RAM and 256 bytes of EEPROM. The 368 bytes of RAM consists of multiple banks. Each bank consists of general purpose registers and special function registers.

The special function registers consists of control registers to control different operations of the chip resources like Timers, Analog to Digital Converters, Serial ports, I/O ports, etc. For example, the TRISA register whose bits can be changed to alter the input or output operations of the port A.

The general purpose registers consists of registers that are used to store temporary data and processing results of the data. These general purpose registers are each 8-bit registers.

Working Register: It consists of a memory space that stores the operands for each instruction. It also stores the results of each execution.

Status Register: The bits of the status register denote the status of the ALU (arithmetic logic unit) after every execution of the instruction. It is also used to select any one of the 4 banks of the RAM.

File Selection Register: It acts as a pointer to any other general-purpose register. It consists of a register file address, and it is used in indirect addressing.

Another general purpose register is the program-counter register, which is a 13-bit register. The 5 upper bits are used as PCLATH (Program Counter Latch) to independently function as any other register, and the lower 8-bits are used as the program counter bits. The program counter acts as a pointer to the instructions stored in the program memory.

EEPROM: It consists of 256 bytes of memory space. It is a permanent memory like ROM, but its contents can be erased and changed during the operation of the microcontroller. The contents into EEPROM can be read from or written to, using special function registers like EECON1, EECON2, EEDATA, etc.

2. I/O Ports

PIC16 series consists of five ports, such as Port A, Port B, Port C, Port D and Port E.

Port A: It is a 16-bit port, which can be used as input or output port based on the status of the TRISA register.

Port B: It is an 8-bit port, which can be used as both input and output port. 4 of its bits when used as input can be changed upon interrupt signals.

Port C: It is an 8-bit port whose operation (input or output) is determined by the status of the TRISC register.

Port D: It is an 8-bit port, which apart from being an I/O port, acts as a slave port for connection to the microprocessor bus.

Port E: It is a 3-bit port that serves the additional function of the control signals to the A/D converter.

3. Timers

PIC microcontrollers consist of 3 timers, out of which the Timer 0 and Timer 2 are 8-bit timers and the Time-1 is a 16-bit timer, which can also be used as a counter.

4. A/D Converter

The PIC Microcontroller consists of 8-channels, 10-bit Analog to Digital Converter. The operation of the A/D converter is controlled by these special function registers: ADCON0 and ADCON1. The lower bits of the converter are stored in ADRESL (8 bits), and the upper bits are stored in the ADRESH register. It requires an analog reference voltage of 5V for its operation.

5. Oscillators

Oscillators are used for timing generation. PIC microcontrollers consist of external oscillators like crystals or RC oscillators. In case of crystal oscillators, the crystal is connected between two oscillator pins, and the value of the capacitor connected to each pin determines the mode of operation of the oscillator. The different modes are low-power mode, crystal mode and the high- speed mode. In case of RC oscillators, the value of the Resistor and Capacitor determine the clock frequency. The clock frequency ranges from 30 KHz to 4 MHz.

6. CCP module:

A CCP module works in the following three modes:

Capture Mode: This mode captures the time of arrival of a signal, or in other words, captures the value of the Timer1 when the CCP pin goes high.

Compare Mode: It acts as an analog comparator that generates an output when the timer1 value reaches a certain reference value.

PWM Mode: It provides pulse width modulated output with a 10-bit resolution and programmable duty cycle.

Other special peripherals include a Watchdog timer that resets the microcontroller in case of any software malfunction and a Brown out reset that resets the microcontroller in case of any power fluctuation and others. For better understanding of this PIC microcontroller we are giving one practical project which uses this controller for its operation.

Street Light that Glows on Detecting Vehicle Movement

This LED street light control project is designed to detect the vehicle movement on highway to switch on a block of street lights ahead of it, and to switch off the trailing lights to save energy. In this project, a PIC microcontroller programming is done by using embedded C or assembly language.

The power supply circuit gives the power to a whole circuit by stepping down, rectifying, filtering and regulating AC mains supply. When there are no vehicles on highway, all the lights remain off so that the power can be saved. The IR Sensors are placed on either side of the road as they sense vehicles’ movement and in turn send the commands to the microcontroller to switch on or off the LEDs. A block of LEDs will be on when a vehicle approaches near it and once the vehicle passes away from this route, the intensity becomes low or completely switched off.

The PIC microcontroller projects can be used in different applications, such as video games’ peripherals, audio accessories, etc. Apart from this, for any help regarding any projects, you can contact us by commenting in the comment section.