suservo: refrain from generating channel list

For consistency with other DDS examples that uses multiple channels.
e.g. TTL relay external trigger, DDS synchronization
This commit is contained in:
occheung 2022-01-20 16:48:55 +08:00
parent 8404fed3da
commit ac8d398f5e
2 changed files with 9 additions and 11 deletions

View File

@ -821,16 +821,16 @@ In the following example, the amplitude of DDS is proportional to the ADC input
First, initialize the RTIO, SU-Servo and its channel. First, initialize the RTIO, SU-Servo and its channel.
Note that the programmable gain of the Sampler is $10^0=1$, the input range is [-10V, 10V]. Note that the programmable gain of the Sampler is $10^0=1$, the input range is [-10V, 10V].
\inputcolorboxminted{firstline=14,lastline=21}{examples/suservo.py} \inputcolorboxminted{firstline=12,lastline=19}{examples/suservo.py}
Next, setup the PI control as an IIR filter. It has -1 proportional gain $k_p$ and no integrator gain $k_i$. Next, setup the PI control as an IIR filter. It has -1 proportional gain $k_p$ and no integrator gain $k_i$.
\inputcolorboxminted{firstline=22,lastline=29}{examples/suservo.py} \inputcolorboxminted{firstline=20,lastline=27}{examples/suservo.py}
Then, configure the DDS frequency to 10 MHz with 3V input offset. Then, configure the DDS frequency to 10 MHz with 3V input offset.
When input voltage $\geq$ offset voltage, the DDS output amplitude is 0. When input voltage $\geq$ offset voltage, the DDS output amplitude is 0.
\inputcolorboxminted{firstline=30,lastline=34}{examples/suservo.py} \inputcolorboxminted{firstline=28,lastline=32}{examples/suservo.py}
SU-Servo encodes the ADC voltage in a linear scale [-1, 1]. SU-Servo encodes the ADC voltage in a linear scale [-1, 1].
Therefore, 3V is converted to 0.3. Therefore, 3V is converted to 0.3.
@ -838,7 +838,7 @@ Note that the ASF of all DDS channels are capped at 1.0, the amplitude clips whe
Finally, enable the SU-Servo channel with the IIR filter programmed beforehand. Finally, enable the SU-Servo channel with the IIR filter programmed beforehand.
\inputcolorboxminted{firstline=36,lastline=37}{examples/suservo.py} \inputcolorboxminted{firstline=34,lastline=35}{examples/suservo.py}
A 10 MHz DDS signal is generated from the example above, with amplitude controllable by ADC. A 10 MHz DDS signal is generated from the example above, with amplitude controllable by ADC.
The RMS voltage of the DDS channel against the ADC voltage is plotted. The RMS voltage of the DDS channel against the ADC voltage is plotted.

View File

@ -7,9 +7,7 @@ class SUServoExample(EnvExperiment):
def build(self): def build(self):
self.setattr_device("core") self.setattr_device("core")
self.suservo = self.get_device("suservo0") self.suservo = self.get_device("suservo0")
self.suschannels = [ self.suschannel0 = self.get_device("suservo0_ch0")
self.get_device("suservo0_ch0")
]
@kernel @kernel
def run(self): def run(self):
@ -18,8 +16,8 @@ class SUServoExample(EnvExperiment):
self.suservo.init() self.suservo.init()
self.suservo.set_pgia_mu(0, 0) # unity gain self.suservo.set_pgia_mu(0, 0) # unity gain
self.suservo.cplds[0].set_att(0, 15.) self.suservo.cplds[0].set_att(0, 15.)
self.suschannels[0].set_y(profile=0, y=0.) # Clear integrator self.suschannel0.set_y(profile=0, y=0.) # Clear integrator
self.suschannels[0].set_iir( self.suschannel0.set_iir(
profile=0, profile=0,
adc=0, # take data from Sampler channel 0 adc=0, # take data from Sampler channel 0
kp=-1., # -1 P gain kp=-1., # -1 P gain
@ -27,11 +25,11 @@ class SUServoExample(EnvExperiment):
g=0., # no integrator gain limit g=0., # no integrator gain limit
delay=0. # no IIR update delay after enabling delay=0. # no IIR update delay after enabling
) )
self.suschannels[0].set_dds( self.suschannel0.set_dds(
profile=0, profile=0,
offset=-.3, # 3 V with above PGIA settings offset=-.3, # 3 V with above PGIA settings
frequency=10*MHz, frequency=10*MHz,
phase=0.) phase=0.)
# enable RF, IIR updates and set profile # enable RF, IIR updates and set profile
self.suschannels[0].set(en_out=1, en_iir=1, profile=0) self.suschannel0.set(en_out=1, en_iir=1, profile=0)
self.suservo.set_config(enable=1) self.suservo.set_config(enable=1)