完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
大家好,我是PIC单片机的新手。我已经熟悉了这张照片大约3个月,并试图做所有这一切都提供了PIC。我在这个PIC上有一个PWM问题。我认为这是错误的,我没有完全理解PIC的过程,不熟悉这些图片的编程。我发现这个代码在线输出68%个占空比。我实现了代码,我确实收到了RC5(PWM1)的输出,它几乎是VDD的68%。当我试图改变占空比时,我的问题就发生了。数据表表示“PWMXDCL和PWMXDCH寄存器配置占空比”,但是当我为这两个寄存器改变二进制时,我不改变占空比。我也不确定如何改变PWMXDCL和PWMXDCH寄存器的二进制数改变占空比。如果有人能解释这将是伟大的!我唯一能改变引脚RC5(PM1)输出电压的方法是通过改变PR2定时器。这是有意义的,因为我根据数据表改变周期:“PWM周期由time2的PR2寄存器指定”。如果有人能把我带到正确的方向,我们会很感激。编译器:XC8(V1.44)IDE:MPLAB X IDE V4.05PIC:PIC16LF150 3KIPIT3代码发布在下面的TXT文档中
以上来自于百度翻译 以下为原文 Hello Everyone, I am new to pic micro controllers. I have been getting familiar with this pic for about 3 months now and trying to do everything this pic has to offer. I am having an issue with the PWM on this pic. I believe this is error from me not fully understanding the process of the pic yet and unfamiliar with programming these pics. I have found this code online that outputs a 68% duty cycle. I implemented the code and I do receive an output on RC5 (PWM1) which is almost 68% of VDD. My problem occurs when i try to change the Duty Cycle. The datasheet says "The PWMxDCL and PWMxDCH registers configure the duty cycle." yet when i change the binary for these two registers, I don't change the duty cycle. I am also not sure how changing the binary number of the PWMxDCL and PWMxDCH registers change duty cycle. If someone can explain this that would be great!! The only way i can change the output voltage of pin RC5(PM1) is by changing the PR2 timer. This makes sense because I'm changing the period according to the datasheet "The PWM period is specified by the PR2 register of Timer2". If anyone can lead me in the right direction it would be much appreciated. Compiler: XC8 (v1.44) IDE: MPLAB X IDE v4.05 PIC: PIC16LF1503 PICKIT3 Code is posted in a txt document below Attached Image(s) Attachment(s) PWM code.txt (2.82 KB) - downloaded 50 times |
|
相关推荐
1个回答
|
|
复制帖子:HTTP//www. McCHIP.COM/FUMMS/M103054.ASPX
以上来自于百度翻译 以下为原文 Duplicate post: http://www.microchip.com/forums/m1030574.aspx |
|
|
|
只有小组成员才能发言,加入小组>>
5162 浏览 9 评论
2000 浏览 8 评论
1928 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3172 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2226 浏览 5 评论
731浏览 1评论
613浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
503浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
629浏览 0评论
527浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-23 02:38 , Processed in 1.183990 second(s), Total 76, Slave 60 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号