完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
你好!我尝试在DSPIC33 EP512GP806控制器上建立ADC会话。它有两个ADC模块,我的意图是设置它的方式,我可以在240kHz的6个通道,和4在120 kHz,使用两个ADC模块。我想用替代采样方法每次交换低速通道。我同时使用四个通道同时使用DMA分散/聚集模式。(我有点喜欢ADC结果在一个明确定义的内存区域,特别是4个低速通道),如果我把ADXCON2寄存器值中的SMPI位设置为0,模块就停止在MUXA和MUXB之间进行切换,它只对MUXA进行采样,然后我尝试信道扫描,这可以给我同样的结果,但它也不起作用。当SMPI值为零时(SimsAM为1),则不会发生信道扫描。如果改变了示例1的SMPI值,则两个低速通道都被采样(我用断点设置ADC中断,以查看每次会话后发生什么),但是高速Chin的每一秒结果。内尔被下一个样本覆盖(正如我预期的那样),所以我以这种方式丢失了每秒钟的样本。我试图在家庭参考手册中找到类似的东西,但是在所有情况下,它们都使用交替采样或信道扫描,它们使用顺序采样。在手册中从来没有告诉过它,但是它从来没有告诉过它。所以我的结论是:如果SIMSAM是1,则不能使用替代采样和信道扫描。但我可能是错的。如果你有关于讨好的经历,请分享!谢谢您!P.S.I决定使用ADC模块的16字主结果缓冲器,无论如何…
以上来自于百度翻译 以下为原文 Hi! I try to set up the ADC conversation on a dsPIC33EP512GP806 controller. It has two ADC modules, my intention was to set it up the way I can sample 6 channels at 240kHz, and 4 at 120kHz, using both ADC modules. I wanted to use the alternative sampling method to swap the lower speed channels every time. I used simultaneous sampling, four channels, with DMA scattered/gathered mode. (I kind of like the idea to have the ADC results within a well defined memory area, specially the 4 low speed channels) What I found, if I set the SMPI bits in the ADxCON2 register value to zero, the module stops swaping between MUXA and MUXB, it is sampling MUXA only. Then I tried channel scanning, which could give me the same result, but it did not work as well. Channel scan does not happen when SMPI value is zero (while SIMSAM is 1). If I change the SMPI value for example 1, both of the low speed channels got sampled (I set up the ADC interrupt with a break point to see what happens after every conversation), but every second results of the high speed channels got overwritten with the next sample (as I expected), so I lost every second samples this way. I tried to find anything similar in the family reference manual, but in all cases they are using alternative sampling or channel scanning they use sequential sampling. Never told in the manual that it works, but it never told it doesn't. So my conclusion is: if SIMSAM is 1 then alternative sampling and channel scanning can not be used. But I may be wrong. If you have experiences about please, please share! Thank you! p.s. I decided to use the ADC module's 16 word main result buffers, anyway... |
|
相关推荐
2个回答
|
|
嗨,DMA散射/ GATT不能正确地存储数据或存储它们不是你所期望的吗?我建议你在不使用DMA(简单地使用中断)的情况下尝试实现你的ADC设置,检查你得到的结果。一旦你得到预期的结果,你就可以实现DMA,甚至分散/格式化和重新检查。
以上来自于百度翻译 以下为原文 Hi, Could it be that DMA scatter/gatter is not properly storing the data or storing them not the way you expect ? I suggest you try to implement your ADC setup without using DMA (simply use interrupts) to check that you get the result you expect . Once you get the results you expected, you can implement DMA and even scatter/gatter and recheck Regards |
|
|
|
嗨,实际上不是,因为在那里模拟输入有一定的电压电平。缓冲器中出现的数据对于该信道是正确的,但信道本身不是正确的。例如,AN6的值大约为750,而AN7的值大约为450。当我将SMPI值设置为0时,在与AN6有关的缓冲区中出现了4个值,值大约为750,并且与AN7有关的缓冲区中没有出现数据。很明显,在这种情况下,AN7永远不会被采样,所以交替机制不起作用。如果我将SMPI值设置为1,则在与AN6有关的缓冲器中出现了大约750的值,在AN7中的缓冲器中出现了大约450的值。首先,在第一缓冲器位置出现SH0/AN6的数据,然后在SH1、SH2、SH3中出现3个值,因为它们在第一缓冲器位置应该出现,然后在第一缓冲器位置出现SH0/AN7的值,然后出现3个值,用于SH1、SH2、SH3覆盖第一缓冲器位置RE。适合那些频道但在这种情况下,它应该是这样工作的。它表明,交替机制工作良好。幸运的是,它的工作原理与一个单一的A/D中断,而不使用DMA。因为A/D都有16个缓冲区,所以我可以收集32个只有一个ISR执行的样本。当SimsAm=1和SMPI=0时的行为对我来说没有任何意义。
以上来自于百度翻译 以下为原文 Hi, actually not, because there where a certain voltage levels on the analog inputs. The data appeared in the buffer was right for that channel, but the channel itself was not the right one. For example, AN6 had the value about 750, while AN7 had the value about 450. When I set the SMPI value to zero, I got 4 values appeared in the buffer related to AN6, values about 750, and no data appeared in the buffer related to AN7. It was clear that in this case AN7 never got sampled, so the alternating mechanism was not working. If I set the SMPI value to one, a value about 750 appeared in the buffer related to AN6 and a value about 450 appeared in the buffer related to AN7. First a data appeared for SH0/AN6 on the first buffer location, then 3 values appeared for SH1,SH2,SH3 as they supposed to at their first buffer location, then a value appeared for SH0/AN7 at the first buffer location, then 3 values appeared for SH1,SH2,SH3 overwriting the first buffer locations related to those channels. But in this case it supposed to work like this. It shows, that the alternating mechanism worked fine. Fortunately it works just fine with a single A/D interrupt without using DMA. Since both A/D has 16 buffer locations, I can collect 32 samples having just one ISR execution. The behaviour when SIMSAM = 1 and SMPI=0 just does not make any sense to me. B.R. |
|
|
|
只有小组成员才能发言,加入小组>>
5160 浏览 9 评论
1998 浏览 8 评论
1927 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3170 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2225 浏览 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-22 17:54 , Processed in 1.446621 second(s), Total 79, Slave 62 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号