adding try execpt
This commit is contained in:
parent
2317fd73c8
commit
3865bb8216
@ -1,4 +1,5 @@
|
||||
import ctypes
|
||||
import time
|
||||
|
||||
import uldaq
|
||||
from IPython import embed
|
||||
@ -20,28 +21,31 @@ class Calibration(Repos):
|
||||
data = AMPLITUDE * np.sin(2 * np.pi * SINFREQ * time)
|
||||
# sending stimulus
|
||||
|
||||
stim, ao_device = self.send_analog_dac(
|
||||
stim, ao_device = self.write_analog_dac(
|
||||
data, [0, 0], SAMPLERATE, ScanOption=uldaq.ScanOption.EXTTRIGGER
|
||||
)
|
||||
|
||||
# read_data = self.read_analog_daq(
|
||||
# [0, 1], DURATION, SAMPLERATE, ScanOption=uldaq.ScanOption.EXTTRIGGER
|
||||
# )
|
||||
data = self.read_digitalio([0, 0], DURATION, SAMPLERATE)
|
||||
self.digital_trigger()
|
||||
ao_device.scan_wait(uldaq.WaitType.WAIT_UNTIL_DONE, -1)
|
||||
self.digital_trigger(data=0)
|
||||
|
||||
self.disconnect_dac()
|
||||
self.connect_dac()
|
||||
self.set_analog_to_zero()
|
||||
embed()
|
||||
exit()
|
||||
# trigger the 0 channel to start the aqcuisition
|
||||
self.write_bit(channel=0, bit=1)
|
||||
try:
|
||||
ao_device.scan_wait(uldaq.WaitType.WAIT_UNTIL_DONE, 15)
|
||||
except uldaq.ul_exception.ULException:
|
||||
log.debug("Operation timed out")
|
||||
self.write_bit(channel=0, bit=0)
|
||||
self.disconnect_dac()
|
||||
self.connect_dac()
|
||||
self.set_analog_to_zero()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
SAMPLERATE = 40_000.0
|
||||
DURATION = 5
|
||||
DURATION = 10
|
||||
AMPLITUDE = 1
|
||||
SINFREQ = 1
|
||||
SINFREQ = 100
|
||||
daq_input = Calibration()
|
||||
daq_input.run_calibration()
|
||||
# daq_input.run_calibration()
|
||||
daq_input.attenuator()
|
||||
|
Loading…
Reference in New Issue
Block a user