beautypg.com

RIGOL DS1000D User Manual

Page 117

background image

Programming Guide for DS1000E, DS1000D Series

3-13

lpszBuffer As Long) As Boolean
Private Declare Function GetDeviceNum Lib "RigolTMCUsb_UI.dll" () As Long

5. Add a subfunction as follows to send commands and get returned values.


'send a setting command
Sub SendToUSB(cmd As String)
Dim retcode As Boolean
Dim send_buf(256) As Byte
Dim temp As Long
Dim cmdstr As String

cmdstr = cmd

temp = Len(cmdstr)
For i = 0 To temp - 1
tempStr = Mid(cmdstr, i + 1, 1)
send_buf(i) = Asc(tempStr)
Next i
'send a command to the oscilloscope

' the definition of interface has been mentioned in Rigolusb.h
retcode = WriteUSB(0, 1, 1, Len(cmdstr), VarPtr(send_buf(0)))

End Sub

'acquire the Returned Value
Public Function Read_USB() As Long

Dim retcode As Boolean
Dim i, size As Long
Dim rSize As Long

rSize = 100

'send the command to the oscilloscope

retcode = WriteUSB(0, 2, 2, 10240, 0)

'get value from the oscilloscope
retcode = ReadUSB(0, VarPtr(rSize), VarPtr(rcv_buffer(0)))

This manual is related to the following products: