Actions

EmSys

TM4C123 Generating Square waves using PWM generators

From EdWiki

Revision as of 02:41, 23 March 2018 by Jshankar (Talk | contribs) (Created page with "== Generating Square waves using PWM generators == In TI Tiva LaunchPad, each of the Generator has two Compare registers. They are called PWMxCMPA (PWMx Compare A) and PWMxCMP...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Generating Square waves using PWM generators

In TI Tiva LaunchPad, each of the Generator has two Compare registers. They are called PWMxCMPA (PWMx Compare A) and PWMxCMPB (PWMx Compare B). As the Counter counts down (or up), its value is compared with the PWMxCMPx register and upon a match, a PWM output pin will do one of the following:

  1. do nothing,
  2. toggle,
  3. driven HIGH,
  4. driven LOW

These output actions are not limited to the compare register, you may choose one of these actions when the counter reaches zero and when the counter reloads. The selections of these actions are made in the PWM generator (PWMxGENx) register. Each register is associated with an output pin and has six actions you may specify:

  1. action when the counter matches comparator B while counting down.
  2. action when the counter matches comparator B while counting up.
  3. action when the counter matches comparator A while counting down.
  4. action when the counter matches comparator A while counting up.
  5. action when the counter is reloaded.
  6. action when the counter reaches zero.


Tm4c pwm events in ti tiva.png
Figure 15.41: PWM Events in TI TIVA

These options allow us to generate some elaborate output waveforms. Each wave generator has 2 outputs: PwmA and PwmB; Using PWMxGENA and PWMxGENB registers the action of the outputs are chosen as was shown in Figure 15-24. The details of PWMxGENx register is shown in Figure 15.32. Each event may cause an action specified by two bits.