Rapid Block Mode LabVIEW PS4224

Post your LabVIEW discussions here
christianbaker
Newbie
Posts: 0
Joined: Mon Apr 19, 2010 12:27 pm
Location: London, UK

Rapid Block Mode LabVIEW PS4224

Post by christianbaker »

Hi,

I'm having some trouble adapting the LabVIEW block mode example that comes with the 4224 so that it uses rapid block mode.

I've been following the guide here http://www.picotech.com/document/pdf/ps4000pg.en-3.pdf (page 10) which includes C++(?) examples. Does anyone know of any LabVIEW examples of rapid block mode?

I've attached an adapted version of my not working VI so far (I've removed the analysis section that takes place after aquisition). Before attempting to implement rapid block mode, I had already modified the example to always use channel A as it's own trigger, and to only display the acquired waveforms after acquisition of a fixed number of waveforms was complete. This all worked fine until trying to implment rapid block mode.

Thanks,
Christian
Attachments
cb_PS4000_rapidblock_forum.vi
(75.99 KiB) Downloaded 935 times

Robin
Advanced User
Advanced User
Posts: 558
Joined: Fri Sep 19, 2008 10:17 am

Re: Rapid Block Mode LabVIEW PS4224

Post by Robin »

Hi Christian

We don't have a rapid block LabVIEW example, unfortunately.

I can't open your VI, as I have Labview 8.2.

Have you segmented the memory using ps4000MemorySegments? The number of segments should be greater than or equal to the number of captures.

Are any of your function calls returning errors?

Regards

Robin

christianbaker
Newbie
Posts: 0
Joined: Mon Apr 19, 2010 12:27 pm
Location: London, UK

Re: Rapid Block Mode LabVIEW PS4224

Post by christianbaker »

Thanks for your reply. As far as I can tell I'm doing everything it says in the Programmer's Guide, although my understanding of C is poor so I'm finding it difficult to implement the C examples provided in the document as LabVIEW code.

One specific problem: the Programmer's Guide states to use ps4000BlockReady for Rapid Block Mode. I couldn't find this, and am instead using IsReady-2 (the function used in the LabVIEW block mode example). Is this OK? It works fine in bulk mode but hasn't been in rapid bulk mode (although this could be caused my something else).

I've attached an updated version of the VI, saved for version 8.2, although it did give me 33 warnings when it saved so not sure if it will open.

Thanks again,
Christian.
Attachments
cb_PS4000_rapidblock_forum2.vi
(119.83 KiB) Downloaded 773 times

Robin
Advanced User
Advanced User
Posts: 558
Joined: Fri Sep 19, 2008 10:17 am

Re: Rapid Block Mode LabVIEW PS4224

Post by Robin »

Hi Christian

I though it would be a good idea to create a rapid block example, so here it is.

Let me know how you get on.

Regards

Robin
Attachments
PS4000_rapid_block.vi
(143.07 KiB) Downloaded 847 times

christianbaker
Newbie
Posts: 0
Joined: Mon Apr 19, 2010 12:27 pm
Location: London, UK

Re: Rapid Block Mode LabVIEW PS4224

Post by christianbaker »

That works great, thanks very much.

Why is it that you have executed getvaluesbulk one time for each waveform (in the for loop) and not just once so that it retrieves all the waveforms at once as suggested in the programmers guide, where it sets the from segment index and to segment index differently?

I only ask because I am trying to use GetValuesTriggerTimeOffsetBulk64 so that I can measure the time elapsed between each trigger. I have tried it two ways:

1) the same way that you implemented getvaluesbulk (in a loop, once for each waveform) (see loop.jpg attached)
Image
2) without a loop, executing once for all memory segments from zero to numberofcaptures-1 (see noloop.jpg attached).
Image
With both methods, I only get a single time value, presumably for the first memory segment, in the first element of the array. Do you know what I'm doing wrong?

Thanks again for your help, much appreciated.
Christian.
Attachments
noloop.JPG
noloop.JPG (15.05 KiB) Viewed 27121 times
loop.JPG
loop.JPG (21.73 KiB) Viewed 27121 times

Robin
Advanced User
Advanced User
Posts: 558
Joined: Fri Sep 19, 2008 10:17 am

Re: Rapid Block Mode LabVIEW PS4224

Post by Robin »

Hi Christian
christianbaker wrote:Why is it that you have executed getvaluesbulk one time for each waveform (in the for loop) and not just once so that it retrieves all the waveforms at once as suggested in the programmers guide, where it sets the from segment index and to segment index differently?
Good question! I just did it like this because it seemed to be the easiest way to modify the existing example. But you are right, it is only necessary to call it once with the appropriate segment indicies.

Regarding ps4000GetValuesTriggerTimeOffsetBulk64, you are calling it correctly but there is a bug in the driver. I have attached a fixed version to this post. Bear in mind that this is not a official fully-tested release. However, it should work fine.

Let me know if you have any problems

Robin
Attachments
PS4000.zip
(364.18 KiB) Downloaded 787 times

christianbaker
Newbie
Posts: 0
Joined: Mon Apr 19, 2010 12:27 pm
Location: London, UK

Re: Rapid Block Mode LabVIEW PS4224

Post by christianbaker »

