When I run a simple 'experiment' to set some DDS channels I would like to be able to shut the channels off by terminating the process which set the channels. I am currently doing this by running
scheduler.check_pause() in a loop and shutting down the DDS if
check_pause() evaluates to True:
from artiq.experiment import *
from artiq.language import units
def build(self): #This code runs on the host device
self.urukul1_ch1.set(100 * units.MHz, amplitude = 1.0 * units.V)
# Check to see if the scheduler wants to pause then wait for delay time
delay_time = 10.0 * units.ms
When I run this code the DDS chanel is set to 100 MHz as expected, however, when I terminate the process in the dashboard it takes anywhere from 10-30 seconds before the DDS output actually shuts down.
If I put a print statement before
self.urukul1_ch1.sw.off() then it evaluates as soon as I terminate the process, but the DDS remains on for a random period.
I suspect there's something tricky going on with the time cursor.
I've tried inserting
self.core.wait_until_mu(now_mu()) with various delays to take care of the
RTIOUnderflow. Even putting a try except block in a while loop to dynamically choose the correct delay, but to no avail.