CHAPTER3.txt Driver File Contents (ApplicationDiskRev20.zip)

Chapter 3
Example Programs


3.1 RS-232C Example Programs 


Example 1 Using a setting command

 *Send the command in the format specified, when the conditions
  for the command to be acceptable are met.

Private Sub Sample1_Click()
'*******************************************************************************
' RS232C SAMPLE PROGRAM NO.1
'*******************************************************************************

deli$ = Chr$(13) & Chr$(10) 

Comm1.PortOpen = True 

Comm1.Output = ":FUNCTION MEM" & deli$ 
Comm1.Output = ":CONFIGURE:TDIV 1.E-3" & deli$ 
Comm1.Output = ":CONFIGURE:SHOT 20" & deli$ 

Comm1.Output = ":TRIGGER:SOURCE OR" & deli$ 
Comm1.Output = ":TRIGGER:KIND CH1,LEVEL" & deli$ 
Comm1.Output = ":TRIGGER:PRETRIG 5" & deli$ 
Comm1.Output = ":TRIGGER:LEVEL CH1,2" & deli$ 
Comm1.Output = ":TRIGGER:SLOPE CH1,UP" & deli$ 
Comm1.Output = ":TRIGGER:KIND CH2,OFF" & deli$ 
Comm1.Output = ":TRIGGER:KIND CH3,OFF" & deli$ 
Comm1.Output = ":TRIGGER:KIND CH4,OFF" & deli$ 

Comm1.Output = ":START" & deli$ 

Comm1.PortOpen = False 
End Sub



Example 2 Using a query

 *Send the query in the format specified, when the conditions for
  the query to be acceptable are met.
 *The response data from the query is returned in the format
  

Private Sub Sample2_Click()
'*******************************************************************************
' RS232C SAMPLE PROGRAM NO.2
'*******************************************************************************

deli$ = Chr$(13) & Chr$(10) 

Comm1.PortOpen = True 

Comm1.Output = ":HEADER OFF" & deli$ 
Comm1.Output = ":FUNCTION?" & deli$ 
Do
ans$ = ans$ & Comm1.Input 
Loop Until InStr(1, ans$, Chr$(10))

Comm1.Output = ":SYSTEM:TIME?" & deli$ 
Do
tm$ = tm$ & Comm1.Input 
Loop Until InStr(1, tm$, Chr$(10))

Text1.Text = "FUNCTION = " & ans$
Text1.Text = Text1.Text & "TIME = " & tm$
Comm1.PortOpen = False 
End Sub


Example 3 Outputting stored data

 *Using the :MEMORY:MAXPOINT? query, this program checks whether
  data can be output from memory. If this query returns zero,
  no data is stored, and it cannot therefore be output.
 *Next, the program specifies the channel and point for output,
  using the :MEMORY:POINT command. As data is input or output,
  the point is incremented automatically. If capturing data
  consecutively, it is sufficient to specify the point once only.
 *To capture data in ASCII format use the :MEMORY:ADATA? query,
  and to capture data as voltage values use the :MEMORY:VDATA?
  query.
  The number of data samples which may be output in one set is
  1 to 80 using :ADATA? and 1 to 40 using the :VDATA? query.
 *Outputting data in bigger sets reduces the overall processing
  time.
 *Read data (2000 samples) for channel 1 when stored with
  a 20-division recording length.

Private Sub Sample3_Click()
'*******************************************************************************
' RS232C SAMPLE PROGRAM NO.3
'*******************************************************************************

deli$ = Chr$(13) & Chr$(10) 
Dim d(2000)

Comm1.PortOpen = True 

Comm1.Output = ":FUNCTION MEM" & deli$ 
Comm1.Output = ":CONFIGURE:SHOT 20" & deli$ 
Comm1.Output = ":TRIGGER:MODE SINGLE" & deli$ 
Comm1.Output = ":START;*OPC?" & deli$ 
Do
o$ = o$ & Comm1.Input
Loop Until InStr(1, o$, Chr$(10))
Comm1.Output = ":HEADER OFF" & deli$ 
Comm1.Output = ":MEMORY:MAXPOINT?" & deli$ 
Do
mx$ = mx$ & Comm1.Input
Loop Until InStr(1, mx$, Chr$(10))
If (Val(mx$) <> 2000) Then 
Comm1.PortOpen = False
Exit Sub
End If
Comm1.Output = ":MEMORY:POINT CH1,0" & deli$ 
For i = 0 To 2000
Comm1.Output = ":MEMORY:VDATA? 1" & deli$ 
Do
vd$ = vd$ & Comm1.Input
Loop Until InStr(1, vd$, Chr$(10))
d(i) = Val(vd$)
Next
For i = 0 To 2000 
Text1.Text = d(i)
Next 

Comm1.PortOpen = False 
End Sub



Example 4 Inputting storage data.

 *This program prepares storage memory, using the :MEMORY:PREPARE
  command. 
 *Next, the program specifies the channel and point for input,
  using the :MEMORY:POINT command, and then uses
  the :MEMORY:ADATA command to input data.

Private Sub Sample4_Click()
'*******************************************************************************
' RS232C SAMPLE PROGRAM NO.4
'*******************************************************************************

deli$ = Chr$(13) & Chr$(10) 

Comm1.PortOpen = True 

