I'd like to interface the STAT line of an MCP73831 lithium ion charge manager IC to a microcontroller to read the current charging status of it.
The datasheet explains, in the section 5.2.1, that the STAT line is tristate output and have the following status:
and a table is provided that explains how each level represents each charging states of the battery.
How can I connect this pin to a microcontroller I/O and read these three distinct states?
Reading High and Low is quite straightforward, but detecting a input is high impedance I've not done before.
You could tie it to ground and Vcc with two 10k resistors, and use an A/D input to read the level.
If you don't have an A/D to spare connect it to another pin of your uC with a 10k resistor. If the pin is either high or low it will of course read as high resp. low (assuming it can drive a 10k load). If it is high impedance it will read equal to what you output on the other pin.