Test and Measurement Forum

Picoscope 4424 infinity-loop

Post any questions you may have about our current range of oscilloscopes

Picoscope 4424 infinity-loop

Postby Bernard » Tue Mar 09, 2010 1:54 pm

Hi,

I'm developing a Measuring-Software using the Picoscope 4424 device. Following your Programmers-Guide I made a simple tool measuring 1000 samples and traces them on the screen.

So here's my problem: After finished my first period of 1000 samples I have to restart the whole tool, because following your Programmers Guide p. 9 part "Using Block Mode" simply repeating steps 5 to 9 calls an Infinity loop.

I hope you can help me fast

Bernard
Bernard
 

Re: Picoscope 4424 infinity-loop

Postby Robin » Wed Mar 17, 2010 4:20 pm

Hi Bernard

I'm not sure I follow. Are you repeating steps 5 to 9 indefinitely?

Have you looked at our examples?

Robin
Robin
Zen Master
Zen Master
 
Posts: 558
Joined: Fri Sep 19, 2008 10:17 am

Re: Picoscope 4424 infinity-loop

Postby Bernard » Fri Mar 19, 2010 2:41 pm

Hey sorry for being not that specific. My program tries to measure 2 "sets" of data with the picoscope.

Before I start measuring I open the Unit, set my Trigger, Timebase and channel.

Then comes my loop "for(i=0;i<2;i++)" starting runBlock, waiting for the blockReady Callback. this is the callback function of your example.

void __stdcall CallBackBlock
(
short handle,
PICO_STATUS status,
void * pParameter
)
{
// flag to say done reading data
g_ready = TRUE;
}

Inj the first run everything runs perfect. I can display my results and move on to run 2. Here my function "ready"

PS4000MPI short ready()
{
if(g_ready==TRUE)
{
return 1;
}
else
{
return 0;
}
}

never gives back a 1 and i'm captured in the loop.

After I call the getValues function of your DLL I reset my g_ready to False as done in your examplecode.

That's the problem.

I hope this is more specific. I'm new in this "buisness" so I'm not sure I used the right words to explain

Bernard
Bernard
 

Re: Picoscope 4424 infinity-loop

Postby Robin » Fri Mar 19, 2010 3:22 pm

Hi Bernard

I understand now.

This is probably due to either not calling the correct functions to set up the device or passing an out-of-range parameter.

I would look at the example code and ensure that you are following exactly the same steps. Also, you should check the error codes returned by the driver.

You could use the example as the starting point and change it to suit your needs.

Let me know how you get on.

Robin
Robin
Zen Master
Zen Master
 
Posts: 558
Joined: Fri Sep 19, 2008 10:17 am

Re: Picoscope 4424 infinity-loop

Postby Bernard » Fri Mar 19, 2010 4:12 pm

Hm that's the other problem. There are no error codes given back by the driver because it runs great I only measure one set of data. In the second run it waits until the runBlock function uses the callback function to signal that there are datas ready,which does not happen.

So i think it's more a problem of the callback function than parameters because I do not change my parameters from run 1 to run 2.

Before run 2 starts I only reset my g_ready flag. This is the problem I cant't understand, because there's nothing changedf betwenn the runs.

This is my program:

1. import the ps4000 library

2. open unit

3. display unit info

4. set my channel settings
4.1 activate channel A
4.2 activate channel B
4.3 deactivate C
4.4 deactivate D

5.setTimebase with timebase 6 | noOfSamples 8192 | oversample 0 + pointers

6. set TriggerChannelConditions to channel A with my threshold and window mode

7. TriggerChannelDirections TRUE on A DONT_CARE others

8. TriggerChannelProperties FALLING on A NONE on B,C,D

9. loop "for int i=0;i<2;...
9.1 runBlock samples 8192 timebase 6
9.2 wating until scope is ready...
9.3 stop the scope
9.4 setDataBuffers for A and B
9.5 getValues noOfSamples 8192
9.6 display

10. closeUnit
11. free arrays
12. end

as you do in the example code. So I think it's more a problem of the flags and the recall of the callback function but I don't know where to look.

I hope you can help me

Bernard
Bernard
 

Re: Picoscope 4424 infinity-loop

Postby Robin » Mon Mar 22, 2010 12:41 pm

Hi

I can't see anything that is obviously wrong, I'm afraid. It's difficult to say what the problem is, especially if all the calls are returning PICO_OK.

I suggest that you use our example as your starting point and modify it as required.

Robin
Robin
Zen Master
Zen Master
 
Posts: 558
Joined: Fri Sep 19, 2008 10:17 am

Re: Picoscope 4424 infinity-loop

Postby Bernard » Mon Mar 22, 2010 1:11 pm

Okay made it. I used ps4000Stop after each turn. This is not allowed. I dis-interpreted your example program.

Bernard
Bernard
 

Re: Picoscope 4424 infinity-loop

Postby Bernard » Tue Mar 23, 2010 9:59 am

Hey I hope I'm not anoying you. I used your example to creatre a new program. But there's still the same problem. In the second run the runBlock fuction does not run the callback function.

I don't really know your function so I think it's a problem of my settings but I use exactly the same as in the first run. Please help me.

Bernard
Bernard
 

Re: Picoscope 4424 infinity-loop

Postby Robin » Wed Mar 24, 2010 11:10 am

Hi Bernard

I forgot that the example only collects a single block.

I have created a quick example that collects 20 blocks (you can easily change this).

See the attached.

I hope it's useful

Robin
Attachments
ps4000_block.cpp
(1.99 KiB) Downloaded 142 times
Robin
Zen Master
Zen Master
 
Posts: 558
Joined: Fri Sep 19, 2008 10:17 am

Re: Picoscope 4424 infinity-loop

Postby Bernard » Wed Mar 24, 2010 12:26 pm

This really helped me understanding how to use the scope.

Thank you for the great support.

Bernard
Bernard
Newbie
 
Posts: 0
Joined: Tue Mar 23, 2010 3:09 pm


Return to USB PC Oscilloscopes

Who is online

Users browsing this forum: No registered users and 0 guests