Become a subscriber (Free)

Join 29,000 other subscribers to receive subscriber sale discounts and other free resources.
:
:
Don't worry -- your e-mail address is totally secure. I promise to use it only to send you MicroZine.

Beginners guide to the PIC Microcontroller

Part 4 : 

Overview of Internal Peripherals:

USART, CCP, Analogue Comparator. MSSP

USART

The Universal Synchronous Asynchronous Receiver Transmitter.

You can make a software USART and even operate one on a 16F84  (it does not have a built in USART) but it saves code space if you use an internal module e.g. on a 16F88 or 16F877(A).

As well as this the module can be started and left to get on with transmitting the data on its own so the microcontroller CPU can get on with doing some other useful task.

As with the timers you can operate the USART in polled or interrupt mode and again the polled mode is easier but the interrupt mode saves processing power.

Asynchronous mode

This is the mode that you need to use for communication with standard RS232 interfaces on PC - it is the normal mode of use for RS232.

All you need to make it work is a transceiver that translates the high voltages required by the RS232 interface from/to digital voltage levels e.g. a MAX232 chip.



Synchronous mode

This is a mode of the USART that uses an extra signal - a clock to clock in all data.  It allows very fast operation as the USART does not have to figure out an estimated clock signal position to find the data.

CCP

Capture Compare PWM

This module - CCP - operates in one of three modes:

*Capture.
*Compare.
*Pulse Width Modulation.

You will probably find that the PWM mode is the most useful out of the three but that depends on the task you want to solve.

PWM

PWM has many uses from controlling the speed of a DC motor to generating an analogue signal or controlling the brightness of a bulb.

The basic principle is that the output is fully on or off but by varying the percentage of time that the output is on then the average current delivered to the load can be controlled.

Capture

You can use Capture mode to capture the time that an event occurs.

When an external event occurs e.g. a signal transition from low to high the value of both Timer1 registers is stored in the CCP registers.  

You can then go and look at these stored values to find out when the event occurred.

Compare

This mode compares the Timer1 value to the CCP value and generates an output signal when a match occurs so you can generate an output at a specific time.

One internal use of this mode is to send a 'special event trigger signal' to start an ADC conversion - this would be useful in a datalogger.


Comparator

The analogue comparator is an underused peripheral but it is just as capable as the standalone comparator the LM311 (and just as fast).

The advantage of this module is that it generates an interrupt and you can also feed in a separate comparison voltage generated internally in the PIC.  This comparison voltage is generated by a DAC and is programmable.

Some PICs have two comparators in them and the other advantage is that they operate much faster than using a software solution so using them saves processing power.

For example you could build a line follower robot with two sensors using two comparators.  

If you replace those comparators with the internal PIC comparators you could then add software functionality to make the robot more intelligent.

MSSP,SSP

Another module that deserves a mention is the Master Slave Synchronous Serial port.  

Its implements two high speed serial interfaces I2C or SPI.

SPI

Serial Peripheral Inteface.

You can buy SPI chips which have many different fuinctions from ADCs to increasing I/O space.  SPI is a simpler interface than I2C and runs at very high speed 10MHz.

I2C

I2C is more complicated but more flexible and you can use it as a multidrop interface using only two wires - you can attach up to 128 chips on the two wires.  So it's very useful for for adding functions to a design when you have run out of microcontroller pins!

Again you can buy many different chips with many different functions.

Note: the MSSP implements a full I2C interface while the SSP does not.

Control your projects using C.

Next time...

...Programming the microcontroller.

New! Comments

Have your say about what you just read! Leave me a comment in the box below.



Claim Your: Useful

"Arduino Software Guide"

   Right Now...





Privacy Policy | Contact | About Me

Site Map | Terms of Use



Visit our Facebook Page:

   Click Here



Sign up for MicroZine
''The'' Microcontroller Newsletter

Enter your first Name and primary email address in the form below:


And receive absolutely FREE a full project for:

"Measuring Analogue Voltages
Without An ADC"

(Using only one pin).

Instant Download:
You Can
Get It Right Now

Warning: This project could be  Removed 
at any time.  

It will  NOT be 
available indefinitely SO
To avoid 
disappointment  get it:

Now



:
:
Don't worry -- your e-mail address is totally secure. I promise to use it only to send you MicroZine
Remember this is a project with full description and fully debugged C Source code - and it's not available from the main website.

You can only get it through this newsletter.

To get exclusive access Enter your first name Name and primary email address Now in the form above.:



But wait !

There's more...

You'll receive more
free and exclusive reports as well as site information and site product updates


Scroll up to the form above and sign up NOW. Don't forget it's FREE and if you don't like it, you can unsubscribe at any time.

Click Here Now to use the form above to get your Valuable information absolutely free.



Readers Comments

"I wanted to thank
you so so so much
for all the information
you have provided in
your site it's

SUPERB and FANTASTIC."

- Ranish Pottath

"This site really is
the best and my favorite.
I find here many useful
projects and tips."

- Milan

bursach<at>gmail.com<

"Awesome site,
very, very easy and nice
to navigate!"


- Matt
matt_tr<at>
wolf359.cjb.net


Learn Microcontrollers

"Interested in
Microcontrollers?"

Sign up for The
Free 7 day guide:

FREE GUIDE : CLICK HERE


"I am a newbie to PIC
and I wanted to say
 how great your
site has been for me."


- Dave

de_scott<at>bellsouth.net

"Your site is a great
and perfect work.
congratulations."


- Suresh

integratredinfosys<at>
yahoo.com

"I couldn't find the correct
words to define
yourweb site.

Very useful, uncovered,
honest and clear.

Thanks so much for
your time and works.
Regards."


- Anon

Recent Articles

  1. How to use the DHT22 (or DHT11) with an Arduino; full code and description. Also including a comparison of the DHT11 vs DHT22.

    The Essential Guide to the DHT22/11 humidity sensor including a library code guide for the Arduino. Learn how to determine Humidity, Dew point and Heat Index.

    Read more

  2. How to Use the MAX7219 to drive an 8x8 LED display Matrix on the Arduino.

    The Essential Guide to the MAX7219; What it is and how you can easily use one in any of your projects.

    Read more

  3. How to use a DS18B20 (single or multiple on one wire) for temperature measurement using the Arduino Uno.

    How to Easily Use the DS18B20 Maxim One-Wire thermometer with Arduino example code showing external or parasitic power modes.

    Read more