Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

GPIB: SCPI Help

Status
Not open for further replies.

orrca2112

Programmer
May 27, 2013
3
US
Hey Everyone,

I'm currently trying send the following SCPI command.

:MMEM:DATA "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 ":MMEM:DATA ARBI:$name,#*$Ndigits$Nbytes$I"
      COMMON::write_instrument $esg ":MMEM:DATA 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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top