Tuesday, January 13, 2015

Introduction to PIC Controller

Introduction to PIC Controller

Here, It is assumed that user knows basic difference between a micro-processsor and a micro-controller.If not, then google here .
Because we strictly focused on PIC controller in this tutorial.
Reference
PIC MCU =  PIC18F**8, here 8 means 8-bit mcu.(This tutorial can be used for any PIC18 mcu)
Embedded C for PIC18
Our main motive is to explain PIC Controller and its Programming language. with hands on projects using comilers and simulators.
So, Be Excite to Learn 

Features of PIC18F
  • Three external interrupt pins
  • 16-bit wide instructions, 8-bit wide data path
  • Priority levels for interrupts
  • Timer0module: 8-bit/16-bit timer/counter with 8-bit programmable prescaler
  • Timer1module: 16-bit timer/counter
  • Timer2module: 8-bit timer/counter with 8-bit period register (time base for PWM)
  • Timer3module: 16-bit timer/counter
  • Secondary oscillator clock option – Timer1/Timer3
  • Capture/Compare/PWM (CCP) modules
  • 10-bit, up to 8-channel Analog-to-Digital Converter module (A/D) with:
         - Conversion available during Sleep
         - Up to 8 channels available
  • Programmable Brown-out Reset (BOR)
  • Power-on Reset (POR)
  • Power-up Timer (PWRT) and 
  • Oscillator Start-up Timer (OST)
  • Watchdog Timer (WDT) with its own on-chip RC oscillator
  • In-Circuit Serial ProgrammingTM (ICSPTM) via two pins
  • Low-power, high-speed Enhanced Flash technology
  • The famous W Register for PIC familiy









   Pin Diagram for PIC18F448/458
PIN DIAGRAM
                                                  Pin Diagram for PIC18F248/258
What is a PIC Microcontroller?
A PIC microcontroller is a single integrated circuit small enough to fit in the palm of a hand. ‘Traditional’ microprocessor circuits contain four or five separate integrated circuits - the microprocessor (CPU) itself, an EPROM program memory chip, some RAM memory and an input/output interface. With PIC microcontrollers all these functions are included within one single package, making them cost effective and easy to use.

PIC microcontrollers can be used as the ‘brain’ to control a large variety of products. In order to control devices, it is necessary to interface (or ‘connect’) them to the PIC microcontroller. This section will help to enable those with limited electronics experience to successfully complete these interfacing tasks.

Criteria for choosing a microcontroller
1.The first and foremost criterion in choosing a microcontroller is that it must meet the task at hand efficiently and cost effectively. In analyzing the needs of a microcontroller-based project, we must first see whether an 8-bit, 16-bit, or 32-bit microcontroller can best handle the computing needs of the task most effectively.

Among other considerations in this category are:
(a) Speed. What is the highest speed that the microcontroller supports?
(b) Packaging. Does it come in a 40-pin DIP (dual inline package) or a QFP(quad flat package), or   some other packaging format? This is important in terms of space, assembling, and proto typing the   end product.
(c) Power consumption. This is especially critical for battery-powered products.
(d) The amount of RAM and ROM on the chip.
(e) The number of I/0 pins and the timer on the chip.
(f) Ease of upgrade to higher-performance or lower-power-consumption verSIOns.
(g) Cost per unit. This is important in terms of the final cost of the product in which a microcontroller is used. For example, some microcontrollers cost 50 cents per unit when purchased 100,000 units at a time.

2. The second criterion in choosing a microcontroller is how easy it is to develop products around it. Key considerations include the availability of an assembler, debugger, a code-efficient C language compiler, emulator, technical support, and both in-house and outside expertise. In many cases, third-party vendor (i.e., a supplier other than the chip manufacturer) support for the chip is as good as, if not better than, support from the chip manufacturer.

3. The third criterion in choosing a microcontroller is its ready availability in needed quantities both now and in the future. For some designers this is even more important than the first two criteria. Currently, of the leading 8-bit microcontrollers, the 8051 family has the largest number of diversified (multiple source) suppliers. (Supplier means a producer besides the originator of the microcontroller.) In the case of the 8051, which was originated by Intel, several companies also currently produce (or have produced in the past) the 8051.

PIC microcontroller I/O pins
The PIC 18 can have from 16 to 72 pins dedicated for I/O. The number of I/O pins depends on the number of pins in the package itself. The number of pins for the PIC18 package goes from 18 to 80 at this time. In the case of the 18-pin PIC18Fl220, we have 16 pins for I/O, while in the case of the 80-pin PIC18F8722, we can use up to 72 pins for I/O.

PIC MICROCONTROLLER PERIPHERALS
All the members of the PIC18 family come with ADC (analog-to-digital converter), timers, and USART (Universal Synchronous Asynchronous Receiver Transmitter) as standard peripherals.The PIC 18 can have up to 4 timers besides the watchdog timer.The USART peripheral allows us to connect the PIC 18-based system to serial ports such as the COM port of the IBM PC.

THE WREG REGISTER IN THE PIC
PIC microcontrollers have many registers for arithmetic and logic operations. Among them is the WREG register. Because there are a large number of registers inside the PIC, we will concentrate on the widely used register WREG in this section. General-purpose registers are covered in the next section, as well as special function registers. In this section we examine the WREG register of the PIC and show its use with the simple instructions MOVE and ADD.

In the next chapters, all device features will be explained in brief.

References for this tutorial may be taken from:
1.www.mickroe.com
2.PIC18F datasheet from Micro-Chip

Note:These tutorials are only for educational purpose.







No comments: