STMicroelectronics AN590 Application Note PWM Generation with ST62 Auto-reload Timer

This application note describes how to use the ST62 Auto-reload Timer (ARTimer) to generate a PWM signal with tunable frequency and duty cycle. As an example, the generation of a 31.25kHz PWM signal with duty cycle proportional to an analog input voltage is presented.


STMicroelectronics AN590 Application Note PWM Generation with ST62 Auto-reload Timer - cover page
Brand
STMicroelectronics
Category
microcontrollers
Document type
Application Note
Language
English
Pages
7
File format
PDF
File size
126 KB
Published
07 August, 2012
Updated
30 September, 2023
Model
ST62
MD5 checksum
3099F3F4F06BD618CFA80C38B854DFC7

About this manual

The document explains the features of the ST62 Auto-reload Timer, an 8-bit timer/counter with prescaler that supports auto-reload PWM generation. It details how to configure registers such as Mode Control (MC), Status (SCO, SC1), Load (LR), Incremental Counter (TC), Compare (CP), and Reload/Capture (RC) to control the output.

What's inside

  • Introduction
  • Auto-reload Timer description
  • PWM Generation
  • Major formulae for PWM generation
  • Prescaler Programming Ratio
  • Example 1: Generate a 12kHz PWM signal
  • Program example (Example 1)
  • Example 2: Duty cycle proportional to analog voltage
  • Calculation of the loop length

Specifications

Timer type8 bit timer/counter with prescaler
PWM frequency rangeup to 100kHz
Resolution (max)1/256
Resolution (alt)1/64

Frequently asked questions

How is the PWM frequency calculated?

The PWM frequency (Few) is calculated by dividing the timer input frequency (Fin) by (256 - RC).

How is the duty cycle defined?

The duty cycle is defined by the Compare register CP relative to the Reload register RC and 255.

What prescaler ratio yields a frequency of 125kHz with an 8MHz oscillator?

A resolution of 1/64 is required, which corresponds to a specific prescaler setting.

Download PDF (126 KB)

More STMicroelectronics Manuals


View all STMicroelectronics manuals →