Test and Measurement Forum

Need VB6 examples for ps3000 scopes

Post your VB and VBA discussions here

Need VB6 examples for ps3000 scopes

Postby billw » Mon Oct 21, 2013 7:27 pm

Hello all,

I'm new to PicoScope, and specifically to the PS 3404B, in fact, I don't even have the scope yet in hand.

What I need are programming examples in VB/VB6 (even VBA), At this point, anything will help. Specifically, I need to measure a current and voltage waveforms for an automotive control module. I need to trigger on the rising edge of the current waveform, then measure the value at a delayed value from that point of triggering. Of course, this is a simple task done manually, but programmatically, that is a different story.

Edit: In previous versions of the PS3000 SDK, they included a VB example. Unfortunately, the current SDK (ps3000a r10.5.0.19) does not. If anyone has those, please pass them along (ps3000.vbp/.bas/.frm). I know it will need modification from ps3000 to ps3000a calls, but its a start.

I looked at the PS3000 programmers guide, but it's of course in "C" format (us VB guy's get no respect :cry: ). I can probably decipher most of it, but having code examples in VB will go a long way to filtering through the differences in declaration and usage. For example, I would assume the "C" version would be converted as such in VB.

"C" Declaration
Code: Select all
PICO_STATUS ps3000aGetTimebase
(
short handle,
unsigned long timebase,
long noSamples,
long * timeIntervalNanoseconds,
short oversample,
long * maxSamples,
unsigned short segmentIndex
)

"VB" Declaration (pulled from Excel VBA example)
Code: Select all
Declare Function ps3000aGetTimebase Lib "ps3000a.dll" (_
ByVal handle As Integer, _
ByVal timebase As Long, _
ByVal noSamples As Long, _
timeInterval As Long, _
ByVal oversample As Integer, _
maxSamples As Long, _
ByVal segment As Integer) As Integer

Of course, the "C" function(?) "PICO_STATUS" is clear as mud as far as usage. I assume its the same as the calling format:

Code: Select all
Dim handle As Integer
Dim status As Integer

status = ps3000aGetTimebase(handle, timebase, no_of_samples, time_interval, 1, max_samples, 0)

Any help here would be greatly appreciated.

Thanks,
Bill
billw
Newbie
 
Posts: 0
Joined: Mon Oct 21, 2013 6:04 pm

Re: Need VB6 examples for ps3000 scopes

Postby Martyn » Thu Oct 24, 2013 6:51 am

There are two device ranges here, the 3000 series which is no longer made, and the new 3000a series which is in current production.

There were VB examples for the old 3000 series devices, we were still actively using VB6 when these products were developed, and these can still be found by downloading an sdk for one of these devices from http://www.picotech.com/software.html. I suggest you select the 3204 at Step 1 and then the SDK at Step 2.

For the new series we only offer VBA, in the excel example, and no longer do any VB6 development as our main focus is .Net, the basis for our own Picoscope6 software, and Matlab. Are you not able to use the VBA example code to get you going with VB6 ? you can ask question of the support team at support@picotech.com but we will not be able to run up any code.

Please note that the driver model for the newer devices is completely different to the old series and so moving code from one to the other will not necessarily be a straightforward process.
Martyn
Technical Specialist
Martyn
Site Admin
Site Admin
 
Posts: 2350
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

Re: Need VB6 examples for ps3000 scopes

Postby billw » Fri Nov 01, 2013 7:02 pm

Martyn wrote:There are two device ranges here, the 3000 series which is no longer made, and the new 3000a series which is in current production.

There were VB examples for the old 3000 series devices, we were still actively using VB6 when these products were developed, and these can still be found by downloading an sdk for one of these devices from http://www.picotech.com/software.html. I suggest you select the 3204 at Step 1 and then the SDK at Step 2.

I'm currently evaluating the 3404A scope. I D/L'd the SDK as you suggested, but it's the same as the one that comes with the scope's CD, using the older ps3000.dll.

