High vs High-Z State – How to Differentiate in Digital Logic

digital-logichigh-impedancetri-state

I'm using this MCP73831 device.

I want to know how what to expect as a voltage level on the STAT pin when the below chart on page 13 says, STAT = HIGH & STAT = HIGH-Z.

enter image description here

When the charging is completed, I need to see HIGH voltage (say if Vdd is 5V, then HIGH would indicate 5V) 5V on the pin, as it is mentioned as HIGH.

When it is mentioned as high-Z state, then also, I will see the same 5V, right?

How can I differentiate between high and high-Z state?

This charge complete mode would also mean the same when there is no battery connected to Vbat right? So, when charging is complete or the battery is disconnected, then the STAT pins would show the same result, right?

Best Answer

(My first answer, be gentle!)

A trick I have used in this situation is to connect the line in question (Stat) to a GPIO pin on a microcontroller that supports internal pull-up and pull-down resistors. It does not need to have an ADC.

  1. Activate that pin's pull-up resistor
  2. Read and record the state of that pin
  3. Disable the pull-up and enable the pull-down
  4. Read and record the state of the pin again

If the pin reads high both times, then Stat is high. If it reads high, then low, then Stat is High-Z. And if it reads low both times, Stat is low.

Doing it this way has an added benefit of not consuming extra current for a voltage divider.