Thanks alot. I'm having a few problems still though :arrow:

Is the new ps4000.dll supposed to entirely replace the old ps4000.dll?

If I only use the new ps4000.dll for GetValuesTriggerTimeOffsetBulk64, and keep the rest of the functions loading from the old ps4000.dll and ps4000wrap.dll (I had to rename the new ps4000.dll to get labview to do this), then GetValuesTriggerTimeOffsetBulk64 gives me error C (invalid handle).

If I replace the old ps4000.dll with the new one, so that all functions (except those from ps4000wrap.dll) are loaded from the new ps4000.dll, then the program never gets passed the IsReady loop (which is from ps4000wrap.dll).

The third thing I tried was to change all the functions from ps4000wrap.dll so that they were also loaded from the new ps4000.dll (this meant using functions with a slightly different name, e.g. 'ps4000RunBlock' from ps4000.dll instead of 'RunBlock' from ps4000wrap.dll). However, IsReady only seems to exist in ps4000wrap.dll, so couldn't be changed (even though the documetation states to use a function called ps4000BlockReady from ps4000.dll which doesn't exist). As above, the program never gets passed the IsReady loop.

Do you know which of the above is the correct approach and why it isn't working? Also, almost all functions seem to have two versions, one with a '-2' appended to it and one without. Do you know which I should be using?

Sorry for the long reply but I hope more detail makes it easier for you to help.

Thanks again,

Christian.

Robin
Advanced User
Advanced User
Posts: 558
Joined: Fri Sep 19, 2008 10:17 am

Re: Rapid Block Mode LabVIEW PS4224

Post by Robin »

Hi

The new version of ps4000.dll should be used to replace the existing one. You say that when you do this, the VI is not exiting the isReady loop. The wrapper DLL also calls ps4000.dll and it could be that LabVIEW and the wrapper are using different copies of ps4000.dll. Make sure your VI and the two DLLs are in the same folder.

Process Explorer is a useful tool for seeing which DLLs are loaded:

http://technet.microsoft.com/en-us/sysi ... 96653.aspx

ps4000BlockReady is not a driver function, it is a function that the user provides (by passing a function pointer to ps4000RunBlock) and the driver calls when it is ready. LabVIEW doesn't support function pointers, which is why we use the wrapper DLL. The source code for the wrapper is included in the SDK (ps4000wrap.c).

Hope this helps

Robin

christianbaker
Newbie
Posts: 0
Joined: Mon Apr 19, 2010 12:27 pm
Location: London, UK

Re: Rapid Block Mode LabVIEW PS4224

Post by christianbaker »

Thanks that's cleared things up. I managed to get some numbers out of GetValuesTriggerTimeOffsetBulk64 using the new DLL, but I'm not sure how to use them. Some of them are negative and they seem to change randomly between timeUnits.

I implemented it like this, can you see what's going wrong?:

Image

Not sure I really understand timeUnits, and I think that might be the problem. Thanks for all your help so far, I'm getting there slowly!

Christian.
Attachments
gettriggertime.JPG
gettriggertime.JPG (12.67 KiB) Viewed 27121 times

Robin
Advanced User
Advanced User
Posts: 558
Joined: Fri Sep 19, 2008 10:17 am

Re: Rapid Block Mode LabVIEW PS4224

Post by Robin »

Hi Christian

GetValuesTriggerTimeOffsetBulk64 returns the time difference between the first sample in your block and the actual trigger event (crossing of the threshold) using linear interpolation.

This can be positive or negative as the first sample in your block will always be the one closest to the trigger event.

Time units gives you the units for the offset time returned.

0: Femtoseconds
1: Picoseconds
2: Nanoseconds
etc.


Robin

Guest

Re: Rapid Block Mode LabVIEW PS4224

Post by Guest »

Oh I see, so there's no way of finding out the elapsed time between each trigger event (or resulting block/waveform) with rapid block mode?

christianbaker
Newbie
Posts: 0
Joined: Mon Apr 19, 2010 12:27 pm
Location: London, UK

Re: Rapid Block Mode LabVIEW PS4224

Post by christianbaker »

Or, alternatively, the time between the runblock command and the first trigger event

Robin
Advanced User
Advanced User
Posts: 558
Joined: Fri Sep 19, 2008 10:17 am

Re: Rapid Block Mode LabVIEW PS4224

Post by Robin »

Unfortunately, the driver does not calculate this.

BSI
Newbie
Posts: 0
Joined: Wed May 12, 2010 3:15 pm
Location: Canada

Re: Rapid Block Mode LabVIEW PS4224

Post by BSI »

Hi,
I have been trying to speed up the Rapid Block Mode example provided by Pico. In their example, the ps4000GetValueBlock is called for each segment. Since this API call allows for selecting fromSegmentIndex and toSegmentIndex, it seems possible to obtain all the data in a single call instead of calling the API as many times as there are segments/captures.

Has any one tried this? Could Pico provide an example for this?
Thx.
Laurent.

Robin
Advanced User
Advanced User
Posts: 558
Joined: Fri Sep 19, 2008 10:17 am

Re: Rapid Block Mode LabVIEW PS4224

Post by Robin »

Hi

This is demonstrated in the C example, ps4000con.c.

Robin

Post Reply