Hi there, David. Which microcontroller are you using? I'm guessing that it's one of=20 the larger devices - but no matter, I guess. I would be looking at the following: 1) Are you sure that you are actually manipulating the TRIS=20 register? Wrong bank, for example? 2) Are there any configuration registers that disable the digital=20 input for that pin? Eg. anything analog that might use that pin? I know that the above are obvious things that you have already looked=20 at but I'm just reiterating them. dwayne At 04:03 PM 11/6/2019, David Van Horn wrote: >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=20 >pick up data from an ADC. >I am absolutely sure the pin is toggling low, but when I read the=20 >pin it's always 1 in the port register. >I'm aware of the AD1PCFG register which could cause this, but AFAIK=20 >that only affects PORTB >Fortunately, I'm using the PICKit4 ICE, so I can see the register=20 >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=20 >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=20 > pin itself is LOW. > temp &=3D (1 << 14); // mask off all but bit 14 > // Here I always get 0x00004000 Bit 14 is HIGH when the pin=20 > itself is LOW. > // 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:=20 >david.vanhorn@backcountryaccess.com --=20 Dwayne Reid Trinity Electronics Systems Ltd Edmonton, AB, CANADA 780-489-3199 voice 780-487-6397 fax 888-489-3199 Toll Free www.trinity-electronics.com Custom Electronics Design and Manufacturing --=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 .