Sample Program
7-9
IM 701730-17E
7
msg = "WAVEFORM:RECORD 0" 'Record number = 0
sts = TmSend(Dev, msg)
If (sts <> CTL_OK) Then
Call DisplayError(Dev)
GetWord = 1
Exit Function
End If
msg = "WAVEFORM:FORMAT WORD" 'Data Format = WORD
sts = TmSend(Dev, msg)
If (sts <> CTL_OK) Then
Call DisplayError(Dev)
GetWord = 1
Exit Function
End If
msg = "WAVEFORM:BYTEORDER LSBFIRST" 'Data Byte order = LSB First(for
Little Endian)
sts = TmSend(Dev, msg)
If (sts <> CTL_OK) Then
Call DisplayError(Dev)
GetWord = 1
Exit Function
End If
msg = "WAVEFORM:START 0;END 1001" 'START 0,END 1001(Length = 1002)
sts = TmSend(Dev, msg)
If (sts <> CTL_OK) Then
Call DisplayError(Dev)
GetWord = 1
Exit Function
End If
msg = "WAVEFORM:RANGE?" 'Get V/div value
sts = TmSend(Dev, msg)
If (sts <> CTL_OK) Then
Call DisplayError(Dev)
GetWord = 1
Exit Function
End If
sts = TmReceive(Dev, qry, Len(qry), rlen)
If (sts <> CTL_OK) Then
Call DisplayError(Dev)
GetWord = 1
Exit Function
End If
vdv = Val(qry)
msg = "WAVEFORM:OFFSET?" 'Get Offset value
sts = TmSend(Dev, msg)
If (sts <> CTL_OK) Then
Call DisplayError(Dev)
GetWord = 1
Exit Function
End If
sts = TmReceive(Dev, qry, Len(qry), rlen)
If (sts <> CTL_OK) Then
Call DisplayError(Dev)
GetWord = 1
Exit Function
End If
ofs = Val(qry)
msg = "WAVEFORM:SEND?" 'Receive Waveform Data
sts = TmSend(Dev, msg)
If (sts <> CTL_OK) Then
Call DisplayError(Dev)
GetWord = 1
Exit Function
End If
sts = TmReceiveBlockHeader(Dev, dlg) 'Receive Block Header
If (sts <> CTL_OK) Then 'dlg = Data Byte Length
Call DisplayError(Dev)
GetWord = 1
Exit Function
End If
sts = TmReceiveBlock(Dev, WaveBuffer(), dlg + 1, rlen, endflag)
'Receive Waveform Data + LF
If (sts <> CTL_OK) Then
Call DisplayError(Dev)
GetWord = 1
Exit Function
End If
For i = 0 To (dlg / 2 - 1) Step 1
dat = WaveBuffer(i) * vdv / 3072 + ofs
List1.AddItem CStr(i) + ":" + CStr(dat)
Next i
7.5 Data Output in Word Format (2 bytes)