InputCaptureInt

Readme
 
This is a C language project that demonstrates input capture interrupts used to measure period. An interrupt is invoked on the rising edge of PA12. The counter of TimerG0 is latched. Period is calculated as the time difference between two interrupts. The period measurement resolution is determined by the period of the selected clock and prescale on TimerG0. The precision of the measurement is determined by the number of bits in the counter, which in this case is 16 bits. The maximum period that can be measured is 65535*resolution. This project does not check for period too long. The MFCLK option has not been tested. Build, debug, run the project.
 
In the following figure, the rising edge of PA12 triggers the input capture interrupt. Notice the period of PA12 is 10ms. In this example, the resolution is 1us, and the calculated Period will be 10000.

Derived from Texas Instrument code

  • gpio_input_capture_LP_MSPM0G3507_nortos_ticlang
  • gpio_toggle_output_LP_MSPM0G3507_nortos_ticlang

Hardware Required

  • MSPM0G3507 LaunchPad™ Development Kit (LP-MSPM0G3507)
Pin assignments
  • Output: PB27 is a simple digital output wave, created by the main program
  • Input: PA12 is the input capture input, from which period is measured
LaunchPad Connections
  • Connect PB27 output to PA12 input

Simplified BSD License (FreeBSD License) Copyright © 2024, Jonathan Valvano, All rights reserved.
 
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
The views and conclusions contained in the software and documentation are those of the authors and should not be interpreted as representing official policies, either expressed or implied, of the FreeBSD Project.
 

For more information, see http://users.ece.utexas.edu/~valvano/.