完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
您好,我正在开发一个PIC18F65 K40的应用程序,涉及从UC的不同引脚读取信号。引脚使用的是R4、R3、R2、R1、R0、RG7、RG6。程序每10毫秒由于TMR0中断而唤醒,我做几个处理,在某个时候,我有一个处理ADC通道读取的功能。我使用MCC。大部分通道工作正常。问题是,我不能从R3和R0读取适当的值。我的设置是一个资源管理器8板,使用PIC18F70K22插件模块,用PIC18F65 K40替换原来的PIC(幸运的是,模块具有双重占地面积,对于80引脚和64引脚器件)。引脚R0至RF4分别被带到5个修剪器的引脚2(中心凸耳)。修剪器具有连接到GND和+5V的引脚1和3。在Explorer 8自身上还有一个附加的修剪器,连接到引脚RA0。这是从主负责读取ADC并打印出调试值的函数:这是GETSUNCIECONVALY版本的函数,这是基于MCC创建的:所有修剪器都被设置为每个引脚看到VCC(5V)。这是我在UART上得到的一个例子:我期望到处读取1023,但是不幸的是,我没有从引脚R0和Rf3得到很多。他们总是读一个相当低的值,这是稍微改变其他修剪者的价值。请注意:RG7和RG6分别硬连接到VCC和GND在Explorer板上,因此我读RG6上的原因0。这个值与我期望的值相对应。我可以读取从修剪器得到的电压,一直到每个单独的引脚,这样我就可以丢弃错误的接线。我有两个相同的插件模块,它们上有相同的PIC18F65 K40。它们都给出了相同的结果。这个(可能)排除了硬件故障。如果我交换ADC转换的顺序,结果不会改变。如果我评论所有的转换,但是那些转换不起作用,它们仍然不起作用。插件模块上有一个非常恼人的电阻器,硬电阻R0到AVdd。这已经被删除了。我的设备的错误包含了一些关于ADC的问题,但是我不认为这个问题有什么用……对这个问题有什么建议吗?谢谢大家!编辑:我想添加链接到相关的东西(关于Explorer 8的信息,勘误表,插件模块示意图),但它不允许我张贴东西,如果帖子包含链接…
以上来自于百度翻译 以下为原文 Hello, I am developing on a PIC18F65K40 for an application that involves reading signals from different pins of the uC. The pins are using are RF4, RF3, RF2, RF1, RF0, RG7, RG6. Program wakes up every 10 ms due to TMR0 interrupt, I do several processing and at some point I have a function that deals with reading from the ADC channels. I am using MCC. Most of the channels are working fine. The problem is that I cannot read proper values from RF3 and RF0. My setup is an Explorer 8 board, using PIC18F87K22 plugin module with the original PIC replaced with a PIC18F65K40 (luckily the module has dual footprint, for 80 pin and 64 pin devices). Pins RF0 to RF4 are brought individually to pin 2 (center lug) of 5 trimmers. Trimmers have pin 1 and 3 connected to GND and +5V. There is also an additional trimmer on the Explorer 8 itself, connected to pin RA0. This is the function called from main responsible for reading the ADCs and printing out values for debugging: void PerformADCConversions(void) { static uint8_t counter = 0; uint16_t pot = 0; uint16_t RA0_value = 0; uint16_t RF4_value = 0; uint16_t RF3_value = 0; uint16_t RF2_value = 0; uint16_t RF1_value = 0; uint16_t RF0_value = 0; uint16_t RF4_value = 0; uint16_t RG7_value = 0; uint16_t RG6_value = 0; RA0_value = GetSingleConversion(ANA0_POT); // RA0 RF4_value = GetSingleConversion(ANF4); // RF4 RF3_value = GetSingleConversion(ANF3); // RF3 RF2_value = GetSingleConversion(ANF2); // RF2 RF1_value = GetSingleConversion(ANF1); // RF1 RF0_value = GetSingleConversion(ANF0); // RF0 RG7_value = GetSingleConversion(ANG7); // RG7 RG6_value = GetSingleConversion(ANG6); // RG6 counter++; if(counter == 10) { print("RA0: %dtRF4: %dtRF3: %dtRF2: %dtRF1: %dtRF0: %dtRG7: %dtRG6: %drn", RA0_value, RF4_value, RF3_value, RF2_value, RF1_value, RF0_value, RG7_value, RG6_value ); counter = 0; } } And this is the function GetSingleConversion, which is based on what MCC creates: adc_result_t GetSingleConversion(adcc_channel_t channel) { ADCC_DischargeSampleCapacitor(); __delay_us(100); // select the A/D channel ADPCH = channel; __delay_us(100); ADCC_StartConversion(channel); // Wait for the conversion to finish while (ADCON0bits.ADGO) { } // Conversion finished, return the result return ((adc_result_t)((ADRESH << 8) + ADRESL)); } All trimmers are set so that each pin sees Vcc (5V). This is an example of what I get on the UART: RA0: 1023 RF4: 1023 RF3: 16 RF2: 1023 RF1: 1023 RF0: 14 RG7: 1023 RG6: 0 RA0: 1023 RF4: 1023 RF3: 16 RF2: 1023 RF1: 1023 RF0: 14 RG7: 1023 RG6: 0 RA0: 1023 RF4: 1023 RF3: 16 RF2: 1023 RF1: 1023 RF0: 14 RG7: 1023 RG6: 0 RA0: 1023 RF4: 1023 RF3: 16 RF2: 1023 RF1: 1023 RF0: 14 RG7: 1023 RG6: 0 RA0: 1023 RF4: 1023 RF3: 16 RF2: 1023 RF1: 1023 RF0: 14 RG7: 1023 RG6: 0 RA0: 1023 RF4: 1023 RF3: 16 RF2: 1023 RF1: 1023 RF0: 14 RG7: 1023 RG6: 0 RA0: 1023 RF4: 1023 RF3: 16 RF2: 1023 RF1: 1023 RF0: 14 RG7: 1023 RG6: 0 RA0: 1023 RF4: 1023 RF3: 14 RF2: 1023 RF1: 1023 RF0: 14 RG7: 1023 RG6: 0 RA0: 1023 RF4: 1023 RF3: 14 RF2: 1023 RF1: 1023 RF0: 14 RG7: 1023 RG6: 0 RA0: 1023 RF4: 1023 RF3: 14 RF2: 1023 RF1: 1023 RF0: 14 RG7: 1023 RG6: 0 RA0: 1023 RF4: 1023 RF3: 14 RF2: 1023 RF1: 1023 RF0: 14 RG7: 1023 RG6: 0 RA0: 1023 RF4: 1023 RF3: 14 RF2: 1023 RF1: 1023 RF0: 16 RG7: 1023 RG6: 0 RA0: 1023 RF4: 1023 RF3: 14 RF2: 1023 RF1: 1023 RF0: 14 RG7: 1023 RG6: 0 RA0: 1023 RF4: 1023 RF3: 14 RF2: 1023 RF1: 1023 RF0: 16 RG7: 1023 RG6: 0 RA0: 1023 RF4: 1023 RF3: 14 RF2: 1023 RF1: 1023 RF0: 14 RG7: 1023 RG6: 0 RA0: 1023 RF4: 1023 RF3: 14 RF2: 1023 RF1: 1023 RF0: 14 RG7: 1023 RG6: 0 RA0: 1023 RF4: 1023 RF3: 14 RF2: 1023 RF1: 1023 RF0: 16 RG7: 1023 RG6: 0 RA0: 1023 RF4: 1023 RF3: 14 RF2: 1023 RF1: 1023 RF0: 14 RG7: 1023 RG6: 0 RA0: 1023 RF4: 1023 RF3: 14 RF2: 1023 RF1: 1023 RF0: 14 RG7: 1023 RG6: 0 RA0: 1023 RF4: 1023 RF3: 14 RF2: 1023 RF1: 1023 RF0: 14 RG7: 1023 RG6: 0 RA0: 1023 RF4: 1023 RF3: 14 RF2: 1023 RF1: 1023 RF0: 16 RG7: 1023 RG6: 0 RA0: 1023 RF4: 1023 RF3: 14 RF2: 1023 RF1: 1023 RF0: 14 RG7: 1023 RG6: 0 RA0: 1023 RF4: 1023 RF3: 14 RF2: 1023 RF1: 1023 RF0: 14 RG7: 1023 RG6: 0 I am expecting to read 1023 everywhere, but unfortunately I don't get much out of pins RF0 and RF3. They always read a fairly low value, that is slightly changing depending on the value of other trimmers. Please note that:
The errata of my device contains some about the ADC, but I don't think anything applies to this problem... Any suggestions on what the problem could be? Thanks in advance to everyone! Edit: I would like to add links to relevant stuff (info about Explorer 8, the errata, plugin module schematic) but it doesn't allow me to post stuff if the post contains links.... |
|
相关推荐
1个回答
|
|
还有另一个线索:“可能的bug ADC 18F66 K40/RF0”
以上来自于百度翻译 以下为原文 There is another thread that seems related: "Possible BUG ADC 18F66K40 / RF0" |
|
|
|
只有小组成员才能发言,加入小组>>
5238 浏览 9 评论
2028 浏览 8 评论
1950 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3204 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2253 浏览 5 评论
774浏览 1评论
664浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
592浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
674浏览 0评论
574浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-22 17:08 , Processed in 1.370858 second(s), Total 76, Slave 59 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号