Embedded Systems & Firmware
What is the input capture function of a microcontroller timer used for?
- ATo capture and save a screen image
- BTo record the counter value at the instant an input signal changes, precisely measuring pulse width or frequency
- CTo output a PWM signal from a pin
Show answer and explanation
Answer: B. To record the counter value at the instant an input signal changes, precisely measuring pulse width or frequency
With input capture, hardware copies the timer counter into a register at the instant the input signal rises or falls. The difference between two captured values gives the pulse width or period. Reading the time in software after an interrupt adds error from processing delays, but this method measures precisely regardless of them. It is used with rotation sensors, ultrasonic rangefinders and the like.
- A. It has nothing to do with images.
- B. Correct. Hardware records the value at that instant.
- C. PWM output is done by output compare and similar functions.