完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
你好,我使用PIC24FJ256GB106和XC16编译器和MPLAB X IDE V3.55。我只是尝试采样40Hz到60Hz的PWM方脉冲和不同的占空比(脉冲电压差为600MV到1.2V)。我在正方形脉冲上有斜率,我需要对斜率进行取样。32兆赫。如果使用手动模式或自动模式,其结果总是为0x000。有可能用这个Fosc来采样这个频率脉冲吗?我有2.2K的源阻抗。
以上来自于百度翻译 以下为原文 Hi, i using pic24fj256gb106 and xc16 compiler and mplab x ide v3.55. i just trying to sample the pwm square pulse of 40Hz to 60Hz and different duty cycle(pulse voltage diff is 600mV to 1.2V). i have slope on the square pulse.i need to sample the slope. 32MHz Fosc. if use the manual mode or auto mode, it results 0x0000 always. is that possible to sample this frequency pulse with this Fosc? i have 2.2K source impedence. |
|
相关推荐
5个回答
|
|
|
|
|
|
这个设备的采样率高达500 kSPS,所以你的采样斜率的能力受到了限制。如果你总是在ADC上读到0,听起来好像有点不对劲。引脚是如何配置的?你使用的样本/转换时间是多少?从一个基本的ADC读取之前跳到方波。
以上来自于百度翻译 以下为原文 That device samples at up to 500ksps, so your ability to sample the slope is limited by that. If you're always reading zero on your ADC, it sounds like something is amiss. How are the pins configured? How much sample/conversion time are you using? Start with a basic ADC read before jumping to the square wave. |
|
|
|
我从相应的参考手册中使用了这个示例代码。为了测试我是否像下面的代码那样自由运行ADC。我只是在运行时把断点读取这个值。所有数组总是0x000;
以上来自于百度翻译 以下为原文 I used this sample code from corresponding reference manual. To test i do free running adc like below code. unsigned int count; unsigned int *ADC16Ptr; unsigned int ADCValue[16]; AD1PCFG = 0xFFFE; // Only AN0 as analog input AD1CON1 = 0x00E0; // Internal counter triggers conversion AD1CHS = 0x0000; // Connect AN0 as positive input AD1CSSL = 0; AD1CON3 = 0x0F00; // Sample time = 15Tad, Tad = Tcy AD1CON2 = 0x003C; // Set AD1IF after every 16 samples AD1CON1bits.ADON = 1; // turn ADC ON while(1) // repeat continuously { ADCValue = 0; // clear value ADC16Ptr = (unsigned int*)&ADC1BUF0; // initialize ADC1BUF pointer IFS0bits.AD1IF = 0; // clear ADC interrupt flag AD1CON1bits.ASAM = 1; // auto start sampling for 31Tad // then go to conversion while (!IFS0bits.AD1IF){}; // conversion done? AD1CON1bits.ASAM = 0; // yes then stop sample/convert for (count = 0; count < 16; count++) // average the 16 ADC value { ADCValue[count] = *(ADC16Ptr++); } ADCValue = ADCValue >> 4; } // repeat i just read this value by putting breaking point while running. all the arrays are 0x000 always; |
|
|
|
IUE PGEC1和PGED1进行调试。(PGEC2和PGED2用于其他目的),所以我怀疑下面的误差项可能是零的结果值。如果是问题,那么在用MPLAB X IDE V3.55运行时,是否有任何自动化测试通过Perl编程获得结果?24。模块:A/D转换器在使用PGEC1和PGED1来调试这个家庭中的任何64针设备上的应用时,所有的电压基准将被禁用。这包括VREF+,VREF-,AVDD和AVSS。任何A/D转换将总是等于0x3FF。使用PGEC2和PGED2调试任何A/D功能。
以上来自于百度翻译 以下为原文 I Use PGEC1 and PGED1 to debug. (PGEC2 and PGED2 used to some other purpose)so i suspect this below Errata maybe for the result value of zero. If it is the problem then is there any automated testing to take the result by Perl programming while running with Mplab x ide v3.55? 24. Module: A/D Converter When using PGEC1 and PGED1 to debug an application on any 64-pin devices in this family, all voltage references will be disabled. This includes VREF+, VREF-, AVDD and AVSS. Any A/D conversion will always equal 0x3FF. Work around Use PGEC2 and PGED2 to debug any A/D functionality. |
|
|
|
在勘误表上找到了。在完成我的电路板设计之前,我养成了检查勘误表的习惯——它救了我好几次。我不知道你如何将Perl与MPLAB结合起来。具有不同编程语言的完全不同的系统。然而,您可以做的是在没有调试器的情况下运行该芯片,并使用UART读取值。这也允许一些Perl集成。
以上来自于百度翻译 以下为原文 Nice find on that errata. I've gotten in the habit of checking the errata before finalizing my board design--it's saved me a couple times. I don't know how you'd integrate Perl with MPLAB. Totally different systems with different programming languages. What you could do, however, is run the chip without the debugger and use the UART to read out values. That would also allow for some Perl integration. |
|
|
|
只有小组成员才能发言,加入小组>>
5203 浏览 9 评论
2016 浏览 8 评论
1942 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3188 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2243 浏览 5 评论
753浏览 1评论
640浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
545浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
652浏览 0评论
552浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-4 22:30 , Processed in 1.737073 second(s), Total 86, Slave 70 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号