Hey Everyone,
I'm currently trying send the following SCPI command.
:MMEMATA "ARBI:<waveform name>", #ABC <------- Will the "#" be an issue
"<waveform name>"
the name of the waveform file within the signal generator.
A
the number of decimal digits to follow in B.
B
a decimal number specifying the number of data bytes in C.
C
the binary waveform data in 2-byte integers
I have several thousand bytes of data to send
Here is the code I have written, how do I format the data or change the code so that it will work properly?
# Download waveform to ESG
proc ::ESG::download_wfm {esg sour_fi sour_fq name} {
# open the source files
set fi [open $sour_fi]
set fq [open $sour_fq]
# fill arrays with the data
set i 0
while {1} {
set i_data [gets $fi]
set q_data [gets $fq]
set I_raw($i) $i_data
set Q_raw($i) $q_data
if {[eof $fi]} {
close $fi
close $fq
set Npoints [array size I_raw]
set Nbytes [expr $Npoints*2]
set Ndigits 5
break
}
incr i
}
# Convert to integer 0 to 16838
for {set j 0} {$j < $Npoints} {incr j} {
set Iwfm_data($j) [expr int(8191 + $I_raw($j)*8192)]
set Qwfm_data($j) [expr int(8191 + $Q_raw($j)*8192)]
}
set I
I'm currently trying send the following SCPI command.
:MMEMATA "ARBI:<waveform name>", #ABC <------- Will the "#" be an issue
"<waveform name>"
the name of the waveform file within the signal generator.
A
the number of decimal digits to follow in B.
B
a decimal number specifying the number of data bytes in C.
C
the binary waveform data in 2-byte integers
I have several thousand bytes of data to send
Here is the code I have written, how do I format the data or change the code so that it will work properly?
# Download waveform to ESG
proc ::ESG::download_wfm {esg sour_fi sour_fq name} {
# open the source files
set fi [open $sour_fi]
set fq [open $sour_fq]
# fill arrays with the data
set i 0
while {1} {
set i_data [gets $fi]
set q_data [gets $fq]
set I_raw($i) $i_data
set Q_raw($i) $q_data
if {[eof $fi]} {
close $fi
close $fq
set Npoints [array size I_raw]
set Nbytes [expr $Npoints*2]
set Ndigits 5
break
}
incr i
}
# Convert to integer 0 to 16838
for {set j 0} {$j < $Npoints} {incr j} {
set Iwfm_data($j) [expr int(8191 + $I_raw($j)*8192)]
set Qwfm_data($j) [expr int(8191 + $Q_raw($j)*8192)]
}
set I
foreach i_element [lsort -integer [array names Iwfm_data]] {
lappend I $Iwfm_data($i_element)
}
set Q
foreach q_element [lsort -integer [array names Qwfm_data]] {
lappend Q $Qwfm_data($q_element)
}
# A B C from above
COMMON::write_instrument $esg ":MMEMATA ARBI:$name,#*$Ndigits$Nbytes$I"
COMMON::write_instrument $esg ":MMEMATA ARBQ:$name,#*$Ndigits$Nbytes$Q"
}
#----------------------------------------------------------------------------------------
Please let me know how to fix this, or if there is a mistake in my code
Thanks in advance,
CAO