Timer

This post describes the timers of MCU.

Count function

Timer count function of MCU divides the crystal oscillator clock by prescaler and supplies it to the timer for counting. Other than crystal oscillators, there are also timers that count signals from sensors.

Count type

Free-running typeFree- running type counts up to the maximum value of the timer bit length and then repeats back to zero.
Count-up typeCount-up type counts up to the compare value and repeats back to zero after a match with the compare value.
Count-down typeCount-down type starts down-counting after setting the set value in the timer, and repeats returning to the set value when it reaches zero.

Input/Output

Here are some examples of timer inputs and outputs. As shown in the table below, timer inputs/outputs are external to the microcontroller and internal to the microcontroller, and various functions can be realized in conjunction with other microcontroller functions.

MCUIOFunctionDescription
External InputSignal time measurement(STM)Rising or falling edge of input signal, time measurement of both edges.
Signal pulse measurement(SPM)Falling or falling edge of input signal, measuring the number of edges on both edges.
OutputPulse width modulation(PWM)Output with fixed output signal cycle and variable Hi/Low time or duty (Hi time/cycle).
PWM also includes 2-phase PWM for 2-phase modulation and 3-phase PWM for 3-phase modulation.
One-shot pulse output(OSP)Pulse output with set Hi or Low time for output signal.
One-shot pulse output also includes event-triggered output one-shot pulse output.
InternalInputTrigger measurement(TRG)Time measurement from program triggers such as Timeout and Wait.
OutputCycle output(CYC)Cycle event output to Thread (Task), ADC, communication, etc.

Measured and output waveforms of timers

Examples of timer measurement waveforms and output waveforms are shown below.

OSS-ECAL English
error: Content is protected !!