I'm having a problem regarding ADC lectures. I think it might be that this sigma-delta is not capable for what I'm trying to do.
I'm trying to control a tri-state buffer by switching it to Low/High depending of the value of a resistor divisor that is connected at the output of the buffer.
The problem comes when I try to read the ADC outputs. I want to obtain the value when the buffer is already in the new state (it takes around 40 usec), but the ADC is giving me values of the transitory state, leading to wrong results as I can not read properly the values in the final state.
This is an output in Hyperterminal of what I'm seeing:
I will explain what's happening here: I have a threshold at 1.6V, and I want to switch to Low the buffer if this voltage is exceeded. When this happens, the final voltage is about 0.35V (takes about 40 usec to reach final value), and in this state I always want the buffer to be switched High in order to read again the original value (which is about 1.6V).
As you can see the functionality is a total mess. The first lecture is correct, 1.6V, then it switches the buffer Low (it should be 0.35V) but then the lecture is 0,67V. Then it comes back to High as explained (1.604435V) and as its higher than 1.6 it goes back to Low state. There you can see the problems. It takes 5 conversions to get back to 1.605103V.
The code I'm using is attached.
Do you know any method to obtain the correct values without affecting too much on the conversion rate?
Thank you in advance.