The code below was developed using Microsoft Visual Basic 6.0 and the Agilent VISA COM objects to download 16M points to the 33521A/33522A with option 002 16 MSa Arb Memory.
Option Explicit
' """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
' Copyright © 2011 Agilent Technologies Inc. All rights
' reserved.
'
' You have a royalty-free right to use, modify, reproduce and distribute
' the Sample Application Files (and/or any modified version) in any way
' you find useful, provided that you agree that Agilent has no
' warranty, obligations or liability for any Sample Application Files.
'
' Agilent Technologies provides programming examples for illustration only,
' This sample program assumes that you are familiar with the programming
' language being demonstrated and the tools used to create and debug
' procedures. Agilent support engineers can help explain the
' functionality of Agilent software components and associated
' commands, but they will not modify these samples to provide added
' functionality or construct procedures to meet your specific needs.
' """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
Private Sub cmdBinaryArb_Click()
' This program is an example program intended for use with
' Microsoft Visual Basic 6.0 and the Agilent VISA COM objects.
'
' To use the IO object in another Visual Basic project, set the
' reference to include the libraries in the Project/References menu:
' "VISA COM 3.0 Type Library", corresponds to VISACOM.tlb
' "VISA COM 488.2 Formatted I/O 1.0", corresponds to the BasicFormattedIO.dll
'
' Then use a statement such as "Dim Fgen As VisaComLib.FormattedIO488"
' to create the formatted I/O reference and use
' "Set Fgen = New VisaComLib.FormattedIO488" to create the actual object.
Dim io_mgr As VisaComLib.ResourceManager
Dim Fgen As VisaComLib.FormattedIO488
Set io_mgr = New VisaComLib.ResourceManager
Set Fgen = New VisaComLib.FormattedIO488
Set Fgen.IO = io_mgr.Open(txtIO.Text, NO_LOCK, 2000, "")
Dim Waveform() As Integer
Dim I As Long
Dim Ncycles As Integer
Dim Damp_factor As Single
Dim Value As String
Dim pi As Single
ReDim Waveform(1 To 16000000)
On Error GoTo MyError
' This program shows how to down load an arbitrary waveform
' using binary data. The program generates a damped sine
' wave using 5 M points out of a 16 M waveform.
With Fgen
.IO.Timeout = 400000 ' Set timeout to 400 seconds for long download strings
.WriteString "*RST;*CLS" ' Reset the function generator
.WriteString "DATA:VOLatile:CLEar" ' Clear volatile memory
.WriteString "FORMat:BORDer NORMal" ' Normal data bytes (send MSB first)
.WriteString "SOURCE1:FUNC:ARB:FILTER STEP" ' Output filter
.WriteString "SOURCE1:FUNC:ARB:SRATE 1000000" ' Sample Rate
End With
txtError.Text = ""
txtError.SelText = "Computing Waveform..." & vbCrLf
Ncycles = 10 ' Define number of sinewave cycles
Damp_factor = -5 ' Define damping factor
pi = 3.14159 ' Define pi
'
' Calculate data points
'
For I = 1 To 16000000
If I < 5000000 Then
Waveform(I) = (Sin(2 * pi * Ncycles * I / 5000000) * 32767)
Waveform(I) = Waveform(I) * Exp(Damp_factor * I / 5000000)
Else
Waveform(I) = 0
End If
Next I
' Download data points to volatile memory from array
txtError.SelText = "Downloading Arb..." & vbCrLf
With Fgen
.WriteIEEEBlock "SOUR1:DATA:ARB:DAC myArb,", Waveform
.WriteString "*OPC?"
Value = .ReadString
End With
txtError.SelText = "Download Complete" & vbCrLf
With Fgen
.WriteString "SOURCE1:VOLT 2" ' 2 Vpp
.WriteString "SOURCE1:VOLT:OFFSET 4" ' 4 V offset
.WriteString "SOURCE1:FUNCTION:ARBitrary myArb" ' Select which arb to output
.WriteString "Source1:FUNCtion ARB" ' Output an arbitrary waveform
.WriteString "OUTPut1 ON" ' Enable output
End With
Exit Sub
MyError:
txtError = Err.Description & vbCrLf
Resume Next
End Sub
No one else has this question
Also, I have noticed in your example that you use "IEEE binary block" style... any reason? Is that required for longer waveforms? The manual seems to indicate that either binary block or list of comma seperated numbers should work.
Your example works fine for me in VBA, but I am still not shure why I can't go over 2^16 points using labVIEW with comma seperated values... rather than the WriteIEEEblock from Agilent's VISACOM 3.0?
<EDIT> I just saw other posts showing this issue at 64k and need for binary data for larger. - Thanks