forked from M-Labs/artiq
1
0
Fork 0

update NAC3

This commit is contained in:
Sebastien Bourdeauducq 2022-03-30 08:43:08 +08:00
parent b1cfd343eb
commit 34f3862558
3 changed files with 10 additions and 9 deletions

View File

@ -10,7 +10,7 @@ time is an error.
from numpy import int32, int64 from numpy import int32, int64
from artiq.language.core import nac3, kernel, portable, Kernel, KernelInvariant from artiq.language.core import *
from artiq.language.units import ns, us from artiq.language.units import ns, us
from artiq.coredevice.core import Core from artiq.coredevice.core import Core
from artiq.coredevice.ttl import TTLOut from artiq.coredevice.ttl import TTLOut
@ -313,7 +313,7 @@ class AD53xx:
self.ldac.on() self.ldac.on()
@kernel @kernel
def set_dac_mu(self, values: list[int32], channels: list[int32]): # NAC3TODO default list(range(40)) def set_dac_mu(self, values: list[int32], channels: Option[list[int32]] = none):
"""Program multiple DAC channels and pulse LDAC to update the DAC """Program multiple DAC channels and pulse LDAC to update the DAC
outputs. outputs.
@ -335,14 +335,15 @@ class AD53xx:
t_10 = self.core.seconds_to_mu(1500.*ns) t_10 = self.core.seconds_to_mu(1500.*ns)
# compensate all delays that will be applied # compensate all delays that will be applied
delay_mu(-t_10-int64(len(values))*self.bus.xfer_duration_mu) delay_mu(-t_10-int64(len(values))*self.bus.xfer_duration_mu)
channels_list = channels.unwrap() if channels.is_some() else [i for i in range(40)]
for i in range(len(values)): for i in range(len(values)):
self.write_dac_mu(channels[i], values[i]) self.write_dac_mu(channels_list[i], values[i])
delay_mu(t_10) delay_mu(t_10)
self.load() self.load()
at_mu(t0) at_mu(t0)
@kernel @kernel
def set_dac(self, voltages: list[float], channels: list[int32]): # NAC3TODO default list(range(40)) def set_dac(self, voltages: list[float], channels: Option[list[int32]] = none):
"""Program multiple DAC channels and pulse LDAC to update the DAC """Program multiple DAC channels and pulse LDAC to update the DAC
outputs. outputs.

View File

@ -55,7 +55,7 @@ class NAC3Devices(EnvExperiment):
self.core.reset() self.core.reset()
self.zotino0.init() self.zotino0.init()
self.zotino0.set_leds(0x15) self.zotino0.set_leds(0x15)
self.zotino0.set_dac([1.2, -5.3, 3.4, 4.5], [0, 1, 2, 3]) self.zotino0.set_dac([1.2, -5.3, 3.4, 4.5])
self.core.break_realtime() self.core.break_realtime()
self.mirny0_cpld.init() self.mirny0_cpld.init()

View File

@ -45,11 +45,11 @@
"nixpkgs": "nixpkgs" "nixpkgs": "nixpkgs"
}, },
"locked": { "locked": {
"lastModified": 1648508200, "lastModified": 1648584347,
"narHash": "sha256-8ohq5rj5rV9xyHDbU0oT/2CXT917XQYtxU92GIC+43s=", "narHash": "sha256-m27UgTuWDO6rLkwNdxBeGXW7rLZbdl5vCp7afe0P4qo=",
"ref": "master", "ref": "master",
"rev": "a38cc0444456392fba6949367e4073ee9df149bf", "rev": "b8ef44d64eabf62175d2b3e900124e0607c7b4d3",
"revCount": 705, "revCount": 710,
"type": "git", "type": "git",
"url": "https://git.m-labs.hk/m-labs/nac3.git" "url": "https://git.m-labs.hk/m-labs/nac3.git"
}, },