I need to automatize a test procedure. So, I would like to apply a voltage and read it at the same time to decide whether it passed or not. I wrote a code for applied&expected voltage output but can't read the voltage while Analog Discovery's W1&W2 jumpers are connected to the related pin. Are there ways to do it ?
I tried this:
for j in range(len(analogOut.applied_TC)):
analogOut.voltage_DC = analogOut.applied_TC[j]
analogOut.amplitudeSet(CH1, analogOut.voltage_DC)
read_voltage_CH1 = analogOut.amplitudeGet(CH1)
expected_voltage_CH1 = analogOut.expected_TC[j]if((analogOut.voltage_DC *(1- float(analogOut.tolerance_TC[j])))<= read_voltage_CH1 <=(analogOut.voltage_DC *(1+ float(analogOut.tolerance_TC[j]))))and((expected_voltage_CH1 *(1- float(analogOut.tolerance_TC[j])))<= read_voltage_CH1 <=(expected_voltage_CH1 *(1+ float(analogOut.tolerance_TC[j])))):
x +=1print(f"\n Applied voltage:{analogOut.voltage_DC} and Read voltage:{read_voltage_CH1}, Expected voltage:{expected_voltage_CH1} are equal!")else:print(f"Applied voltage:{analogOut.voltage_DC} and Read voltage:{read_voltage_CH1}, Expected voltage:{expected_voltage_CH1} are NOT equal!!")if x ==3:print("x:",x)print("TEST PASSED")else:print("x:", x)print("TEST FAILED")
But analogOut.amplitudeGet(CH1) function doesn't read current voltage. (According to my verification activities)
def demo_analog_input_instrument_api_simple(analogIn):
channel_count = analogIn.channelCount()if channel_count ==0:print("The device has no analog input channels that can be used for this demo.")return
analogIn.reset()
CH1 =0whileTrue:
analogIn.status(False)print("analog input",", ".join("channel {}: {:25.20f} [V]".format(
channel_index, analogIn.statusSample(channel_index))for channel_index in range(channel_count)))print("Offset:", analogIn.channelOffsetGet(CH1))
time.sleep(0.010)
Question
Oznur Caliskan
Hi everyone,
I need to automatize a test procedure. So, I would like to apply a voltage and read it at the same time to decide whether it passed or not. I wrote a code for applied&expected voltage output but can't read the voltage while Analog Discovery's W1&W2 jumpers are connected to the related pin. Are there ways to do it ?
I tried this:
But analogOut.amplitudeGet(CH1) function doesn't read current voltage. (According to my verification activities)
I may need to use the analogIn.statusSample(channel_index) from this example: https://github.com/sidneycadot/pydwf/blob/master/source/pydwf-examples/AnalogInSimple.py Bu I couldnt use analogIn while I was using analogOut. Maybe I need to add this function to my AnalogOut class? :
Thanks in advance
Link to comment
Share on other sites
16 answers to this question
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now