1. Requirements

To generate a PWM output, we need to create a train of pulses with constant period and variable duty cycle.

The duty cycle, being the modulation is the pulse width.

Typically, a timer is used to maintain both the period and duty cycle

by toggling an output based on compare matches between the timer and timer registers.

The timer is reset at the end of the pulse’s period in preparation for generating the next pulse.

In this case, the number of PWM will be limited by the number of timers that can operate in PWM mode.

This application note illustrates another method to generate the PWM outputs,

using DMA transfers to create one or two PWM signals.

This can be an advantage when a particular timer (a ‘precious resource’)

with a certain function is needed for other purposes in a design.

Instead, a simpler timer can be used.

2. DMAC Operation

The operation of DMAC on an M16C/6x device is as follows:

  • DMAC is initialized with a source address, a destination address, and a number for the amount of data to be transferred.
  • The DMA ‘waits’ for a request signal which can be a software or hardware trigger signal.
  • After a request signal is received, one byte or one word of data is transferred from the source address to the destination address.
  • Depended on the DMA settings, either the source or destination address is incremented, or both addresses stay fixed.
  • After a predefined number of data is transferred, the transfer can be repeated at the beginning or stopped.

A variable PWM signal will be created since we can change the source data as we please, and thus vary the duty cycle (pulse width).

We can also change the destination address.

The train of data can be output as an external signal of the MCU if we set the destination address to a specific output port.

3. How the PWM Signal is Created

We need to continuously maintain the pulse’s period and duty cycle.

To have the DMAC maintain the period we use a timer as the DMA request factor.

In the sample application we set up a timer to cause an underflow and then request a DMA transfer.

We can fine tune the signal at the destination output pin to have any level (high or low) at any specific time in one period.

In the following reasoning, a timer period is quantified as the time interval between each timer underflow.

This is Ttimer = PWM period / PWM resolution

To achieve a certain PWM resolution, say N (e.g. 255), we must transfer data N (255) times within one PWM period.

We will operate the DMAC in repeat mode to generate a continuous train of PWM signal.

In this mode, the whole set of data at the source address will be transferred again and again after the completion of the previous one.

Figure 1. PWM data is through some means apart from the DMA written to the data source buffer, pointed to by SARi.

This data is periodically transferred by the DMAC so that the signals at P4 behave the same way as PWM outputs with pre-defined duty cycle.

An array of data is shown which generate a PWM signal with 30% and 70% duty cycle at pin P4_0 and P4_1.

Up to 8 separate PWM signals can easily be generated in this example, with the same amount of MCU peripherals.

As shown in Figure 1, N data is transferred by N timer interrupts, and then the process is repeated.

N is the value in the TCRi register (Transfer Counter register) and is in fact the PWM resolution.

Data is transferred from the source address (in the SAR register) to the destination address (in the DAR register), which maps to P4.

Renesas M16C/6X -- Simple PWM Signal Generation Using DMA的更多相关文章

  1. Control an LM317T with a PWM signal

    http://www.edn.com/design/analog/4363990/Control-an-LM317T-with-a-PWM-signal The LM317T from Nationa ...

  2. STM32的PWM输入模式设置并用DMA接收数据

    参考 :STM32输入捕获模式设置并用DMA接收数据 PWM input mode This mode is a particular case of input capture mode. The ...

  3. Simple PWM to Analog Circuit (0-10vdc)

    i just finished this simple circuit and am very satisfied with the result. The output is very stable ...

  4. STM32F4 -- How to use the DMA burst feature

    Bits 15:13 Reserved, must be kept at reset value. Bits 12:8 DBL[4:0]: DMA burst length This 5-bit ve ...

  5. PWM DAC vs. Standalone

    http://analogtalk.com/?p=534 http://analogtalk.com/?p=551 Posted by AnalogAdvocate on April 09, 2010 ...

  6. Make a DAC with a microcontroller's PWM timer

    http://www.edn.com/design/analog/4337128/Make-a-DAC-with-a-microcontroller-s-PWM-timer Many embedded ...

  7. Generate stabilized PWM signals

    A standard technique for generating analog voltages using µCs is to use a PWM output and filter the ...

  8. PWM DAC Low Pass Filtering

    [TI博客大赛][原创]LM3S811之基于PWM的DAC http://bbs.ednchina.com/BLOG_ARTICLE_3005301.HTM http://www.fpga4fun.c ...

  9. How determine the RC time constant in PWM DAC low-pass filter?

    how determine the RC time constant in PWM digital to analog low-pass filter? I 'm looking for the be ...

随机推荐

  1. javascritpt创建对象

    javascript添加对象示例: <script> person=new Object(); person.firstname="Bill"; person.last ...

  2. deeplearning.ai学习seq2seq模型

    一.seq2seq架构图 seq2seq模型左边绿色的部分我们称之为encoder,左边的循环输入最终生成一个固定向量作为右侧的输入,右边紫色的部分我们称之为decoder.单看右侧这个结构跟我们之前 ...

  3. Linux Timer定时器【转】

    转自:https://www.jianshu.com/p/66b3c75cae81 timerfd为Linux为用户程序提供的定时器接口,该接口基于文件描述符,通过文件描述符的可读事件进行超时通知,且 ...

  4. mac 安装gevent报错

    运行pip install gevent报错 错误信息如下 xcrun: error: invalid active developer path (/Library/Developer/Comman ...

  5. 用Python连接SQLServer抓取分析数据、监控 (pymssql)

    Python 环境:python3 服务器环境: centos6.5 数据库: Mysql 大概流程:在装有Python服务器,利用pymssql库连接MSSQL生产数据库取出数据然后写进mysql数 ...

  6. IIS 无法识别的属性“targetFramework”---解决之道

    在安装VS2010后,应用.NET Framework 4创建的网站放在IIS(7.0)下会出现如下的错误: 其中的“版本信息”中告诉了我们.NET Framework和ASP.NET的版本都是2.0 ...

  7. 测试开发之Django——No2.Django的安装以及项目创建

    开发平台:Mac Python版本:3.7 Django版本:2.0.5 一.Django的安装 1.pip安装 输入命令pip install Django==2.0.5 说明:不指定版本,则安装的 ...

  8. PHP实现 APP端微信支付功能

    1.我封装好的一个支付类文件,多余的东西都去除掉了,并且把配置参数放到了这个支付类中,只需要修改Weixinpayandroid方法内的几个参数就可以直接复制使用: class Wxpayandroi ...

  9. IDEA / WebStorm / PhpStorm 添加jQuery自动提示,自动补全,提醒文档

    应该是JetBrains系列IDE通用的方法,网上其他一些方法有的过时了,有的不全 默认情况下没有JQuery补全,按照以下方法添加 1. 打开Settings,Languages & Fra ...

  10. Linux系统运维笔记(四),CentOS 6.4安装Nginx

    Linux系统运维笔记(四),CentOS 6.4安装Nginx 1,安装编译工具及库文件 yum -y install make zlib zlib-devel gcc-c++ libtool op ...