Page 1 of 1

Pullups/pulldowns on discrete inputs

Posted: Wed Feb 21, 2018 4:10 pm
by csouter
How can I disable the pull-ups and pull-downs on a discrete input - i.e., I want to put the output logic into a tristate mode. Specifically, on pin B10 of a PIC24FJ256GB106. I am connected to a circuit that is extremely sensitive (and I can't get the board reworked at this stage of the game), and any pull-up or pull-down on the input pin causes me to not be able to read the discrete reliably. I can get the circuit to and the input pin to work if I program it in MpLab, but I can't get the equivalent logic to work in FlowCode.

Thank you.
Clive Souter

Re: Pullups/pulldowns on discrete inputs

Posted: Fri Feb 23, 2018 2:06 pm
by csouter
I finally figured out how to enable a pull-down on I/O Pin B10 (CNPD28), but I am still not able to read the input. I have a hard 3.3V input on the pin, and I always read a zero. Anybody have any suggestions?

Thank you
csouter

Re: Pullups/pulldowns on discrete inputs

Posted: Mon Feb 26, 2018 6:33 pm
by Benj
Hi Csouter,

An interesting snippet from the datasheet in section 10.2.
The AD1PCFGL and TRIS registers control the operation of the A/D port pins. Setting a port pin as an analog input also requires that the corresponding TRIS bit be set. If the TRIS bit is cleared (output), the digital output level (VOH or VOL) will be converted. When reading the PORT register, all pins configured as analog input channels will read as cleared (a low level).
The start of the Main function in the C code should have this line of code to set all the analogue pins to digital mode. Can you check this line is present in your C file.

Code: Select all

AD1PCFG = 0xffff;
Simply reading a pin connected to VCC using an input icon or an assignment in the calculation icon should return a 1. Can you confirm the voltage is present on the pin using a multimeter to confirm there are no breaks in the circuit.