Hello,
Before all, sorry for my bad english, i'm french
I wrote a program in VB6 to load a waveform in the hp33120A by RS-232
after loading points in volatile memory, I send an OPC? query
When I read response, I have a timeout.
Your help will be greatly appreciated
A part of my program: (before that I set flow control to DTR-DSR and baud rate to 9600
'Query the number of non-volatile memory slots available to store user-defined waveforms
Fgen.WriteString "DATA:NVOLatile:FREE?"
strGReturned = Fgen.ReadString
' strGReturned will contains “0” (memory is full), “1”, “2”, “3”, or “4”
If CInt(strGReturned) = 0 Then
'We erase all the memory
Fgen.WriteString "DATA:DELete:ALL"
MsgBox ("Generator's memory is full, all waveform are deleted except the active signal")
End If
'Memory is available, we load waveform
Me.MessageLog.Text = MessageLog.Text & vbCrLf & "Operation Loading " & strSignalName & " ..."
'All points are concatenate in strSignalName, signal frequency is also set in strFrequency
strWaveformPoints = waveformLoad(IniFilePath, strSignalName, strFrequency)
Debug.Print "Avant => " & strWaveformPoints
'if points are not separated by commas
If InStr(strWaveformPoints, ",") = 0 Then
'a temporary string
Dim strTemp As String
strTemp = ""
'deleting space in the string
strWaveformPoints = Trim(strWaveformPoints)
'caracters are separated by a comma
For indice% = 1 To Len(strWaveformPoints) - 1
strTemp = strTemp & Mid(strWaveformPoints, indice, 1) & ", "
'Debug.Print strTemp
Next indice
'The last point will not be followed by a comma
strTemp = strTemp & Mid(strWaveformPoints, Len(strWaveformPoints), 1)
'Now expression fulfils the generator requirement
strWaveformPoints = strTemp
End If
Debug.Print "Apres => " & strWaveformPoints
Fgen.WriteString "DISP:TEXT 'LOADING" & strSignalName & "'"
'sending a caracter takes 1.1 ms, therefore the timeout should cover all transmission duration
Debug.Print Len(strWaveformPoints)
Fgen.IO.Timeout = 1.1 * (Len(strWaveformPoints) + 20) + 10000
Debug.Print Fgen.IO.Timeout
'Enabling trig from the rear panel of the arbitrary waveform generator
Fgen.WriteString "Trig:Sour ext"
'Enabling burst mode
Fgen.WriteString "BM:State On"
'loading points in volatile memory
Delay 500
Fgen.WriteString "DATA VOLATILE, " & strWaveformPoints
'Timeout is fixed to 20 seconds for other commands
Fgen.IO.Timeout = 20000
'1s pause for the generator before sending another command
Delay 1000
'Check if operations are complete
'Return “1” to the output buffer after the previous commands have been executed
Fgen.WriteString "*OPC?"
'Get the string from the output buffer
strGReturned = Fgen.ReadString
'We empty the output buffer
Fgen.FlushRead
'Print success in AWG front-end
Fgen.WriteString "DISP:TEXT 'SUCCESS'"
'Store waveform in non volatile memory, therefore, no need to load it again
Fgen.WriteString "DATA:COPY " & strSignalName & ", VOLATILE"