284
Chapter 6 Application Programs
Example: Microsoft Visual Basic for Windows
6
’
’ Triggered Burst
’
Arb.Output "output:state off" ’ Turn OFF Output BNC
Arb.Output "output:sync off" ’ Disable Sync BNC
Arb.Output "func square" ’ Select Function square
Arb.Output "frequency 20e3" ’ 20kHz
Arb.Output "volt 1;:volt:offset 0" ’ 1Vpp and 0V offset
Arb.Output "func:square:dcycle 20" ’ 20% duty cycle
Arb.Output "trig:sour bus" ’ Bus triggering
Arb.Output "burst:ncycles 3" ’ Burst of 3 cycles per trigger
Arb.Output "burst:state on" ’ Enable Burst
Arb.Output "output:state on" ’ Turn ON Output BNC
Arb.Output "output:sync on" ’ Enable Sync BNC
Check_Errors ’ Routine checks for errors
For i = 1 To 20
Arb.Output "*trg" ’ Send BUS trigger
Sleep 100 ’ Wait 100msec
Next i
MsgBox "Triggered Burst", vbOKOnly, "33250A Example"
’
’ Download a 20 point Arbitrary waveform using ASCII.
’
Dim Arb_20(0 To 19) As Double ’ Allocate array of 20 reals
Fill_array Arb_20 ’ Call routine to fill array
With Arb.IO.Write
.Command "data volatile,", False ’ Place command into buffer
.Argument(0) = Arb_20 ’ Place comma separated data into buffer
.Send ’ Send command + data
End With
Arb.Output "func:user volatile" ’ Select downloaded waveform
Arb.Output "apply:user 10e3,1,0" ’ Output waveform: 10kHz, 1Vpp
Check_Errors ’ Routine checks for errors
MsgBox "Download a 20 point Arb waveform using ASCII.", vbOKOnly, "33250A Example"
’
’ Download a 6 point Arbitrary waveform using Binary.
’ This example for GPIB only
’
Dim Arb_6() ’ Create array
Dim Length As Long ’ Used to find total length of array
Dim Command() As Byte ’ Used to store total command sequence
Arb_6 = Array(2047, -2047, 2047, 2047, -2047, -2047)
Length = IOUtils.CreateIEEEBlock(Arb_6, IIOUtils_Short, IIOUtils_BigEndian,
"data:dac volatile,", Command)
Arb.IO.WriteBytes Length, Command ’ Download command and bytes
Arb.Output "apply:user 5000,1,0" ’ Output waveform: 5kHz, 1Vpp
Check_Errors
MsgBox "Download a 6 point Arb waveform using Binary.", vbOKOnly, "33250A Example"
Continued...