Comm1.Output = ":FUNCTION MEM" & deli$ 
Comm1.Output = ":CONFIGURE:SHOT 20" & deli$ 
Comm1.Output = ":MEMORY:PREPARE;*OPC?" & deli$ 
Do
o$ = Comm1.Input
Loop Until InStr(1, o$, Chr$(10))
Comm1.Output = ":MEMORY:POINT CH1,0" & deli$ 
For i = 0 To 2000 
Comm1.Output = ":MEMORY:ADATA " & Ltrim(Str$(Int(500 * Sin(3.14 * i / 500)))) & deli$ 
Next 

Comm1.PortOpen = False 
End Sub



Example 5 Checking the presence of input channel, and displaying
          the input ranges on the screen.

Private Sub Sample5_Click()
'*******************************************************************************
' RS232C SAMPLE PROGRAM NO.5
'*******************************************************************************

deli$ = Chr$(13) & Chr$(10) 

Comm1.PortOpen = True 

Comm1.Output = ":HEADER OFF" & deli$ 
Comm1.Output = "*OPT?" & deli$
Do
op$ = op$ & Comm1.Input
Loop Until InStr(1, op$, Chr$(10))
ch1% = Val(Mid$(op$, 1, 1))
ch2% = Val(Mid$(op$, 3, 1))
ch3% = Val(Mid$(op$, 5, 1))
ch4% = Val(Mid$(op$, 7, 1))
Comm1.Output = ":MEMORY:GETREAL"& deli$

If (ch1% <> 0) Then
Comm1.Output = ":MEMORY:AREL? CH1" & deli$
ar$ = ""
Do
ar$ = ar$ & Comm1.Input
Loop Until InStr(1, ar$, Chr$(10))
ch1_data$ = "CH1 = " & ar$
Else
ch1_data$ = "CH1 = NON"
End If

If (ch2% <> 0) Then
Comm1.Output = ":MEMORY:AREL? CH2" & deli$
ar$ = ""
Do
ar$ = ar$ & Comm1.Input
Loop Until InStr(1, ar$, Chr$(10))
ch2_data$ = "CH2 = " & ar$
Else
ch2_data$ = "CH2 = NON"
End If

If (ch3% <> 0) Then
Comm1.Output = ":MEMORY:AREL? CH3" & deli$
ar$ = ""
Do
ar$ = ar$ & Comm1.Input
Loop Until InStr(1, ar$, Chr$(10))
ch3_data$ = "CH3 = " & ar$
Else
ch3_data$ = "CH3 = NON"
End If

If (ch4% <> 0) Then
Comm1.Output = ":MEMORY:AREL? CH4" & deli$
ar$ = ""
Do
ar$ = ar$ & Comm1.Input
Loop Until InStr(1, ar$, Chr$(10))
ch4_data$ = "CH4 = " & ar$
Else
ch4_data$ = "CH4 = NON"
End If

Text1.Text = ch1_data$ & deli$ & ch2_data$ & deli$ & ch3_data$ &
deli$ & ch4_data$ & deli$

Comm1.PortOpen = False 
End Sub



Example 6 Saving stored data onto drive A

Private Sub Sample6_Click()
'*******************************************************************************
' RS232C SAMPLE PROGRAM NO.6
'*******************************************************************************

deli$ = Chr$(13) & Chr$(10) 
na$ = "a:\sample.dat" 

Comm1.PortOpen = True 

Comm1.Output = ":HEADER OFF" & deli$ 
Comm1.Output = ":MEMORY:MAXPOINT?" & deli$ 
Do 
mx$ = mx$ & Comm1.Input 
Loop Until InStr(1, mx$, Chr$(10))
If (Val(mx$) = 0) Then
Comm1.PortOpen = False
Exit Sub
End If

Open na$ For Output As #1
Comm1.Output = ":MEMORY:POINT CH1,0" & deli$ 
Print #1, 10
For i = 0 To 10
Comm1.Output = ":MEMORY:ADATA? 1" & deli$ 
ad$ = ""
Do
ad$ = ad$ & Comm1.Input
Loop Until InStr(1, ad$, Chr$(10))
Print #1, Val(ad$)
Next 

Close #1
Comm1.PortOpen = False 
End Sub



Example 7 Reading the data saved in Example 6, and loading it into the unit.

Private Sub Sample7_Click()
'*******************************************************************************
' RS232C SAMPLE PROGRAM NO.7
'*******************************************************************************

deli$ = Chr$(13) & Chr$(10) 
na$ = "a:\sample.dat" 

Comm1.PortOpen = True 

Comm1.Output = ":HEADER OFF" & deli$ 
Comm1.Output = ":MEMORY:PREPARE" & deli$ 
Do
o$ = Comm1.Input
Loop Until InStr(1, o$, Chr$(10))

Open na$ For Output As #1
Comm1.Output = ":MEMORY:POINT CH1,0" & deli$ 
Input #1, mx
For i = 0 To mx
Input #1, dt 
Comm1.Output = ":MEMORY:ADATA " & Str$(dt) & deli$ 
Next 

Close #1
Comm1.PortOpen = False 
End Sub

Download Driver Pack

How To Update Drivers Manually

After your driver has been downloaded, follow these simple steps to install it.

  • Expand the archive file (if the download file is in zip or rar format).

  • If the expanded file has an .exe extension, double click it and follow the installation instructions.

  • Otherwise, open Device Manager by right-clicking the Start menu and selecting Device Manager.

  • Find the device and model you want to update in the device list.

  • Double-click on it to open the Properties dialog box.

  • From the Properties dialog box, select the Driver tab.

  • Click the Update Driver button, then follow the instructions.

Very important: You must reboot your system to ensure that any driver updates have taken effect.

For more help, visit our Driver Support section for step-by-step videos on how to install drivers for every file type.

server: web3, load: 2.73