Unstable Digital Output Pins Behavior

For a pin to be a digital I/O, the analog capabilities of the pin must be disabled if the pin presents this feature. Do this by configuring the corresponding ANSEL register. The TRIS registers must be configured and then, using the LAT registers, set the output values of the pins.

Setting a TRISx bit (= 1) will make the corresponding PORTx pin an input. Clearing a TRISx bit (= 0) will make the corresponding PORTx pin an output. Although, in some cases, the same pin is used both as output and input of the module. For example, for all modes of EUSART operation, the TRIS control bits corresponding to the RX/DT and TX/CK pins should be set to 1.

The EUSART control will automatically reconfigure the pin from input to output as needed. Another example is the SDA line of the I²C module, which is also an input and an output. The corresponding TRIS bit should be set as 1 and the module will take control of the pin. For more information see the PORTx I/O Summary table for each device.

© 2018 Microchip Technology, Inc.
Notice: ARM and Cortex are the registered trademarks of ARM Limited in the EU and other countries.
Information contained on this site regarding device applications and the like is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE. Microchip disclaims all liability arising from this information and its use. Use of Microchip devices in life support and/or safety applications is entirely at the buyer's risk, and the buyer agrees to defend, indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting from such use. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual property rights.