C. Discharge Cycle 3In the third discharge cycle, P1 is set to high impedance, P2 is set high, and P3 and P4 are set to low. For this condition switches S1 and S2 are set at position “1” and S3 alone is set to position “0.” Hence diode D1 is OFF and diode D2 conducts. Capacitor C discharges through resistance RT3=Ros . Once again, the time Tl taken for the capacitor C to discharge and reach the threshold voltage VTL is measured using the internal counter of the microcontroller as NlTc . On similar lines Tl can be derived as