Martyn wrote:For the new series we only offer VBA, in the excel example, and no longer do any VB6 development as our main focus is .Net, the basis for our own Picoscope6 software, and Matlab. Are you not able to use the VBA example code to get you going with VB6 ? you can ask question of the support team at support@picotech.com but we will not be able to run up any code.

Please note that the driver model for the newer devices is completely different to the old series and so moving code from one to the other will not necessarily be a straightforward process.

As for the VBA/Excel sample in the current SDK, that is written for the ps3000a.dll, whereas the the older VB example uses older (and incompatible) ps3000.dll. Trying to use either one in a VB6 environment requires much recoding because you're either translating GUI functions from Excel to VB, or taking the old VB code and error checking it because of the differences between the old and new DLL versions.

At the end of the day, all I really need is a programmers reference for VB/VBA (or even VB.Net which is close enough). In lieu of that, I'll probably have to create my own, based on the current C/C# guide, but really don't have the time to reinvent the wheel.

In my experience, there's a very large installed base of VB6 users and installations for industrial automation and test, which we're committed to. VB6 has proved to be quite capable and readable by just about anyone.

Thanks though for responding.
billw
Newbie
 
Posts: 0
Joined: Mon Oct 21, 2013 6:04 pm

Re: Need VB6 examples for ps3000 scopes

Postby Martyn » Mon Nov 04, 2013 8:51 am

Which particular functionality would you be looking for

BlockMode/StreamingMode? With a SimpleTrigger? Using the Signal Generator?
Martyn
Technical Specialist
Martyn
Site Admin
Site Admin
 
Posts: 2350
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

Re: Need VB6 examples for ps3000 scopes

Postby billw » Mon Nov 04, 2013 2:58 pm

Martyn wrote:Which particular functionality would you be looking for

BlockMode/StreamingMode? With a SimpleTrigger? Using the Signal Generator?

The sample waveform shown below represents a 48VDC/20A switching power supply, operating with a switched 20A load at 50Hz, 10% Duty Cycle. As seen, manually setup scope measurements are relatively simple. There are two waveforms seen on each of 2 channels. For this example, lets say that Ch.A is measuring a 48VDC level (via a 10x probe), and Ch.B is measuring a corresponding current waveform (it's tbd on whether it would be via a shunt or a current probe).

Triggered on the rising edge of the Ch.B (trigger level at ~20mV):
1) Measure Voltage level on Ch.A at "t0" from the initial "t0" trigger point.
2) Measure Current (voltage) level on Ch.B, 1.5mS from the "t0" trigger.

Note: Depending on the speed of data acquisition, scope command latency, and processing, the second "triggered" measurement below, can be done on a subsequent load pulse, because the power supply's performance is somewhat repeatable. However, it is highly desirable to do both measurements on the same load pulse.

Triggered on the falling edge of Ch.B (trigger level at ~80mV):
3) Measure Voltage level on Ch.A at "t1" (about 2.0mS from "t0").
4) Measure Voltage level on Ch.A at "t2", 2.0mS from the "t1" trigger.

I will probably use the internal signal generator to generate the 50Hz, 10% Duty Cycle test pulse that controls the electronic load for this test. The AWG output will be turned On/Off via the test program. The AWG's 2.0V output limit is limiting for its low output level (10V is much more common in AWG's), so I'll have to fab up a boost circuit to compensate.

Given time, this can probably be figured out how to do this (deciphering the "C" programming function calls), but any help would be gratefully appreciated.

Thanks,
Bill
Attachments
FICM Test Waveform.gif
billw
Newbie
 
Posts: 0
Joined: Mon Oct 21, 2013 6:04 pm

Re: Need VB6 examples for ps3000 scopes

Postby Martyn » Tue Nov 19, 2013 10:35 am

We will look to produce some code snippets to help users in the near future.
Martyn
Technical Specialist
Martyn
Site Admin
Site Admin
 
Posts: 2350
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots


Return to VB and VBA (Excel, Access)

Who is online

Users browsing this forum: No registered users and 0 guests