Generate PWM pulses using the PCA function of SST microcontroller

Publisher:闪耀之星Latest update time:2012-08-01 Source: 21ic Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

1. Program Description:

SST microcontroller has 5-channel PCA module. PCA function provides stronger timing than ordinary microcontrollers, and less CPU intervention. It can reduce software overhead and improve accuracy. PCA pulse width modulation (PWM) mode can generate an 8-bit PWM, which is generated by comparing the low bit (CL) of the PCA timer and the low bit (CCAPnL) of the compare register. When CL=CCAPnL, the output is high. To enter this mode, you can set the PWM and ECOM bits of CCAPMn.

In PWM mode, the frequency of the output is determined by the source of the PCA timer. Since there is only one pair of CH and CL registers, all modules share the PCA timer and frequency. The duty cycle of the output is controlled by the value loaded into the high bit CCAPnH. Since writing to the CCAPnH register is not synchronous, the value written to the high bit will not be immediately loaded into CCAPnL for comparison until another cycle of the output (when CL flips from 255 to 0). Use the following formula to calculate any duty cycle CCAPnH value:

CCAPnH=256 (1-duty cycle)

CCAPnH is an 8-bit integer and the duty cycle is a fraction.

Pulse Width Modulation Frequency

16.jpg

2. Introduction to related registers:

PCA Timer/Counter Mode Register (CMOD)

17.jpg

Flag function

CIDL counter idle control, when CIDL=0, PCA continues to work in idle mode. When CIDL=1, PCA shuts down in idle mode.

WDTE Watchdog timer enable: When WDTE=0, the watchdog function of PCA module 4 is disabled. When WDTE=1, it is enabled.

CPS1 PCA count pulse width selection bit 1

CPS0 PCA count pulse width selection bit 0

18.jpg

Reference address:Generate PWM pulses using the PCA function of SST microcontroller

Previous article:Design of AC induction motor drive circuit based on Renesas microcontroller
Next article:The basic structure of a single chip microcomputer

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号