完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
我尝试用PIC16F1778产生两个PWM信号来驱动全桥变压器威廉希尔官方网站
。我现在开始使用MCC来设置外围设备,并使用MPLABX 3.50的模拟器和逻辑分析器。我可以在RA1上设置100kHz和50%占空比的10位PWM3,一切正常。MCC有一个问题,它不允许选择PORTC,这正是我所需要的,但是我可以编辑pin_manager.c文件以根据需要定位PWM到RC1。这就是我在这里所做的,但是模拟逻辑分析器显示一个具有更短占空比的波形。我添加了一个将PWM的状态输出到RC0的循环,它显示了正确的波形:[发布PNG图像的访问被拒绝]http://enginuity..c...s/MCCTEST16F1778-2。看起来问题可能是在PORTC上的模拟器逻辑分析仪。因此,我将尝试将它们引导到RA1和RA2,但是我什么也得不到。我有PWM5设置为标准PWM,时钟=FOSC,没有预缩放,PWM偏移模式独立运行,PWM重载的各种组合,周期100us,占空比50us,相位0,和偏移=1us。但是逻辑分析器没有显示RA2上的活动,RC2上也没有设置为PWM5CONbits.OUT的状态。我有一个物理设备,也许下一步是在硬件上试试。我不知道我是否正确设置,或者如果它是模拟器的问题。
以上来自于百度翻译 以下为原文 I am trying to use a PIC16F1778 to produce two PWM signals for driving a full bridge transformer circuit. I am now starting to use the MCC to setup the peripherals, and using the simulator and logic analyzer of MPLABX 3.50. I can set up the 10 bit PWM3 for 100 kHz and 50% duty cycle, on RA1, and everything works as expected. There is a problem with MCC such that it will not allow selection of PORTC, which is what I need, but I can edit the pin_manager.c file to locate the PWM to RC1 as I desire. That's what I did here, but the simulation logic analyzer shows a waveform with a much shorter duty cycle. I added a loop that outputs the state of the PWM to RC0, and it shows the proper waveform: [access denied for posting PNG image] http://enginuitysystems.c...s/MCCTEST16F1778-2.png I was getting similar unusual waveforms for the PWM5 and PWM6, also directed to PORTC. It looks like the problem may be with the simulator logic analyzer on PORTC. So, I'll tried directing them to RA1 and RA2, but I get nothing. I have PWM5 setup as standard PWM, Clock=FOSC, no prescale, PWM offset mode independent run, various combinations of PWM reload, period 100 us, duty cycle 50 us, phase 0, and offset=1 us. But the logic analyzer shows no activity on RA2, and nothing on RC2 which is set to the state of PWM5CONbits.OUT. I have a physical device, and perhaps the next step is to try it on the hardware. I don't know if I'm setting it up properly, or if it is a problem with the simulator. |
|
相关推荐
2个回答
|
|
|
|
|
|
我决定采用一种不同的方法来获得我需要的推挽式PWM驱动器,使用PWM3和COG。经过一些尝试和错误之后,我发现我必须在100kHz下将PWM3设置为不超过95%的占空比,并且在两个输出上使用500ns的死区时间。成功!结果如下:
以上来自于百度翻译 以下为原文 I decided to take a different approach to getting the push-pull PWM drive that I need, using PWM3 and the COG. After a bit of trial and error I found that I had to set PWM3 to no more than 95% duty cycle at 100 kHz and I used 500 ns dead time on both outputs. Success! Here is the result: |
|
|
|
只有小组成员才能发言,加入小组>>
5295 浏览 9 评论
2059 浏览 8 评论
1969 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3234 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2277 浏览 5 评论
824浏览 1评论
710浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
654浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
711浏览 0评论
609浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2025-1-16 02:58 , Processed in 1.157381 second(s), Total 77, Slave 61 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (威廉希尔官方网站 图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号