Using CCP to measure Pulse Period and PWM

________________________Updated 04/03/2019 _________________________________

Purpose: The purpose of this lab is to learn how to use timer modules and utilize CCP to measure an incoming clock's frequency. This lab contains the following parts:

  1. TMR0
  2. CCP1 Module

Optional Parts Required:

Useful Links:

Procedure:

Part I - Use TMR0 to generate a 1KHz clock.

Purpose: In this section you learn how to use TMR0 to generate a 1 KHz signal. Make sure the MAIN part of the program is very clear and simple. You need to use a scope to make sure the clock frequency is correct. You MUST use TMR0 module. Answer the following questions:

  1. What is the frequency of the internal clock? How do you know? Take a snapshot of Fosc or Fosc/4.
  2. Take a snapshot of the generated 1KHz clock. Use the measuring tool on the scope to calculate the signal frequency. Use the cursors on the scope to verify the period.
  3. What value did you load into the timer in order to generate the 1 KHz clock. Show your calculations.
  4. Using the loaded value in the TMR0 , what is the difference between the measured and calculated period?
  5. Which pin are you using to generate the clock signal?

Part II - Use CCP module to measure period of an incoming 1KHz+/-500 Hz.

Purpose: In this section you learn how to use the CCP module in capture mode. This assignment has two parts (the second part is extra credit)- review the slides and read the textbook (Chapter 9):

Submit the following:

  1. Complate report as before.
  2. Test results. How do you verify your measurements are correct. You must clearly explain and support your answers with test results.

Answer the following questions:

  1. Which pin are you using to receive the incoming signal?
  2. Take a snapshot of the incoming signal. You can use a signal generator or your clock signal from Part I of this exercise.
  3. How accurately can you determine the frequency of the incoming signal?
  4. What happens if the frequency of the signal changes?

ALL SECTIONS MUST BE DEMONSTRATED IN CLASS -