Note:
R4 = 180K Resistor
D1 to D5 = 1N4148 Diode
If Vin less than V2, the output of IC2 will be the positive ramp waveform, C1 will discharge slowly cause the T1 range as long times. And reduce the value of V2 down, but if V1 more than V2, the output of IC2 will be the negative ramp waveform...