PicoScope 7 Software
Available on Windows, Mac and Linux
Code: Select all
Declare Function pl1000OpenUnit Lib "pl1000.dll" (ByRef handle As Integer) As Integer
Declare Function pl1000CloseUnit Lib "pl1000.dll" (ByVal handle As Integer) As Long
Declare Function pl1000GetUnitInfo Lib "pl1000.dll" (ByVal handle As Integer, ByVal S As String, ByVal lth As Integer, ByRef requiredSize As Integer, ByVal info As Integer) As Integer
Declare Function pl1000SetTrigger Lib "pl1000.dll" (ByVal handle As Integer, ByVal enabled As Integer, ByVal enable_auto As Integer, ByVal auto_ms As Integer, ByVal channel As Integer, ByVal dir As Integer, ByVal threshold As Integer, ByVal hysterisis As Integer, ByVal delay As Single) As Integer
Declare Function pl1000SetInterval Lib "pl1000.dll" (ByVal handle As Short, ByRef us_for_block As Integer, ByVal ideal_no_of_samples As Integer, ByRef channels As Short, ByVal No_of_channels As Short) As Integer
Declare Function pl1000GetValues Lib "pl1000.dll" (ByVal handle As Short, ByVal PLvalues As Short, ByVal no_of_values As Integer, ByVal overflow As Short, ByVal triggerIndex As Long) As Short
Declare Function pl1000Run Lib "pl1000.dll" (ByVal handle As Integer, ByVal no_of_values As Long, ByVal method As Integer) As Integer
Declare Function pl1000Ready Lib "pl1000.dll" (ByVal handle As Integer, ByRef ready As Integer) As Integer
Declare Function pl1000MaxValue Lib "pl1000.dll" (ByVal handle As Integer, ByRef maxValue As Integer) As Long
Public status As Long
Public handle As Integer
Public values As Integer
Public channels(22) As Short
Public nValues As Long
Public ready As Integer
Public requiredSize As Integer
Public S As New String(" "c, 255)
Public SLegnth As Long
Public maxValue As Integer
Public opened As Integer
Public triggerIndex As Long
Public overflow As Short
Function adc_to_mv(ByRef value As Integer) As Integer
adc_to_mv = value / maxValue * 2500
End Function
Sub Pl1000()
' Open device
status = pl1000OpenUnit(handle)
opened = handle <> 0
If opened Then
'Get the maximum ADC value for this variant
status = pl1000MaxValue(handle, maxValue)
' Get the unit information
TestBoitier.Label1.Text = "Picolog plugged"
SLegnth = pl1000GetUnitInfo(handle, S, 255, requiredSize, 3)
TestBoitier.Label2.Text = S
'MsgBox(SLegnth)
SLegnth = pl1000GetUnitInfo(handle, S, 255, requiredSize, 4)
TestBoitier.Label3.Text = S
'MsgBox(SLegnth)
' Say that we want to take 1 reading in 1 s
' from channels 1
channels(0) = 1
status = pl1000SetInterval(handle, 1000000, 1, 1, 1)
'MsgBox(status)
status = pl1000Run(handle, 1, 0)
'MsgBox(status)
ready = 0
Do While ready = 0
status = pl1000Ready(handle, ready)
'MsgBox("" & status & " " & ready & " ")
Loop
' Get a block of 1 reading...
status = pl1000GetValues(handle, values, 2, overflow, triggerIndex)
MsgBox(status)
' Copy the data into the Label
TestBoitier.Label4.Text = adc_to_mv(values)
' Close the unit when finished to drop the driver
Call pl1000CloseUnit(handle)
Else
TestBoitier.Label1.Text = "Picolog not plugged"
End If
End Sub
Code: Select all
status = pl1000GetValues(handle, values, 2, overflow, triggerIndex)
Code: Select all
Declare Function pl1000GetValues Lib "pl1000.dll" (ByVal handle As Short, ByVal PLvalues As Short, ByVal no_of_values As Integer, ByVal overflow As Short, ByVal triggerIndex As Integer) As Short