Sorry, I thought I did.. Long day. CPU is PIC32MX795F512L -- David VanHorn Lead Hardware Engineer Backcountry Access, Inc. 2820 Wilderness Pl, Unit H Boulder, CO =A080301 USA phone:=A0303-417-1345 =A0x110 email:=A0david.vanhorn@backcountryaccess.com=A0 -----Original Message----- From: piclist-bounces@mit.edu On Behalf Of Alan P= earce - UKRI STFC Sent: Thursday, November 7, 2019 2:45 AM To: Microcontroller discussion list - Public. Subject: RE: [PIC] Configuring a pin for input As others have said, you didn't state which processor - but seeing that you= are quoting 32 bit values for ports I suspect it is a PIC32. But the bigger and more recent processors have multiple registers that cont= rol analogue functions on pins. I have no experience with PIC32 on this. Another possibility is does the chip have JTAG capability, because that has= a higher priority over the pins that normal operation unless you disable i= t - at least on 16 bit parts, again no experience with PIC32. Seeing you are actively debugging I take it the pin isn't part of a Debug p= in set that is configured as the debug port. -----Original Message----- From: piclist-bounces@mit.edu On Behalf Of David = Van Horn Sent: 06 November 2019 23:03 To: Microcontroller discussion list - Public. Subject: [PIC] Configuring a pin for input I'm having what seems a pretty bizarre problem. I'm using bit 14 of port A as an input to tell me when I need to pick up da= ta from an ADC. I am absolutely sure the pin is toggling low, but when I read the pin it's = always 1 in the port register. I'm aware of the AD1PCFG register which could cause this, but AFAIK that on= ly affects PORTB Fortunately, I'm using the PICKit4 ICE, so I can see the r= egister states as commented below. My init routine sets TRISA bit 14 high, and that's all that should matter.. What would cause bit 14 of PORTA to always read high when the pin itself is= low? int ADC_Check_Data() { int temp =3D 0; temp =3D PORTA; // Get the pin states // temp =3D 0x0000C0FF at this point, bit 14 is high though the pin its= elf is LOW. temp &=3D (1 << 14); // mask off all but bit 14 // Here I always get 0x00004000 Bit 14 is HIGH when the pin itself is L= OW. // AT THIS MOMENT: // LATA =3D 0x0000C0FF // ODCA =3D 0x00000000 // PORTA =3D 0x0000C0FF (shows bit 14 =3D HIGH) // TRISA =3D 0x0000C0FF (shows bit 14 as INPUT) // Low =3D data ready for reading. if (0 =3D=3D temp) { return 1; } else { return 0; } } -- David VanHorn Lead Hardware Engineer Backcountry Access, Inc. 2820 Wilderness Pl, Unit H Boulder, CO 80301 USA phone: 303-417-1345 x110 email: david.vanhorn@backcountryaccess.com -- http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive View/chang= e your membership options at http://mailman.mit.edu/mailman/listinfo/piclis= t -- http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive View/chang= e your membership options at http://mailman.mit.edu/mailman/listinfo/piclis= t --=20 http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .