完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
我试图将引脚B12配置为PADC1的输入。使用MCC将其配置为输入,使其成为模拟端口。使用MCC我构建了PADC1,以使用由AN12组成的单个列表,该列表是端口B位12。当我运行代码时,PADC1对样本列表进行采样,并且我得到一个非常小的值0x01F在ADRES0in中,TrISB和ANSB比特被设置为它的输出。我在那个端口上有一个温度传感器,它输出大约0.75VDC,所以它应该是一个更大的值(比0x1F大)。我看了看配置位,看看是否有可能影响引脚的方向,也许有人可以提供建议?谢谢!SteveShere是主代码循环。SYSTEM_Initialize调用初始化并启动PADC[/code]的代码
以上来自于百度翻译 以下为原文 I am trying to configure pin B12 as an input for the PADC1. using MCC I configure it as an input, made it an analog port. using MCC I built the PADC1 to use a single list consisting of AN12 which is port B bit 12. When I run the code, it PADC1 samples the sample list and I get a very small value 0x01F in ADRES0 in addition the TRISB and ANSB bits for are set as if its an output. I have a temperature sensor on that port which is putting out about 0.75 VDC so it should be a larger value (than 0x1F). Since the TRISB bits show it as an output, i assume that something else is overriding the port pin but I can not figure out what. I looked thur the config bits to see if anything there might influence the pin direction, perhaps someone can offer a suggestion? thanks! SteveS here is the main code loop.. SYSTEM_Initialize calls the code that initializes and starts the PADC int main(void) { // initialize the device SYSTEM_Initialize(); uint16_t sl0ResultBuffer[2];; uint8_t tableregindex; uint8_t slsize; tableregindex = 0; slsize = 1; while(1) { if( PADC1_SampleList0ConversionResultBufferGet(sl0ResultBuffer, tableregindex, slsize)) { PADC1_Tasks(); } } [/code[/code] |
|
相关推荐
3个回答
|
|
是的,它设置为高,如模拟选择(ANSB位12)
以上来自于百度翻译 以下为原文 Yes its set to high, as is the analog select (an*** bit 12) |
|
|
|
实际上,这不是真的,当我把它设置为高时,它会读回零,所以这就是为什么我相信其他一些函数有端口,并控制那个引脚。但我确实尝试将TRISB位12设置为高以及ANSB位12设置为高……这就是delemma,它不作为输入而存在。
以上来自于百度翻译 以下为原文 actually, thats not true, when I set it to high it reads back zero so thats why I believe some other function has the port and is controlling that pin. But i do attempt to set the TRISB bit 12 high as well as the ANSB bit 12 high.. thats the delemma, its not staying as an input |
|
|
|
我发现JTAG端口是在配置位中启用的,端口RB12也是TCK…得到它。
以上来自于百度翻译 以下为原文 I found the issue the JTAG port was enabled in the config bits, port RB12 is also TCK..got it. |
|
|
|
只有小组成员才能发言,加入小组>>
5303 浏览 9 评论
2065 浏览 8 评论
1972 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3239 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2279 浏览 5 评论
827浏览 1评论
715浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
663浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
716浏览 0评论
615浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2025-1-23 13:03 , Processed in 0.987633 second(s), Total 47, Slave 42 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号