Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Seeing your username I assume that this is homework. Without updating your progress and what you've tried this will get you nowhere. Second post all your erroneous code. I do not think that this will compile without using any lib's.
The load is a device which behaves like a cap. The 0 Ohm is for normal operation. The 5k is to measure the capacitance and the 100k are for protection from false cabeling (switch 110V and GND). I can't measure the capacitance with 100k for some reasons, 5K is the minimum and maximum because of the limitations of some already existing adcs and voltage dividers. 5K is not good for protection because it would need a 3Watt upwards resistor.
I want to be able to insert a resistor (0Ohms, 5K and 100K) between the source and load. This pretty much sums it up. Currenlty the most reasonable approach looks like a relay which either shorts a digital poti or puts the poti into the line.
Do you get any warnings at compilation time, especially timing? And from the link to the forum: Have you replaced your clock with a stable clock? Else, you'll never get a good result. Without reading the datasheet: Is there an alternative clock? Like onchip clock from the spartan 3 that you can use?
What I meant with switching voltages is, I changed the testvoltage the LCR meter is able to, while being connected with the cap. I don't see why the circuit should damage the device. It's an ADC input which is the connection to a live circuit, but nothing else is powered in the area the LCR meter is making it's measurements.
A bit off-topic, but I am always wondering why someone should reverse engineer something except, if it's for personal knowledge, or the PCB is too old to get spare parts. Is this the case? Or can you tell why you want to get to know this PCB?
So is my tau approximately (C1 + C2 + C5) * (R1+(R3+R4)//R5) ? In the case I ignore R2? If I do that I get a tau of around 2ms (in the simulation I get that it should be 0.5ms, ignoring R2) so I guess that the formula is not right and R2 is massively influencing the load sequence.