1
完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
大家好,我打算用DSPIC33和DSPIC-SIMULINK模块实现永磁同步电机的控制,用PWM和ADC模块构成了SIMULINK模型,用PWM触发ADC。当选择“触发器是块输入”并给块(在0和周期值之间)值时,PWM触发器只在其位置上移位,但其频率与PWM的频率相同。我想将ADC触发器的频率改变为PWM频率的一半或第三。AY使用DSPIC Simulink块集,谢谢,
以上来自于百度翻译 以下为原文 Hi everyone, I intend to implement PM synchronous motor control using dsPIC33 and the dsPIC Simulink blockset. I made a Simulink model with the PWM and ADC module and triggered the ADC using the PWM. When I select ‘trigger is a block input’ and give a value to the block (between 0 and period value), the PWM trigger only shifts in its position but has the same frequency as that of the PWM. I want to change the frequency of the ADC trigger to half or a third of the PWM frequency. Is there any way of doing that using the dsPIC Simulink blockset. Thanks, |
|
相关推荐
2个回答
|
|
HI Gabbar,PWM外围设备可以触发ADC每周期一次,或者每周期几次(可以在PWM初始TIG值中设置一个矢量,每个周期具有一个以上的TIG)。用户的责任是确保ADC采样时间和转换与您设置的TRAIs相适应。在某个芯片上可用的后缩放器在每N个PWM周期中对ADC进行一次采样,在块集上没有实现。解决办法是在每个周期进行ADC转换,然后只使用n个采样。注意转换过程完全由外围设备处理,不使用任何CPU负载(不需要中断),因此没有影响。从ADC块允许设置时间步触发。默认情况下,定时器被设置为触发最快的Simulink时间步长。当存在ADC块时,该定时器触发ADC转换,然后转换结束触发时间步长。您可以选择在该ADC块(默认)完成的所有转换结束的时间步长,或者当ADC块被配置为获取多于一个样本(当使用并行采样和保持时,2个或4个样本)时,也可以选择在每个转换之后触发时间步长。ADC COVERSEN可以使用像PWM TIG这样的“自定义”触发器。在任何情况下,当您不使用默认参数时,必须确保系统是一致的:如果Simulink离散时间步长(最快的一个)是25US,并且如果使用PWM来触发ADC,则ADC转换结束时间步长:T。RIG必须每25U进行一次适应SIMULINK模型的时间步长,这些先进的选项允许处理PMSM双分流器(在每个PWM周期中取一个采样)或单个分流器(每个PWM周期内取的两个采样)电机控制算法。
以上来自于百度翻译 以下为原文 Hi Gabbar, The PWM peripheral can trigger the ADC once per period, or several times per period (you can set a vector in the PWM initial trig value to have more than one trig per period). It is user responsibility to ensure that ADC sample time & conversion cope with the trigs you set. The postscaler available on some chip to trig the ADC once every N PWM period is not implemented on the blockset. The workaround would be to make the ADC conversion at each period, then use only one sample out of N. Note that that conversion process is entirely handled by peripherals, not using any CPU load (no interrupt required) thus has no impact. From the ADC block allows to set the time step triggering. By default, a timer is set to trig the fastest Simulink time step. When an ADC block is present, that timer trig the ADC conversion then end of conversion trig the time step. You could select to trig the time step at end of all conversion done by that ADC block (default) or you could also select to trig the time step after each conversion when the ADC block is configured to take more than one sample ( 2 or 4 samples when the parallel sample & hold is used). ADC conversion could use a “custom” trigger like the PWM trig. In any case, when you are not using default parameters, you must ensure that the system is coherent: if the Simulink discrete time step (fastest one) is 25us and if you use PWM to trig ADC, then ADC end of conversion trig the time step: the trig must take place every 25us to fit with Simulink model time step period. These advanced options allows to handle PMSM dual shunt (one sample taken at each PWM period) or single shunt (two sample taken at each PWM period) motor control algorithm for example. |
|
|
|
你好,鲁宾,谢谢你的详细回复!我使用了定时器触发器,但不知道定时器周期是如何设置的。我现在知道了,我找到了解决问题的办法。我在PWM参考手册中读到,通过给TrGCON寄存器中的TyrGDIV位提供一个整数值,ADC触发频率可以被改变。我在C代码中添加了寄存器,并给出了期望的结果。再次感谢!
以上来自于百度翻译 以下为原文 Hi Lubin, Thanks for the detailed reply! I had used the timer trigger but did not know how the timer period was set. I know it now.. I was able to find a work around for the problem. I read in the PWM reference manual that by giving an integer value to the TYRGDIV bits in the TRGCON registers, the ADC trigger frequency can be changed. I added that register in the C code and it gave the desired results. Thanks again! |
|
|
|
只有小组成员才能发言,加入小组>>
5238 浏览 9 评论
2028 浏览 8 评论
1950 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3204 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2253 浏览 5 评论
778浏览 1评论
666浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
595浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
677浏览 0评论
576浏览 0评论
小黑屋| 手机版| Archiver| 德赢Vwin官网 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-23 06:34 , Processed in 1.642918 second(s), Total 77, Slave 61 queries .
Powered by 德赢Vwin官网 网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
德赢Vwin官网 观察
版权所有 © 湖南华秋数字科技有限公司
德赢Vwin官网 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号