完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
大家好,我想分享我的经验,关于ADCHS驱动程序和谐的PIC32 MK。这是我的配置是:1。PIC32 MK1024GPE开发板2。MPLABX IDE 4.103。MPLAB和谐2.05.014。MPLABX C32 2.05i试图在Advices应用程序和和睦外围库中设置示例,但是,它不像我预期的那么好。这是我在这个问题上花了2个星期所观察到的。1。实例1:同时采样和转换类ADCHS,我发现最多ADCHs采样在同一时间只有6个通道中的5个。我不知道这是否是MCU的规格,因为我在他们的文档中没有注意到。触发器来自中断TMR3。而且,在GualLoalActudieT触发器上也可能是同一个问题。我的例子是打开ADC实例通道0到通道5,并选择PIN AN0到AN5作为每个实例通道的模拟捕获输入。理想情况下,所有模拟输入(AN0至AN5)应该同时捕获每个中断触发器。然而,只有通道5或AN5不能更新采样。然后,我检查是否只有AN5采样,它正在工作。我得出结论,只有5个模拟输入可以在一级同时捕获。请让我知道,如果你有任何想法,为什么我不能同时捕获所有6个模拟输入类1。我将继续在Clase2和Clase3. [代码] /*中,如果没有启用单独的中断,则所有数据中断都在这个ISR*/Value ySISR(O-AdcVixValue,IPL3AUTO)中进行处理(i=0;i<50;i++){if(true=DrvayAdcCl SPLPLESE(i)){APDD)。{AdCySAMPLESeRead(i);} } /*If(true=DrvAdAcCl SAMPLESS可用(0)){AppDATa. ADCBUFF(0)=DrvIAdCySAMPLESeRead(0);}(true=DRVAI ADCX SAMPLESS可用(1)){AppDATAYXAX= DRVYAADCYSAMPLESESRADE(1);}(true=DRVYAADCX SAMPLES可用(2)){AppDATA.ZAXIS=DRVY-ADCYSAMPLESESRID(2);阿特巴布}(true=DrvAdAcCySAMPLESE可用(3)){AppDATA=DrVyAdCySAMPLESeRead(3);}(真值=DrvAdAcCl SAMPLESS可用(4)){AppDATA timeMistor=DrvAAdCySAMPLESESRADE(4);}(true=DRVYADCX采样可用(5)){AppDATA TimeMistor=DRVY-ADCCI SAMPLESREST(5);}(true=DrvayAdCl SAMPPLESA)可赋值(34)//IF(PLBIAdAdSypRealPoDATADSIAdEDIT(DRVAI ADCKIDID1,ADCHSYAN34));{AppDATA=DrvAADCYSAMPLESESRADE(34);//AppDATA;TimeMistor=PLBIAdAdSsSuffin PrutsReultGET(DrvayAdcTyId1,AdChsHAN34);}(true=DrvAADCl SAMPLES可用(6)){AppDATA TimeMistor=DRVYADCYSAMPLESESRADE(6);如果(true=DrvAADCYSAMPLIES可用(7)){AppDATA.TunSimult= DrvyAdCySAMPLESESRADE(7);}*/AppDATA DATAARADY=TRUE;/*清空ADC中断标志INTHOSTESTYADADCY1*/PLBIIN INTIOSSORCESTFLAGLISH(INTIOIDIO0,INSTORESCELADADCY1);}空AppOffice(空隙){int ADCL缓冲区;/*检查应用程序CurrENT状态。*/Lwitter(AppDATa.状态){/*应用程序的初始状态。*//AppHythEngInIt:{BoopAppRealsial= TRUE;IF(AppRealDistar){DrvayAdcIX初始化());/*PLIB AdChsSypRealStudioSCANSTUSET(DRVAI ADCXIDID1,ADCHSSYAN12,AdSSSX TraceGeRelosivEI EDGE,//AdsSSyScReang-TrigGeSoReCythTMR3A匹配AdSSStReGeReSuthCuxGualLaSaleApple RealEdk;*/DRVIAADC0OPEN();(DRVIAADC3OPEN);DRVYADADC5OPEN();//DRVYADADC6OPEN();/DRVYADADC6启动();AppDATA状态=APPYSTATEXServices任务;}中断;} AppHytStEnService任务:{if(true=AppDATA .DATAARDY){DrvAADCYSUTE());DRVI ADC1OPENSe;//AppDATA状态= APPYSTATEIGIN;DRVIAADCYSTATE();} //启用全局软件触发器/PLBIADADCHSGlobal Studio软件TrimeGrand(DRVAI ADCKIDID1);/ /等待转换完成AN0//()!PLBIAdAdSSyApple的DATA DATAISEDE(DRVAI ADCKIDID1,ADCHSYAN0);//ADCYBuffel= PLBIAdAdSsSuffiRePultReultGET(DRVA ADCKIDID1,ADCHSYAN0);/ /等待AN1///时转换完成(!)PLBIAADCHSSYAPLANDPATDATAISEDE(MyAdAdsScript实例,ADCHSYAN1);//结果[ 1 ]=PLBIAdAdSsSuffiRePultReultGET(MyAdAdsSh实例,ADCHSYAN1);/ /等待AN2///时转换完成()!PLIPHADCHSSYAPLANDPATDATAISEDE(MyAdAdsScript实例,ADCHSYAN2);//结果[ 2 ]=PLBIAdAdSsSuffiRePultReultGET(MyasAdsScript实例,ADCHSYAN2);//()DrviAdCySAMPLESeAsvices(0);//ADCYBuffel= DRVYADCDSAMPLESESRADE(0);Sturn:}/*toDO:实现应用程序状态机。*//*不应该执行默认状态。* /默认值:{/*todo:处理应用程序状态机中的错误。* /中断;} } [代码]
以上来自于百度翻译 以下为原文 Hi all, I would like to share my experience of the issue on ADCHS Driver in HARMony for PIC32MK. This is what my configure are: 1. PIC32MK1024GPE Development Board 2. MPLABX IDE 4.10 3. MPLAB Harmony 2.05.01 4. MPLABX C32 2.05 I am trying to set ADCHS following the examples in Harmony apps and Harmony Peripheral Libraries. But, it does not work well as I expect. This is what I have observed after spending 2 weeks in this issue. 1. Example1: Simultaneous Sampling and Conversion Class1 of ADCHS, I found that the most ADCHS sampling at the same times is only 5 of 6 channels. I don't know if this is the specification of the MCU, since I don't notice in their document. The trigger is from interrupt TMR3. And, it could be the same issue on GlobalSoftwareTrigger. My example is to open ADC Instance Channel 0 to Channel 5, and select pin AN0 to AN5 as the analog capture input for each instance channel. Ideally, all analog inputs (AN0 to AN5) should simultaneously capture every interrupt trigger. However, only channel 5 or AN5 cannot update the sampling. Then, I check if only AN5 sampling, it is working. I conclude that only 5 Analog inputs can do the capture at the same time in Class1. Please let me know if you have any idea why I cannot capture all 6 analog inputs class1 at the same time. I will continue the other examples on Class2 and Class3.
|
|
相关推荐
1个回答
|
|
大家好,我找到了解决办法。需要手工设置ADC5的TMR3的触发源,我认为和谐有一个错误产生超过4 ADC模块的触发源。所以,我只把直接寄存器访问如下:在DRVIAADC5OPEN()之后;……DVVAADC5OPEN();ADCTRG2BITS。TrGSRC5=6;
以上来自于百度翻译 以下为原文 Hi All, I got the solution. It is required to manually set the trigger source of ADC5 for TMR3. My thought is that Harmony has a bug to generate the trigger source beyond 4 ADC module. So, I just put the direct register access as following after DRV_ADC5_Open(); ... DRV_ADC5_Open(); ADCTRG2bits.TRGSRC5 = 6; ... |
|
|
|
只有小组成员才能发言,加入小组>>
5178 浏览 9 评论
2003 浏览 8 评论
1931 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3177 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2228 浏览 5 评论
737浏览 1评论
622浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
509浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
635浏览 0评论
533浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-26 15:17 , Processed in 1.317914 second(s), Total 48, Slave 42 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号