发 帖  
张飞软硬开源基于STM32 BLDC直流无刷电机驱动器开发视频套件, 👉戳此立抢👈
[问答] PIC24FJ128GC006 AN12/B12作为PADC的输入
43 PIC24 传感器
分享
我试图将引脚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]
0
2019-5-21 15:27:19   评论 分享淘帖 邀请回答
3个回答
是的,它设置为高,如模拟选择(ANSB位12)

以上来自于百度翻译


      以下为原文

    Yes its set to high, as is the analog select (ansb bit 12)
 
2019-5-21 15:50:14 评论

举报

实际上,这不是真的,当我把它设置为高时,它会读回零,所以这就是为什么我相信其他一些函数有端口,并控制那个引脚。但我确实尝试将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
 
2019-5-21 15:57:07 评论

举报

我发现JTAG端口是在配置位中启用的,端口RB12也是TCK…得到它。

以上来自于百度翻译


      以下为原文

    I found the issue the JTAG port was enabled in the config bits, port RB12 is also TCK..got it.
2019-5-21 16:05:25 评论

举报

只有小组成员才能发言,加入小组>>

37个成员聚集在这个小组

加入小组

创建小组步骤

关闭

站长推荐 上一条 /8 下一条

快速回复 返回顶部 返回列表