我使用PIC32 MX795F512L为我的项目的1。我需要在我的应用程序读取4针输入DIP开关状态。有很多其他的GPIO的我正在使用,他们都在正常工作,然而,RG2和RG3它不工作。如果这2个引脚是低的,然后在控制器上,他们读取它们为高。如果两个引脚状态不同,那么我可以正确地读取它们。我禁用USB和使用这只是一个GPIO。我经历了不同的职位,只发现这个引脚只是输入,但没有人发布任何问题与输入。下面是代码的一部分。{ PraccMang-CopIg PascMod=HS,FNOSCC=PrPLL,FPBDIV= DIVII2α-PrAPMA配置,WDTPS=PS8192GPIO::定义DIP1BIT Tras-TrISA3*定义DIP2BIT Tras-TrISA2定义DIP3BIT Tras-TrISG2定义定义DIP4BIT Tras-TrISG3α定义DIP1BITαRA3定义DIP2BITαRA2定义DIP3 VY2,FPLLoDIV= DIVIG1,FWDTEN= OFF摩哂陀位定义了DIP4BY位RG3DIP1BITTYRIS=输入;DIP2BITTYRIS=输入;DIP3BITTYRISIS =输入;DIP4BITTYTRIS =输入;如果有人能帮助,请让我知道。谢谢,,
以上来自于百度翻译
以下为原文
I am using PIC32MX795F512L for 1 of my project. I need to read 4pin input dip switch status in my applica
tion. There are plenty of other GPIO's I am using and all of them are working properly however with RG2 and RG3 it's not working. If this 2 pins are low then on controller they read them as high. If both pin status is different then I can read them properly. I disabled USB and using this as an GPIO only.
I went through different posts and only found this pins are only Input but no one posted any issue with Input. Below is part of code.
Config -:
#pragma config ICESEL = ICS_PGx1
#pragma config FCANIO=ON
#pragma config FUSBIDIO = OFF // USB USID Selection (Controlled by Port Function)
#pragma config FVBUSONIO = OFF // USB VBUS ON Selection (Controlled by Port Function)
#pragma config FPLLMUL = MUL_20, FPLLIDIV = DIV_2, FPLLODIV = DIV_1, FWDTEN = OFF
#pragma config POSCMOD = HS, FNOSC = PRIPLL, FPBDIV = DIV_2
#pragma config WDTPS = PS8192
GPIO-:
#define DIP1_BIT_TRIS _TRISA3
#define DIP2_BIT_TRIS _TRISA2
#define DIP3_BIT_TRIS _TRISG2
#define DIP4_BIT_TRIS _TRISG3
#define DIP1_BIT _RA3
#define DIP2_BIT _RA2
#define DIP3_BIT _RG2
#define DIP4_BIT _RG3
DIP1_BIT_TRIS = INPUT;
DIP2_BIT_TRIS = INPUT;
DIP3_BIT_TRIS = INPUT;
DIP4_BIT_TRIS = INPUT;
Let me know if anyone can help.
Thanks,
Mahendra