-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathmultiplexerTest.jl
More file actions
66 lines (52 loc) · 1.75 KB
/
multiplexerTest.jl
File metadata and controls
66 lines (52 loc) · 1.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
using RedPitayaDAQServer
using GLMakie
# obtain the URL of the RedPitaya
include("config.jl")
rp = RedPitaya(URLs[1])
serverMode!(rp, CONFIGURATION)
dec = 8
modulus = 128
base_frequency = 125000000
periods_per_step = 1
samples_per_period = div(modulus, dec)
periods_per_frame = 1000
steps_per_frame = periods_per_frame
time = collect(0:samples_per_period*periods_per_frame-1) ./ (base_frequency/dec)
decimation!(rp, dec)
samplesPerPeriod!(rp, samples_per_period)
periodsPerFrame!(rp, periods_per_frame)
freq = base_frequency / modulus / periods_per_frame
@info "Sampling Frequency: $(base_frequency / dec / 1e6) MS/s"
@info "Multiplexer Frequency: $(base_frequency / modulus / 1e6) MS/s"
@info "Effective Sampling Frequency: $(base_frequency / modulus / 1e3 / 8) kS/s"
@info "Tx Frequency: $freq Hz"
frequencyDAC!(rp,1,1, freq)
signalTypeDAC!(rp, 1 , 1, "SINE")
amplitudeDAC!(rp, 1, 1, 0.99)
phaseDAC!(rp, 1, 1, 0.0 )
frequencyDAC!(rp,2, 1, freq)
signalTypeDAC!(rp, 2 , 1, "SINE")
amplitudeDAC!(rp, 2, 1, 0.99*0)
phaseDAC!(rp, 2, 1, π/2*0 )
triggerMode!(rp, INTERNAL)
# Sequence Configuration
clearSequence!(rp)
stepsPerFrame!(rp, steps_per_frame)
seqChan!(rp, 1)
lut = collect(range(-0.5,0.5,length=steps_per_frame))*0
seq = SimpleSequence(lut, 1)
sequence!(rp, seq)
counterSamplesPerStep!(rp, modulus ÷ (dec) )
serverMode!(rp, ACQUISITION)
masterTrigger!(rp, true)
sleep(0.1)
uCurrentFrame = readFrames(rp, 0, 1)
masterTrigger!(rp, false)
serverMode!(rp, CONFIGURATION)
fig = Figure(size = (1200, 600))
ax = Axis(fig[1, 1], title = "Multiplexer Test", xlabel = "Time [s]")
lines!(ax, time, vec(uCurrentFrame[:,1,:,:]), label = "Rx1")
lines!(ax, time, vec(uCurrentFrame[:,2,:,:]), label = "Rx2")
axislegend(ax)
#save(joinpath(@__DIR__(), "images", "sequence.png"), plot)
fig