mirror of
https://gitee.com/Vancouver2017/luban-lite-t3e-pro.git
synced 2025-12-14 10:28:54 +00:00
268 lines
33 KiB
HTML
268 lines
33 KiB
HTML
<!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh-cn" lang="zh-cn" data-whc_version="26.0">
|
||
<head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><meta name="description" content="表 1 . 术语定义 术语/缩略语 定义及说明 PWM Pulse-Width Modulation,脉冲宽度控制,简称脉宽调制 EPWM Enhanced Pulse-Width Modulation, 增强型脉冲宽度控制( Luban-Lite 中 EPWM 功能与 PWM 相同,如无特殊说明,两者通用) TBC Time Base Counter,时基计数器,用于产生锯齿波 占空比 PWM ..."/><meta name="DC.rights.owner" content="(C) 版权 2025"/><meta name="copyright" content="(C) 版权 2025"/><meta name="generator" content="DITA-OT"/><meta name="DC.type" content="topic"/><meta name="DC.contributor" content="yan.wang"/><meta name="DC.date.modified" content="2024-12-02"/><meta name="DC.format" content="HTML5"/><meta name="DC.identifier" content="id"/><meta name="DC.language" content="zh-CN"/><title>PWM 使用指南</title><!-- Build number 2023110923. --><meta name="wh-path2root" content="../../../"/><meta name="wh-toc-id" content=""/><meta name="wh-source-relpath" content="topics/sdk/pwm/pwm_user_guide.dita"/><meta name="wh-out-relpath" content="topics/sdk/pwm/pwm_user_guide.html"/>
|
||
|
||
<link rel="stylesheet" type="text/css" href="../../../webhelp/app/commons.css?buildId=2023110923"/>
|
||
<link rel="stylesheet" type="text/css" href="../../../webhelp/app/topic.css?buildId=2023110923"/>
|
||
|
||
<script src="../../../webhelp/app/options/properties.js?buildId=20250121171154"></script>
|
||
<script src="../../../webhelp/app/localization/strings.js?buildId=2023110923"></script>
|
||
<script src="../../../webhelp/app/search/index/keywords.js?buildId=20250121171154"></script>
|
||
<script defer="defer" src="../../../webhelp/app/commons.js?buildId=2023110923"></script>
|
||
<script defer="defer" src="../../../webhelp/app/topic.js?buildId=2023110923"></script>
|
||
<link rel="stylesheet" type="text/css" href="../../../webhelp/template/aic-styles-web.css?buildId=2023110923"/><link rel="stylesheet" type="text/css" href="../../../webhelp/template/notes.css?buildId=2023110923"/><link rel="stylesheet" type="text/css" href="../../../webhelp/template/aic-common.css?buildId=2023110923"/><link rel="stylesheet" type="text/css" href="../../../webhelp/template/aic-images.css?buildId=2023110923"/><link rel="stylesheet" type="text/css" href="../../../webhelp/template/footnote.css?buildId=2023110923"/><link rel="stylesheet" type="text/css" href="../../../webhelp/template/aic-web-watermark.css?buildId=2023110923"/><link rel="stylesheet" type="text/css" href="../../../webhelp/template/topic-body-list.css?buildId=2023110923"/></head>
|
||
|
||
<body id="id" class="wh_topic_page frmBody">
|
||
<a href="#wh_topic_body" class="sr-only sr-only-focusable">
|
||
跳转到主要内容
|
||
</a>
|
||
|
||
|
||
|
||
|
||
<header class="navbar navbar-default wh_header">
|
||
<div class="container-fluid">
|
||
<div class="wh_header_flex_container navbar-nav navbar-expand-md navbar-dark">
|
||
<div class="wh_logo_and_publication_title_container">
|
||
<div class="wh_logo_and_publication_title">
|
||
|
||
<a href="http://www.artinchip.com" class=" wh_logo d-none d-sm-block "><img src="../../../company-logo-white.png" alt="RTOS SDK 使用指南SDK 指南文件"/></a>
|
||
<div class=" wh_publication_title "><a href="../../../index.html"><span class="booktitle"><span class="ph mainbooktitle">RTOS SDK 使用指南</span><span class="ph booktitlealt">SDK 指南文件</span></span></a></div>
|
||
|
||
</div>
|
||
|
||
|
||
</div>
|
||
|
||
<div class="wh_top_menu_and_indexterms_link collapse navbar-collapse" id="wh_top_menu_and_indexterms_link">
|
||
|
||
|
||
|
||
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</header>
|
||
|
||
|
||
|
||
|
||
<div class=" wh_search_input navbar-form wh_topic_page_search search " role="form">
|
||
|
||
|
||
|
||
<form id="searchForm" method="get" role="search" action="../../../search.html"><div><input type="search" placeholder="搜索 " class="wh_search_textfield" id="textToSearch" name="searchQuery" aria-label="搜索查询" required="required"/><button type="submit" class="wh_search_button" aria-label="搜索"><span class="search_input_text">搜索</span></button></div></form>
|
||
|
||
|
||
|
||
</div>
|
||
|
||
<div class="container-fluid" id="wh_topic_container">
|
||
<div class="row">
|
||
|
||
<nav class="wh_tools d-print-none navbar-expand-md" aria-label="Tools">
|
||
|
||
<div data-tooltip-position="bottom" class=" wh_breadcrumb "></div>
|
||
|
||
|
||
|
||
<div class="wh_right_tools">
|
||
<button class="wh_hide_highlight" aria-label="切换搜索突出显示" title="切换搜索突出显示"></button>
|
||
<button class="webhelp_expand_collapse_sections" data-next-state="collapsed" aria-label="折叠截面" title="折叠截面"></button>
|
||
|
||
|
||
|
||
|
||
<div class=" wh_print_link print d-none d-md-inline-block "><button onClick="window.print()" title="打印此页" aria-label="打印此页"></button></div>
|
||
|
||
|
||
</div>
|
||
|
||
</nav>
|
||
</div>
|
||
|
||
|
||
|
||
|
||
<div class="wh_content_area">
|
||
<div class="row">
|
||
|
||
|
||
<div class="col-lg-10 col-md-10 col-sm-10 col-xs-12" id="wh_topic_body">
|
||
|
||
<button id="wh_close_topic_toc_button" class="close-toc-button d-none" aria-label="Toggle topic table of content" aria-controls="wh_topic_toc" aria-expanded="true">
|
||
<span class="close-toc-icon-container">
|
||
<span class="close-toc-icon"></span>
|
||
</span>
|
||
</button>
|
||
|
||
<div class=" wh_topic_content body "><main role="main"><article class="- topic/topic topic" role="article" aria-labelledby="ariaid-title1"><span class="edit-link" style="font-size:12px; opacity:0.6; text-align:right; vertical-align:middle"><a target="_blank" href="http://172.16.35.88/tasks/jdssno1uvvbf2mltu9kb9v3if05d5gopuakboe8hlud18rma/edit/F:/aicdita/aicdita-cn/topics/sdk/pwm/pwm_user_guide.dita">Edit online</a></span><h1 class="- topic/title title topictitle1" id="ariaid-title1">PWM 使用指南</h1><div class="date inPage">2 Dec 2024</div><div style="color: gray;">
|
||
Read time: 3 minute(s)
|
||
</div><div class="- topic/body body"><div class="table-container"><table class="- topic/table table frame-all" id="id__table_aw1_yh3_fdc" data-ofbid="id__table_aw1_yh3_fdc" data-cols="2"><caption class="- topic/title title tablecap" data-caption-side="top" data-is-repeated="true"><span class="table--title-label">表<span class="table--title-label-number"> 1</span><span class="table--title-label-punctuation">. </span></span><span class="table--title">术语定义</span></caption><colgroup><col/><col/></colgroup><thead class="- topic/thead thead"><tr class="- topic/row"><th class="- topic/entry entry colsep-1 rowsep-1" id="id__table_aw1_yh3_fdc__entry__1">术语/缩略语</th><th class="- topic/entry entry colsep-0 rowsep-1" id="id__table_aw1_yh3_fdc__entry__2">定义及说明</th></tr></thead><tbody class="- topic/tbody tbody"><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="id__table_aw1_yh3_fdc__entry__1">PWM</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="id__table_aw1_yh3_fdc__entry__2">Pulse-Width Modulation,脉冲宽度控制,简称脉宽调制</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="id__table_aw1_yh3_fdc__entry__1">EPWM</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="id__table_aw1_yh3_fdc__entry__2">Enhanced Pulse-Width Modulation, 增强型脉冲宽度控制(<span class="- topic/ph ph">Luban-Lite</span> 中
|
||
EPWM 功能与 PWM 相同,如无特殊说明,两者通用)</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="id__table_aw1_yh3_fdc__entry__1">TBC</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="id__table_aw1_yh3_fdc__entry__2">Time Base Counter,时基计数器,用于产生锯齿波</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="id__table_aw1_yh3_fdc__entry__1">占空比</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="id__table_aw1_yh3_fdc__entry__2">PWM 信号中,高电平保持的时间 与 该 PWM 时钟周期的时间之比</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="id__table_aw1_yh3_fdc__entry__1">分辨率</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="id__table_aw1_yh3_fdc__entry__2">占空比最小能达到多少,如 8 位的 PWM 理论分辨率是 1:255</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="id__table_aw1_yh3_fdc__entry__1">Up Count</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="id__table_aw1_yh3_fdc__entry__2">增模式, 计数方式是递增计数,如从 0 计数到 80、之后又从 0 到 80(波形是锯齿波)</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="id__table_aw1_yh3_fdc__entry__1">Down Count</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="id__table_aw1_yh3_fdc__entry__2">减模式, 计数方式是递减计数,如从 80 计数到 0、之后又从 80 到 0(波形是锯齿波)</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="id__table_aw1_yh3_fdc__entry__1">单斜率</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="id__table_aw1_yh3_fdc__entry__2">单个方向的计数,增模式、减模式都属于单斜率</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="id__table_aw1_yh3_fdc__entry__1">Up&Down Count</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="id__table_aw1_yh3_fdc__entry__2">
|
||
<div class="- topic/div div">
|
||
<div class="- topic/div div"> 增减模式,计数方向有两个,如从 0 计数到 80、然后从 80 到 0(波形是三角波),</div>
|
||
<div class="- topic/div div"> 增、减两个过程合起来算一个周期</div>
|
||
</div>
|
||
</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-0" headers="id__table_aw1_yh3_fdc__entry__1">双斜率</td><td class="- topic/entry entry colsep-0 rowsep-0" headers="id__table_aw1_yh3_fdc__entry__2">两个方向的计数,增减模式属于双斜率</td></tr></tbody></table></div><section class="- topic/section section" id="id__section_w5l_rwn_4dc" data-ofbid="id__section_w5l_rwn_4dc"><h2 class="- topic/title title sectiontitle">PWM 工作原理</h2>
|
||
|
||
<ul class="- topic/ul ul" id="id__ul_kdh_twn_4dc" data-ofbid="id__ul_kdh_twn_4dc"><li class="- topic/li li" data-ofbid="d252320e99__20250121171704">
|
||
<div class="- topic/div div section" id="id__id3">
|
||
<strong class="+ topic/ph hi-d/b ph b">PWM 信号</strong>
|
||
<p class="- topic/p p" data-ofbid="d252320e106__20250121171704"> PWM 信号通常由一列占空比不同的矩形脉冲构成,其占空比可以调节。用数字输出来控制 PWM
|
||
占空比,占空比提高意味着高电平脉宽增大,输出的能量就会增加,PWM 就相当于一个 <strong class="+ topic/ph hi-d/b ph b">功率版的 DA 转换模块</strong>。下图是一个典型的
|
||
PWM 信号波形:</p><figure class="- topic/fig fig fignone" id="id__id8" data-ofbid="id__id8"><br/><div class="imagecenter"><img class="- topic/image image imagecenter" id="id__image_vwl_rwn_4dc" src="../../../images/pwm/pwm_wave.png" width="384" alt="pwm_wave1"/></div><br/><figcaption data-caption-side="bottom" class="- topic/title title figcapcenter"><span class="figtitleprefix fig--title-label">图<span class="fig--title-label-number"> 1</span><span class="fig--title-label-punctuation">. </span></span><span class="fig--title">典型的 PWM 信号波形</span></figcaption></figure><p class="- topic/p p" data-ofbid="d252320e117__20250121171704">占空比的计算方法: <code class="+ topic/ph pr-d/codeph ph codeph">占空比=(脉宽时间/周期)*100%</code></p><p class="- topic/p p" data-ofbid="d252320e121__20250121171704">结合上图,我们可以说:
|
||
脉宽时间 1 相比 脉宽时间 2 提供较小的占空比。</p><p class="- topic/p p" data-ofbid="d252320e123__20250121171704"> PWM 通常用于背光亮度调节、电机控制、舵机控制等。本文仅限于 PWM
|
||
调节背光的功能,通过调节 PWM 中的占空比,达到控制 LED 背光电流的通和断,进而可调整背光亮度。</p></div>
|
||
</li><li class="- topic/li li" data-ofbid="d252320e126__20250121171704">
|
||
<div class="- topic/div div section" id="id__id4">
|
||
<strong class="+ topic/ph hi-d/b ph b">增模式</strong>
|
||
<p class="- topic/p p" data-ofbid="d252320e133__20250121171704"> 为了灵活调节 PWM
|
||
信号的占空比,要先想办法产生一个递增、或者递减的锯齿波信号,另外再结合一个比较器来跟一个阈值进行比较,当满足条件时进行电平反转,这样达到的效果就是通过调节“阈值”来调节了占空比。</p><p class="- topic/p p" data-ofbid="d252320e135__20250121171704">下图是由一个
|
||
<strong class="+ topic/ph hi-d/b ph b">递增变化</strong> 的锯齿波产生 PWM 信号的过程:</p><figure class="- topic/fig fig fignone" id="id__id9" data-ofbid="id__id9"><br/><div class="imagecenter"><img class="- topic/image image imagecenter" id="id__image_wwl_rwn_4dc" src="../../../images/pwm/generate_pwm_up.png" alt="generate_pwm_up"/></div><br/><figcaption data-caption-side="bottom" class="- topic/title title figcapcenter"><span class="figtitleprefix fig--title-label">图<span class="fig--title-label-number"> 2</span><span class="fig--title-label-punctuation">. </span></span><span class="fig--title">由增模式锯齿波产生 PWM 信号的过程示意图</span></figcaption></figure>
|
||
<p class="- topic/p p" data-ofbid="d252320e147__20250121171704">图中 Tpwm 表示 PWM 信号的周期值,另外有 <strong class="+ topic/ph hi-d/b ph b">三个关键的时间点(下文简称关键时点)</strong>
|
||
(标注橙色圆圈,为了简洁只标注了最后一个周期)在下文中会频繁使用:</p><ul class="- topic/ul ul simple" id="id__ul_xwl_rwn_4dc" data-ofbid="id__ul_xwl_rwn_4dc"><li class="- topic/li li" data-ofbid="d252320e153__20250121171704">
|
||
<dl class="- topic/dl dl simple" id="id__dl_ywl_rwn_4dc" data-ofbid="id__dl_ywl_rwn_4dc"><dt class="- topic/dt dt dlterm" data-ofbid="d252320e157__20250121171704">ZRO</dt><dd class="- topic/dd dd">
|
||
<p class="- topic/p p" data-ofbid="d252320e161__20250121171704">Zero Point 的缩写,锯齿波的起始点</p>
|
||
</dd></dl>
|
||
</li><li class="- topic/li li" data-ofbid="d252320e165__20250121171704">
|
||
<dl class="- topic/dl dl simple" id="id__dl_zwl_rwn_4dc" data-ofbid="id__dl_zwl_rwn_4dc"><dt class="- topic/dt dt dlterm" data-ofbid="d252320e169__20250121171704">PRD</dt><dd class="- topic/dd dd">
|
||
<p class="- topic/p p" data-ofbid="d252320e173__20250121171704">Preiod Point 的缩写,锯齿波到达一个满周期的时间点</p>
|
||
</dd></dl>
|
||
</li><li class="- topic/li li" data-ofbid="d252320e177__20250121171704">
|
||
<dl class="- topic/dl dl simple" id="id__dl_axl_rwn_4dc" data-ofbid="id__dl_axl_rwn_4dc"><dt class="- topic/dt dt dlterm" data-ofbid="d252320e181__20250121171704">CMP</dt><dd class="- topic/dd dd">
|
||
<p class="- topic/p p" data-ofbid="d252320e185__20250121171704">Compare Point 的缩写,锯齿波到达了阈值的时间点,如上图中的 CMP 值为 7。</p>
|
||
</dd></dl>
|
||
</li></ul><div class="- topic/note note tip note_tip" id="id__note_kyl_qn3_ddc" data-ofbid="id__note_kyl_qn3_ddc"><span class="note__title">提示:</span>
|
||
<p class="- topic/p p" data-ofbid="d252320e191__20250121171704"> 实际上,PWM 模块支持设置两个 CMP 值:CMPA 和 CMPB。受限于 OS 中 PWM 子系统架构的接口设计,根据 duty
|
||
参数计算只能得到一个 CMP 值,所以 <strong class="+ topic/ph hi-d/b ph b">CMPB 和 CMPA 实际上数值保持一致</strong>。</p>
|
||
</div><p class="- topic/p p" data-ofbid="d252320e197__20250121171704">这些关键时点的触发行为 Action 有四种类型,详见 <a xml:lang="zh-CN" lang="zh-CN" class="- topic/xref xref" href="pwm_config.html">PWM 配置</a></p></div>
|
||
</li><li class="- topic/li li" data-ofbid="d252320e203__20250121171704">
|
||
<div class="- topic/div div section" id="id__id5">
|
||
<strong class="+ topic/ph hi-d/b ph b">减模式</strong>
|
||
<p class="- topic/p p" data-ofbid="d252320e210__20250121171704">下图是由一个 <strong class="+ topic/ph hi-d/b ph b">递减变化</strong> 的锯齿波产生 PWM 信号的过程: </p><figure class="- topic/fig fig fignone" id="id__id10" data-ofbid="id__id10"><br/><div class="imagecenter"><img class="- topic/image image imagecenter" id="id__image_bxl_rwn_4dc" src="../../../images/pwm/generate_pwm_down.png" alt="generate_pwm_down"/></div><br/><figcaption data-caption-side="bottom" class="- topic/title title figcapcenter"><span class="figtitleprefix fig--title-label">图<span class="fig--title-label-number"> 3</span><span class="fig--title-label-punctuation">. </span></span><span class="fig--title">由减模式锯齿波产生 PWM 信号的过程示意图</span></figcaption></figure>
|
||
</div>
|
||
</li><li class="- topic/li li" data-ofbid="d252320e223__20250121171704">
|
||
<div class="- topic/div div section" id="id__id6">
|
||
<strong class="+ topic/ph hi-d/b ph b">增减模式</strong>
|
||
<p class="- topic/p p" data-ofbid="d252320e230__20250121171704">下图是由一个 <strong class="+ topic/ph hi-d/b ph b">同时有递减、递减变化</strong> 的锯齿波产生 PWM 信号的过程:</p><figure class="- topic/fig fig fignone" id="id__id11" data-ofbid="id__id11"><br/><div class="imagecenter"><img class="- topic/image image imagecenter" id="id__image_cxl_rwn_4dc" src="../../../images/pwm/generate_pwm_up_down.png" alt="generate_pwm_updown.png"/></div><br/><figcaption data-caption-side="bottom" class="- topic/title title figcapcenter"><span class="figtitleprefix fig--title-label">图<span class="fig--title-label-number"> 4</span><span class="fig--title-label-punctuation">. </span></span><span class="fig--title">由增减模式锯齿波产生 PWM 信号的过程示意图</span></figcaption></figure><p class="- topic/p p" data-ofbid="d252320e241__20250121171704">比较以上三种模式的 PWM 产生过程,可以看到:</p><ul class="- topic/ul ul simple" id="id__ul_dxl_rwn_4dc" data-ofbid="id__ul_dxl_rwn_4dc"><li class="- topic/li li" data-ofbid="d252320e244__20250121171704">
|
||
<p class="- topic/p p" data-ofbid="d252320e246__20250121171704">三种模式可以产生同样效果的 PWM 信号</p>
|
||
</li><li class="- topic/li li" data-ofbid="d252320e249__20250121171704">
|
||
<p class="- topic/p p" data-ofbid="d252320e251__20250121171704">配置 ZRO、CMP(增减模式中有两处 CMP)、PRD 的触发行为(Action),可产生不同的 PWM 信号</p>
|
||
</li><li class="- topic/li li" data-ofbid="d252320e254__20250121171704">
|
||
<p class="- topic/p p" data-ofbid="d252320e256__20250121171704">CMP 的取值,直接决定了占空比,所以用户看到的 <strong class="+ topic/ph hi-d/b ph b">调节占空比就是通过调节 CMP 值来实现</strong></p>
|
||
</li><li class="- topic/li li" data-ofbid="d252320e261__20250121171704">
|
||
<p class="- topic/p p" data-ofbid="d252320e263__20250121171704">PRD 的值,决定了 PWM 信号的周期值 Tpwm</p>
|
||
</li></ul><div class="- topic/note note tip note_tip" id="id__note_lyl_qn3_ddc" data-ofbid="id__note_lyl_qn3_ddc"><span class="note__title">提示:</span>
|
||
<ol class="- topic/ol ol arabic simple" id="id__ol_exl_rwn_4dc" data-ofbid="id__ol_exl_rwn_4dc"><li class="- topic/li li" data-ofbid="d252320e269__20250121171704">
|
||
<p class="- topic/p p" data-ofbid="d252320e271__20250121171704">具体选择哪一种模式,要依据用户场景的需求特点,建议按 <strong class="+ topic/ph hi-d/b ph b">从简原则:首选相对简单的单斜率模式</strong>。</p>
|
||
</li><li class="- topic/li li" data-ofbid="d252320e277__20250121171704">
|
||
<p class="- topic/p p" data-ofbid="d252320e279__20250121171704">为了简化使用,RTOS 中默认只使用 <strong class="+ topic/ph hi-d/b ph b">增模式</strong>。</p>
|
||
</li></ol>
|
||
</div></div>
|
||
</li></ul>
|
||
</section><section class="- topic/section section" id="id__section_rvr_rwn_4dc" data-ofbid="id__section_rvr_rwn_4dc"><h2 class="- topic/title title sectiontitle">PWM 功能简介</h2>
|
||
|
||
<div class="- topic/div div section" id="id__id7">
|
||
<p class="- topic/p p" data-ofbid="d252320e295__20250121171704">PWM 的硬件设计,使用时基计数器产生上述的锯齿波信号,使用一个比较器可同时产生两路 PWM 信号。 PWM 模块的硬件原理图可简化如下:</p>
|
||
<figure class="- topic/fig fig fignone" id="id__id12" data-ofbid="id__id12"><br/><div class="imagecenter"><img class="- topic/image image imagecenter" id="id__image_hwr_rwn_4dc" src="../../../images/pwm/pwm_hw_system.png" width="480" alt="pwm_hw_system"/></div><br/><figcaption data-caption-side="bottom" class="- topic/title title figcapcenter"><span class="figtitleprefix fig--title-label">图<span class="fig--title-label-number"> 5</span><span class="fig--title-label-punctuation">. </span></span><span class="fig--title">简化的 PWM 硬件框图</span></figcaption></figure>
|
||
<p class="- topic/p p" data-ofbid="d252320e305__20250121171704">PWM 模块共支持 4 个 PWM 通道,上图只画出了其中一个 PWM 通道,每个通道有 PWMx0 和 PWMx1 两个输出信号,对应 DTS 参数中的
|
||
action0 和 action1 配置。 <a xml:lang="zh-CN" lang="zh-CN" class="- topic/xref xref" href="pwm_config.html">PWM 配置</a></p>
|
||
<p class="- topic/p p" data-ofbid="d252320e311__20250121171704">PWM 模块支持的功能特性有:</p>
|
||
<ul class="- topic/ul ul simple" id="id__ul_iwr_rwn_4dc" data-ofbid="id__ul_iwr_rwn_4dc"><li class="- topic/li li" data-ofbid="d252320e315__20250121171704">每个 PWM 通道可以产生 PWMx0 和 PWMx1 输出信号,配置规则如下:<div class="- topic/note note note note_note" id="id__note_myl_qn3_ddc" data-ofbid="id__note_myl_qn3_ddc"><span class="note__title">注:</span>
|
||
<p class="- topic/p p" data-ofbid="d252320e319__20250121171704">在用户手册 > 接口 > PWM 模块中,上述两个 PWM 输出信号被称作 PWMxA 和 PWMxB。为了避免和阈值 CMPA 和
|
||
CMPB 混淆,软件设计中将两个输出信号称作 PWMx0 和 PWMx1。</p>
|
||
</div><ul class="- topic/ul ul" id="id__ul_kwr_rwn_4dc" data-ofbid="id__ul_kwr_rwn_4dc"><li class="- topic/li li" data-ofbid="d252320e323__20250121171704">
|
||
<p class="- topic/p p" data-ofbid="d252320e325__20250121171704">两个独立的单边输出</p>
|
||
</li><li class="- topic/li li" data-ofbid="d252320e328__20250121171704">
|
||
<p class="- topic/p p" data-ofbid="d252320e330__20250121171704">两个独立的双边对称输出</p>
|
||
</li><li class="- topic/li li" data-ofbid="d252320e333__20250121171704">
|
||
<p class="- topic/p p" data-ofbid="d252320e335__20250121171704">一个独立的双边非对称输出</p>
|
||
</li></ul></li><li class="- topic/li li" data-ofbid="d252320e338__20250121171704">
|
||
<p class="- topic/p p" data-ofbid="d252320e340__20250121171704">专用的 16 位可配置周期和频率的时基计数器(Time Base Counter)</p>
|
||
</li><li class="- topic/li li" data-ofbid="d252320e343__20250121171704">
|
||
<p class="- topic/p p" data-ofbid="d252320e345__20250121171704">系统时钟 100 MHz</p>
|
||
</li><li class="- topic/li li" data-ofbid="d252320e348__20250121171704">
|
||
<p class="- topic/p p" data-ofbid="d252320e350__20250121171704">多种事件可配置产生对应的中断</p>
|
||
</li></ul>
|
||
<div class="- topic/p p" data-ofbid="d252320e355__20250121171704">在 CMPA 和 CMPB 同时使用的情况下,锯齿波就会有两次和阈值的比较,共产生 4 个关键时点:<div class="table-container"><table class="- topic/table table frame-all" id="id__table_lwr_rwn_4dc" data-ofbid="id__table_lwr_rwn_4dc" data-cols="3"><caption></caption><colgroup><col style="width:29.673590504451035%"/><col style="width:35.311572700296736%"/><col style="width:35.01483679525222%"/></colgroup><thead class="- topic/thead thead"><tr class="- topic/row"><th class="- topic/entry entry colsep-1 rowsep-1" id="id__table_lwr_rwn_4dc__entry__1">锯齿波信号波段</th><th class="- topic/entry entry colsep-1 rowsep-1" id="id__table_lwr_rwn_4dc__entry__2">CMPA</th><th class="- topic/entry entry colsep-0 rowsep-1" id="id__table_lwr_rwn_4dc__entry__3">CMPB</th></tr></thead><tbody class="- topic/tbody tbody"><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="id__table_lwr_rwn_4dc__entry__1">增斜率段</td><td class="- topic/entry entry colsep-1 rowsep-1" headers="id__table_lwr_rwn_4dc__entry__2">CAU (Compare A Up)</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="id__table_lwr_rwn_4dc__entry__3">CBU (Compare B Up)</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-0" headers="id__table_lwr_rwn_4dc__entry__1">减斜率段</td><td class="- topic/entry entry colsep-1 rowsep-0" headers="id__table_lwr_rwn_4dc__entry__2">CAD (Compare A Down)</td><td class="- topic/entry entry colsep-0 rowsep-0" headers="id__table_lwr_rwn_4dc__entry__3">CBD (Compare B Down)</td></tr></tbody></table></div></div>
|
||
<p class="- topic/p p" data-ofbid="d252320e386__20250121171704">以增减模式的锯齿波为例,共 6 个关键时点:</p>
|
||
<figure class="- topic/fig fig fignone" id="id__id13" data-ofbid="id__id13"><br/><div class="imagecenter"><img class="- topic/image image imagecenter" id="id__image_mwr_rwn_4dc" src="../../../images/pwm/pwm_cmpa_cmpb.png" alt="cmpa_cmpb"/></div><br/><figcaption data-caption-side="bottom" class="- topic/title title figcapcenter"><span class="figtitleprefix fig--title-label">图<span class="fig--title-label-number"> 6</span><span class="fig--title-label-punctuation">. </span></span><span class="fig--title">增减模式的 6 个关键时点</span></figcaption></figure>
|
||
<div class="table-container"><table class="- topic/table table frame-all" id="id__table_nwr_rwn_4dc" data-ofbid="id__table_nwr_rwn_4dc" data-cols="2"><caption class="- topic/title title tablecap" data-caption-side="top" data-is-repeated="true"><span class="table--title-label">表<span class="table--title-label-number"> 2</span><span class="table--title-label-punctuation">. </span></span><span class="table--title">增减模式下关机时点的触发行为配置</span></caption><colgroup><col style="width:48.07692307692307%"/><col style="width:51.92307692307693%"/></colgroup><thead class="- topic/thead thead"><tr class="- topic/row"><th class="- topic/entry entry colsep-1 rowsep-1" id="id__table_nwr_rwn_4dc__entry__1">关键时点</th><th class="- topic/entry entry colsep-0 rowsep-1" id="id__table_nwr_rwn_4dc__entry__2">Action 类型</th></tr></thead><tbody class="- topic/tbody tbody"><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="id__table_nwr_rwn_4dc__entry__1">CBD</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="id__table_nwr_rwn_4dc__entry__2">none</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="id__table_nwr_rwn_4dc__entry__1">CBU</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="id__table_nwr_rwn_4dc__entry__2">none</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="id__table_nwr_rwn_4dc__entry__1">CAD</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="id__table_nwr_rwn_4dc__entry__2">high</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="id__table_nwr_rwn_4dc__entry__1">CAU</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="id__table_nwr_rwn_4dc__entry__2">none</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="id__table_nwr_rwn_4dc__entry__1">PRD</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="id__table_nwr_rwn_4dc__entry__2">low</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-0" headers="id__table_nwr_rwn_4dc__entry__1">ZRO</td><td class="- topic/entry entry colsep-0 rowsep-0" headers="id__table_nwr_rwn_4dc__entry__2">low</td></tr></tbody></table></div>
|
||
<p class="- topic/p p" data-ofbid="d252320e440__20250121171704">关于行为类型定义,见 <a xml:lang="zh-CN" lang="zh-CN" class="- topic/xref xref" href="pwm_config.html">PWM 配置</a>。</p>
|
||
</div>
|
||
</section></div></article></main></div>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
</div>
|
||
|
||
<nav role="navigation" id="wh_topic_toc" aria-label="On this page" class="col-lg-2 d-none d-lg-block navbar d-print-none">
|
||
<div id="wh_topic_toc_content">
|
||
|
||
<div class=" wh_topic_toc "><div class="wh_topic_label">在本页上</div><ul><li class="section-item"><div class="section-title"><a href="#id__section_w5l_rwn_4dc" data-tocid="id__section_w5l_rwn_4dc">PWM 工作原理</a></div></li><li class="section-item"><div class="section-title"><a href="#id__section_rvr_rwn_4dc" data-tocid="id__section_rvr_rwn_4dc">PWM 功能简介</a></div></li></ul></div>
|
||
|
||
</div>
|
||
</nav>
|
||
|
||
</div>
|
||
</div>
|
||
|
||
|
||
|
||
</div>
|
||
<footer class="navbar navbar-default wh_footer">
|
||
<div class=" footer-container mx-auto ">
|
||
<title>footer def</title>
|
||
<style><!--
|
||
|
||
.p1 {
|
||
font-family: FangZhengShuSong, Times, serif;
|
||
}
|
||
.p2 {
|
||
font-family: Arial, Helvetica, sans-serif;
|
||
}
|
||
.p3 {
|
||
font-family: "Lucida Console", "Courier New", monospace;
|
||
}
|
||
|
||
--></style>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<div class="webhelp.fragment.footer">
|
||
<p class="p1">Copyright © 2019-2024 广东匠芯创科技有限公司. All rights reserved.</p>
|
||
</div><div>
|
||
<div class="generation_time">
|
||
Update Time: 2025-01-21
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</footer>
|
||
|
||
<div id="go2top" class="d-print-none">
|
||
<span class="oxy-icon oxy-icon-up"></span>
|
||
</div>
|
||
|
||
<div id="modal_img_large" class="modal">
|
||
<span class="close oxy-icon oxy-icon-remove"></span>
|
||
<div id="modal_img_container"></div>
|
||
<div id="caption"></div>
|
||
</div>
|
||
|
||
|
||
<script src="${pd}/publishing/publishing-styles-AIC-template/js/custom.js" defer="defer"></script>
|
||
|
||
|
||
</body>
|
||
</html> |