Electronic – How to tristate output digital pin on a pic 16 series microcontroller

coutputpictri-statexc8

I know that I can set digital output pins as high and low like this in c:

OUTPUT_PIN = 1;
OUTPUT_PIN = 0;

Is there any way to set that said pin as tristate or high impedance output, as some external chips (I'll be using sram chip) require tristated/high impedance inputs to them?

I'm using xc8 c compiler.

Best Answer

Page 29 of the Microchip 41213D.pdf document has figure 6-1: enter image description here

The D FF labelled (TRIS LATCH) means that is the TRS-state latch. It controls (Gates) the signals from the data latch to turn off the P AND N transistors. The input to the TRSI Latch is the W Reg.

Related Topic