MDK怎么用虚拟示波器查看生成的pwm波形?
本帖最后由 孤鸿踏雪遗梦 于 2016-1-15 23:22 编辑新手,如题。用cubemax设置定时器,产生pwm信号。进入Debug后在Logic Analyze里,怎么添加IO口查看呢?最好有图说明,谢谢。 这个直没用过。。。
http://gg.eefocus.com/www/delivery/lg.php?bannerid=0&campaignid=0&zoneid=462&loc=http%3A%2F%2Fwww.stmcu.org.cn%2Fmodule%2Fforum%2Fforum.php%3Fmod%3Dviewthread%26tid%3D612644%26page%3D1%23pid2330038&referer=http%3A%2F%2Fwww.stmcu.org.cn%2Fmodule%2Fforum%2Fhome.php%3Fmod%3Dspacecp%26ac%3Dcredit%26showcredit%3D1&cb=fcafa1cef2
以keil里自带的stm32的CPU为例,对PWM波形跟踪观测,打开C:\Keil\ARM\Boards\Keil\MCBSTM32\PWM_2目录下的stm32的Dome,第一步:进行仿真配置,如图:
https://www.stmcu.org.cn/module/forum/data/attachment/forum/201803/20/135254wmkcnn0mtzenam4p.jpg
把开工程中的Abstract.txt文件有对工程的描述,PWM从PB0.8和PB0.9输出,稍后将它加入软件逻辑分析仪里。
The 'PWM' project is a simple program for the STM32F103RBT6
using Keil 'MCBSTM32' Evaluation Board and demonstrating
the use of PWM (Pulse Width Modulation) with Timer TIM4 .
Example functionality:
- Clock Settings:
- XTAL = 8.00 MHz
- SYSCLK= 72.00 MHz
- HCLK = SYSCLK= 72.00 MHz
- PCLK1 = HCLK/2= 36.00 MHz
- PCLK2 = HCLK = 72.00 MHz
- ADCLK = PCLK2/6 = 12.00 MHz
- SYSTICK = HCLK/8=9.00 MHz
- TIM4 is running at100Hz.
LEDs PB8, PB9 are dimmed using the PWM function of TIM4 channel3,channel4
The Timer program is available in different targets:
Simulator: - configured for software Simulator
MCBSTM32: - runs from Internal Flash located on chip
(used for production or target debugging)
第二、选择软件仿真
https://www.stmcu.org.cn/module/forum/data/attachment/forum/201803/20/135332ybsccs7zhqdatqka.jpg
第三、编译程序,如果程序没有错的话,将出现以下线框编译信息,然后进入调试,点出红色的“D"按,如下图所示
https://www.stmcu.org.cn/module/forum/data/attachment/forum/201803/20/135353c3bvu6zblvb3zuzv.jpg第四步、把软件逻辑分析仪把,并把要观察的波形信号拉到逻辑分析仪里,如果进入调试状态下没有"sysbols"标签话,点击“View”菜单弹出来,从“Peripheral Register”里把要观察的(GPIOB_IDR输出的PWM信号会从这个寄存器反映出来)信号拖到逻辑析分析里,
https://www.stmcu.org.cn/module/forum/data/attachment/forum/201803/20/135412inidp8njnu8doqdo.jpg
第五步、把不用的bit屏蔽掉,并按bit形式显示,配置如图
https://www.stmcu.org.cn/module/forum/data/attachment/forum/201803/20/135433vsojkbsmsui2oo7m.jpg
第六步,点“GO”按钮进入全速运行,OK,PWM波形出来了,用IN和OUT可以调扫描时间,如下图
https://www.stmcu.org.cn/module/forum/data/attachment/forum/201803/20/135453um9x9qs2qmxeu9rj.jpg
页:
[1]